lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 12 Nov 2020 13:24:39 -0800
From:   Alexander Duyck <alexander.duyck@...il.com>
To:     Naveen Mamindlapalli <naveenm@...vell.com>
Cc:     Netdev <netdev@...r.kernel.org>,
        LKML <linux-kernel@...r.kernel.org>,
        Jakub Kicinski <kuba@...nel.org>,
        David Miller <davem@...emloft.net>, saeed@...nel.org,
        sgoutham@...vell.com, lcherian@...vell.com, gakula@...vell.com,
        jerinj@...vell.com, sbhatta@...vell.com, hkelam@...vell.com
Subject: Re: [PATCH v3 net-next 03/13] octeontx2-af: Generate key field bit
 mask from KEX profile

On Tue, Nov 10, 2020 at 11:24 PM Naveen Mamindlapalli
<naveenm@...vell.com> wrote:
>
> From: Subbaraya Sundeep <sbhatta@...vell.com>
>
> Key Extraction(KEX) profile decides how the packet metadata such as
> layer information and selected packet data bytes at each layer are
> placed in MCAM search key. This patch reads the configured KEX profile
> parameters to find out the bit position and bit mask for each field.
> The information is used when programming the MCAM match data by SW
> to match a packet flow and take appropriate action on the flow. This
> patch also verifies the mandatory fields such as channel and DMAC
> are not overwritten by the KEX configuration of other fields.
>
> Signed-off-by: Subbaraya Sundeep <sbhatta@...vell.com>
> Signed-off-by: Sunil Goutham <sgoutham@...vell.com>
> Signed-off-by: Naveen Mamindlapalli <naveenm@...vell.com>

A few minor spelling issues, otherwise it looks fine.

Reviewed-by: Alexander Duyck <alexanderduyck@...com>

