linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexander Duyck <alexander.duyck@gmail.com>
To: Naveen Mamindlapalli <naveenm@marvell.com>
Cc: Netdev <netdev@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Jakub Kicinski <kuba@kernel.org>,
	David Miller <davem@davemloft.net>,
	saeed@kernel.org, sgoutham@marvell.com, lcherian@marvell.com,
	gakula@marvell.com, jerinj@marvell.com, sbhatta@marvell.com,
	hkelam@marvell.com
Subject: Re: [PATCH v3 net-next 03/13] octeontx2-af: Generate key field bit mask from KEX profile
Date: Thu, 12 Nov 2020 13:24:39 -0800	[thread overview]
Message-ID: <CAKgT0Uc64qDVMm3HfXmyPoGYJezaKzEBzw76u6xXkpRqBCXGzA@mail.gmail.com> (raw)
In-Reply-To: <20201111071404.29620-4-naveenm@marvell.com>

On Tue, Nov 10, 2020 at 11:24 PM Naveen Mamindlapalli
<naveenm@marvell.com> wrote:
>
> From: Subbaraya Sundeep <sbhatta@marvell.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@marvell.com>
> Signed-off-by: Sunil Goutham <sgoutham@marvell.com>
> Signed-off-by: Naveen Mamindlapalli <naveenm@marvell.com>

A few minor spelling issues, otherwise it looks fine.

Reviewed-by: Alexander Duyck <alexanderduyck@fb.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
>

  reply	other threads:[~2020-11-12 21:24 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-11  7:13 [PATCH v3 net-next 00/13] Add ethtool ntuple filters support Naveen Mamindlapalli
2020-11-11  7:13 ` [PATCH v3 net-next 01/13] octeontx2-af: Modify default KEX profile to extract TX packet fields Naveen Mamindlapalli
2020-11-12 19:57   ` Saeed Mahameed
2020-11-14 18:59     ` [EXT] " Naveen Mamindlapalli
2020-11-12 20:02   ` Alexander Duyck
2020-11-11  7:13 ` [PATCH v3 net-next 02/13] octeontx2-af: Verify MCAM entry channel and PF_FUNC Naveen Mamindlapalli
2020-11-12 20:03   ` Alexander Duyck
2020-11-11  7:13 ` [PATCH v3 net-next 03/13] octeontx2-af: Generate key field bit mask from KEX profile Naveen Mamindlapalli
2020-11-12 21:24   ` Alexander Duyck [this message]
2020-11-11  7:13 ` [PATCH v3 net-next 04/13] octeontx2-af: Add mbox messages to install and delete MCAM rules Naveen Mamindlapalli
2020-11-12 21:46   ` Alexander Duyck
2020-11-11  7:13 ` [PATCH v3 net-next 05/13] octeontx2-pf: Add support for ethtool ntuple filters Naveen Mamindlapalli
2020-11-11  7:13 ` [PATCH v3 net-next 06/13] octeontx2-pf: Add support for unicast MAC address filtering Naveen Mamindlapalli
2020-11-11  7:13 ` [PATCH v3 net-next 07/13] octeontx2-af: Add debugfs entry to dump the MCAM rules Naveen Mamindlapalli
2020-11-12 19:48   ` Saeed Mahameed
2020-11-11  7:13 ` [PATCH v3 net-next 08/13] octeontx2-af: Modify nix_vtag_cfg mailbox to support TX VTAG entries Naveen Mamindlapalli
2020-11-11  7:14 ` [PATCH v3 net-next 09/13] octeontx2-pf: Implement ingress/egress VLAN offload Naveen Mamindlapalli
2020-11-11  7:14 ` [PATCH v3 net-next 10/13] octeontx2-pf: Add support for SR-IOV management functions Naveen Mamindlapalli
2020-11-11  7:14 ` [PATCH v3 net-next 11/13] octeontx2-af: Handle PF-VF mac address changes Naveen Mamindlapalli
2020-11-11  7:14 ` [PATCH v3 net-next 12/13] octeontx2-af: Add new mbox messages to retrieve MCAM entries Naveen Mamindlapalli
2020-11-11  7:14 ` [PATCH v3 net-next 13/13] octeontx2-af: Delete NIX_RXVLAN_ALLOC mailbox message Naveen Mamindlapalli
2020-11-12 20:16 ` [PATCH v3 net-next 00/13] Add ethtool ntuple filters support Saeed Mahameed
2020-11-14 19:00   ` [EXT] " Naveen Mamindlapalli
2020-11-14 18:54 [PATCH v3 net-next 03/13] octeontx2-af: Generate key field bit mask from KEX profile Naveen Mamindlapalli

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAKgT0Uc64qDVMm3HfXmyPoGYJezaKzEBzw76u6xXkpRqBCXGzA@mail.gmail.com \
    --to=alexander.duyck@gmail.com \
    --cc=davem@davemloft.net \
    --cc=gakula@marvell.com \
    --cc=hkelam@marvell.com \
    --cc=jerinj@marvell.com \
    --cc=kuba@kernel.org \
    --cc=lcherian@marvell.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=naveenm@marvell.com \
    --cc=netdev@vger.kernel.org \
    --cc=saeed@kernel.org \
    --cc=sbhatta@marvell.com \
    --cc=sgoutham@marvell.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).