Re: [PATCH v3 net-next 03/13] octeontx2-af: Generate key field bit mask from KEX profile

From: Naveen Mamindlapalli
Date: Sat Nov 14 2020 - 13:55:21 EST


Hi Alexander,

Thanks for the review.

> -----Original Message-----
> From: Alexander Duyck <alexander.duyck@xxxxxxxxx>
> Sent: Friday, November 13, 2020 2:55 AM
> To: Naveen Mamindlapalli <naveenm@xxxxxxxxxxx>
> Cc: Netdev <netdev@xxxxxxxxxxxxxxx>; LKML <linux-kernel@xxxxxxxxxxxxxxx>;
> Jakub Kicinski <kuba@xxxxxxxxxx>; David Miller <davem@xxxxxxxxxxxxx>;
> saeed@xxxxxxxxxx; Sunil Kovvuri Goutham <sgoutham@xxxxxxxxxxx>; Linu
> Cherian <lcherian@xxxxxxxxxxx>; Geethasowjanya Akula
> <gakula@xxxxxxxxxxx>; Jerin Jacob Kollanukkaran <jerinj@xxxxxxxxxxx>;
> Subbaraya Sundeep Bhatta <sbhatta@xxxxxxxxxxx>; Hariprasad Kelam
> <hkelam@xxxxxxxxxxx>
> 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@xxxxxxxxxxx> wrote:
> >
> > From: Subbaraya Sundeep <sbhatta@xxxxxxxxxxx>
> >
> > 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@xxxxxxxxxxx>
> > Signed-off-by: Sunil Goutham <sgoutham@xxxxxxxxxxx>
> > Signed-off-by: Naveen Mamindlapalli <naveenm@xxxxxxxxxxx>
>
> A few minor spelling issues, otherwise it looks fine.
>
> Reviewed-by: Alexander Duyck <alexanderduyck@xxxxxx>
>
> > ---
> > 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/

Okay, I will change.

>
> > +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/

I will update this too.

>
> > + 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".

I will change them all & send v4.

>
>
> > + 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
> >