> ---
>  drivers/net/ethernet/marvell/octeontx2/af/Makefile |   2 +-
>  drivers/net/ethernet/marvell/octeontx2/af/npc.h    |  48 ++
>  drivers/net/ethernet/marvell/octeontx2/af/rvu.h    |  38 ++
>  .../net/ethernet/marvell/octeontx2/af/rvu_npc.c    |  11 +-
>  .../net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c | 562 +++++++++++++++++++++
>  5 files changed, 658 insertions(+), 3 deletions(-)
>  create mode 100644 drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c
>
> diff --git a/drivers/net/ethernet/marvell/octeontx2/af/Makefile b/drivers/net/ethernet/marvell/octeontx2/af/Makefile
> index 2f7a861d0c7b..ffc681b67f1c 100644
> --- a/drivers/net/ethernet/marvell/octeontx2/af/Makefile
> +++ b/drivers/net/ethernet/marvell/octeontx2/af/Makefile
> @@ -9,4 +9,4 @@ obj-$(CONFIG_OCTEONTX2_AF) += octeontx2_af.o
>
>  octeontx2_mbox-y := mbox.o rvu_trace.o
>  octeontx2_af-y := cgx.o rvu.o rvu_cgx.o rvu_npa.o rvu_nix.o \
> -                 rvu_reg.o rvu_npc.o rvu_debugfs.o ptp.o
> +                 rvu_reg.o rvu_npc.o rvu_debugfs.o ptp.o rvu_npc_fs.o
> diff --git a/drivers/net/ethernet/marvell/octeontx2/af/npc.h b/drivers/net/ethernet/marvell/octeontx2/af/npc.h
> index 91a9d00e4fb5..0fe47216f771 100644
> --- a/drivers/net/ethernet/marvell/octeontx2/af/npc.h
> +++ b/drivers/net/ethernet/marvell/octeontx2/af/npc.h
> @@ -140,6 +140,54 @@ enum npc_kpu_lh_ltype {
>         NPC_LT_LH_CUSTOM1 = 0xF,
>  };
>
> +/* list of known and supported fields in packet header and
> + * fields present in key structure.
> + */
> +enum key_fields {
> +       NPC_DMAC,
> +       NPC_SMAC,
> +       NPC_ETYPE,
> +       NPC_OUTER_VID,
> +       NPC_TOS,
> +       NPC_SIP_IPV4,
> +       NPC_DIP_IPV4,
> +       NPC_SIP_IPV6,
> +       NPC_DIP_IPV6,
> +       NPC_SPORT_TCP,
> +       NPC_DPORT_TCP,
> +       NPC_SPORT_UDP,
> +       NPC_DPORT_UDP,
> +       NPC_SPORT_SCTP,
> +       NPC_DPORT_SCTP,
> +       NPC_HEADER_FIELDS_MAX,
> +       NPC_CHAN = NPC_HEADER_FIELDS_MAX, /* Valid when Rx */
> +       NPC_PF_FUNC, /* Valid when Tx */
> +       NPC_ERRLEV,
> +       NPC_ERRCODE,
> +       NPC_LXMB,
> +       NPC_LA,
> +       NPC_LB,
> +       NPC_LC,
> +       NPC_LD,
> +       NPC_LE,
> +       NPC_LF,
> +       NPC_LG,
> +       NPC_LH,
> +       /* ether type for untagged frame */
> +       NPC_ETYPE_ETHER,
> +       /* ether type for single tagged frame */
> +       NPC_ETYPE_TAG1,
> +       /* ether type for double tagged frame */
> +       NPC_ETYPE_TAG2,
> +       /* outer vlan tci for single tagged frame */
> +       NPC_VLAN_TAG1,
> +       /* outer vlan tci for double tagged frame */
> +       NPC_VLAN_TAG2,
> +       /* other header fields programmed to extract but not of our interest */
> +       NPC_UNKNOWN,
> +       NPC_KEY_FIELDS_MAX,
> +};
> +
>  struct npc_kpu_profile_cam {
>         u8 state;
>         u8 state_mask;
> diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu.h b/drivers/net/ethernet/marvell/octeontx2/af/rvu.h
> index 1724dbd18847..7e556c7b6ccf 100644
> --- a/drivers/net/ethernet/marvell/octeontx2/af/rvu.h
> +++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu.h
> @@ -15,6 +15,7 @@
>  #include "rvu_struct.h"
>  #include "common.h"
>  #include "mbox.h"
> +#include "npc.h"
>
>  /* PCI device IDs */
>  #define        PCI_DEVID_OCTEONTX2_RVU_AF              0xA065
> @@ -105,6 +106,36 @@ struct nix_mce_list {
>         int                     max;
>  };
>
> +/* layer meta data to uniquely identify a packet header field */

s/meta data/metadata/

> +struct npc_layer_mdata {
> +       u8 lid;
> +       u8 ltype;
> +       u8 hdr;
> +       u8 key;
> +       u8 len;
> +};
> +

<snip>

> +       /* Handle header fields which can come from multiple layers like
> +        * etype, outer vlan tci. These fields should have same position in
> +        * the key otherwise to install a mcam rule more than one entry is
> +        * needed which complicates mcam space management.
> +        */
> +       etype_ether = &key_fields[NPC_ETYPE_ETHER];
> +       etype_tag1 = &key_fields[NPC_ETYPE_TAG1];
> +       etype_tag2 = &key_fields[NPC_ETYPE_TAG2];
> +       vlan_tag1 = &key_fields[NPC_VLAN_TAG1];
> +       vlan_tag2 = &key_fields[NPC_VLAN_TAG2];
> +
> +       /* if key profile programmed does not extract ether type at all */

s/ether type/Ethertype/

> +       if (!etype_ether->nr_kws && !etype_tag1->nr_kws && !etype_tag2->nr_kws)
> +               goto vlan_tci;
> +
> +       /* if key profile programmed extracts ether type from one layer */

Same issue here and a few other places, replace "ether type" with "Ethertype".


> +       if (etype_ether->nr_kws && !etype_tag1->nr_kws && !etype_tag2->nr_kws)
> +               key_fields[NPC_ETYPE] = *etype_ether;
> +       if (!etype_ether->nr_kws && etype_tag1->nr_kws && !etype_tag2->nr_kws)
> +               key_fields[NPC_ETYPE] = *etype_tag1;
> +       if (!etype_ether->nr_kws && !etype_tag1->nr_kw
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