linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 net-next 00/13] Add ethtool ntuple filters support
@ 2020-11-11  7:13 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
                   ` (13 more replies)
  0 siblings, 14 replies; 24+ messages in thread
From: Naveen Mamindlapalli @ 2020-11-11  7:13 UTC (permalink / raw)
  To: netdev, linux-kernel
  Cc: kuba, davem, saeed, sgoutham, lcherian, gakula, jerinj, sbhatta, hkelam

This patch series adds support for ethtool ntuple filters, unicast
address filtering, VLAN offload and SR-IOV ndo handlers. All of the
above features are based on the Admin Function(AF) driver support to
install and delete the low level MCAM entries. Each MCAM entry is
programmed with the packet fields to match and what actions to take
if the match succeeds. The PF driver requests AF driver to allocate
set of MCAM entries to be used to install the flows by that PF. The
entries will be freed when the PF driver is unloaded.

* The patches 1 to 4 adds AF driver infrastructure to install and
  delete the low level MCAM flow entries.
* Patch 5 adds ethtool ntuple filter support.
* Patch 6 adds unicast MAC address filtering.
* Patch 7 adds support for dumping the MCAM entries via debugfs.
* Patches 8 to 10 adds support for VLAN offload.
* Patch 10 to 11 adds support for SR-IOV ndo handlers.
* Patch 12 adds support to read the MCAM entries.

Misc:
* Removed redundant mailbox NIX_RXVLAN_ALLOC.

Change-log:
v3:
- Fixed Saeed's review comments on v2.
	- Fixed modifying the netdev->flags from driver.
	- Fixed modifying the netdev features and hw_features after register_netdev.
	- Removed unwanted ndo_features_check callback.
v2:
- Fixed the sparse issues reported by Jakub.

Hariprasad Kelam (3):
  octeontx2-pf: Add support for unicast MAC address filtering
  octeontx2-pf: Implement ingress/egress VLAN offload
  octeontx2-af: Handle PF-VF mac address changes

Naveen Mamindlapalli (2):
  octeontx2-pf: Add support for SR-IOV management functions
  octeontx2-af: Add new mbox messages to retrieve MCAM entries

Stanislaw Kardach (1):
  octeontx2-af: Modify default KEX profile to extract TX packet fields

Subbaraya Sundeep (6):
  octeontx2-af: Verify MCAM entry channel and PF_FUNC
  octeontx2-af: Generate key field bit mask from KEX profile
  octeontx2-af: Add mbox messages to install and delete MCAM rules
  octeontx2-pf: Add support for ethtool ntuple filters
  octeontx2-af: Add debugfs entry to dump the MCAM rules
  octeontx2-af: Delete NIX_RXVLAN_ALLOC mailbox message

Vamsi Attunuru (1):
  octeontx2-af: Modify nix_vtag_cfg mailbox to support TX VTAG entries

 drivers/net/ethernet/marvell/octeontx2/af/Makefile |    2 +-
 drivers/net/ethernet/marvell/octeontx2/af/common.h |    2 +
 drivers/net/ethernet/marvell/octeontx2/af/mbox.h   |  170 ++-
 drivers/net/ethernet/marvell/octeontx2/af/npc.h    |  106 +-
 .../ethernet/marvell/octeontx2/af/npc_profile.h    |   71 +-
 drivers/net/ethernet/marvell/octeontx2/af/rvu.c    |   16 +-
 drivers/net/ethernet/marvell/octeontx2/af/rvu.h    |   71 +-
 .../ethernet/marvell/octeontx2/af/rvu_debugfs.c    |  197 +++
 .../net/ethernet/marvell/octeontx2/af/rvu_nix.c    |  305 ++++-
 .../net/ethernet/marvell/octeontx2/af/rvu_npc.c    |  462 ++++++-
 .../net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c | 1334 ++++++++++++++++++++
 .../net/ethernet/marvell/octeontx2/af/rvu_struct.h |   11 +
 .../net/ethernet/marvell/octeontx2/nic/Makefile    |    2 +-
 .../ethernet/marvell/octeontx2/nic/otx2_common.c   |    8 +-
 .../ethernet/marvell/octeontx2/nic/otx2_common.h   |   59 +
 .../ethernet/marvell/octeontx2/nic/otx2_ethtool.c  |   58 +-
 .../ethernet/marvell/octeontx2/nic/otx2_flows.c    |  820 ++++++++++++
 .../net/ethernet/marvell/octeontx2/nic/otx2_pf.c   |  307 ++++-
 .../net/ethernet/marvell/octeontx2/nic/otx2_txrx.c |   16 +
 .../net/ethernet/marvell/octeontx2/nic/otx2_vf.c   |    5 +
 20 files changed, 3862 insertions(+), 160 deletions(-)
 create mode 100644 drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c
 create mode 100644 drivers/net/ethernet/marvell/octeontx2/nic/otx2_flows.c

-- 
2.16.5


^ permalink raw reply	[flat|nested] 24+ messages in thread
* Re: [PATCH v3 net-next 02/13] octeontx2-af: Verify MCAM entry channel and PF_FUNC
@ 2020-11-14 18:39 Naveen Mamindlapalli
  0 siblings, 0 replies; 24+ messages in thread
From: Naveen Mamindlapalli @ 2020-11-14 18:39 UTC (permalink / raw)
  To: Alexander Duyck
  Cc: Netdev, LKML, Jakub Kicinski, David Miller, saeed,
	Sunil Kovvuri Goutham, Linu Cherian, Geethasowjanya Akula,
	Jerin Jacob Kollanukkaran, Subbaraya Sundeep Bhatta,
	Hariprasad Kelam

Hi Alexander,

> -----Original Message-----
> From: Alexander Duyck <alexander.duyck@gmail.com>
> Sent: Friday, November 13, 2020 1:33 AM
> 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; Sunil Kovvuri Goutham <sgoutham@marvell.com>; Linu
> Cherian <lcherian@marvell.com>; Geethasowjanya Akula
> <gakula@marvell.com>; Jerin Jacob Kollanukkaran <jerinj@marvell.com>;
> Subbaraya Sundeep Bhatta <sbhatta@marvell.com>; Hariprasad Kelam
> <hkelam@marvell.com>
> Subject: Re: [PATCH v3 net-next 02/13] octeontx2-af: Verify MCAM entry
> channel and PF_FUNC
> 
> On Tue, Nov 10, 2020 at 11:18 PM Naveen Mamindlapalli
> <naveenm@marvell.com> wrote:
> >
> > From: Subbaraya Sundeep <sbhatta@marvell.com>
> >
> > This patch adds support to verify the channel number sent by mailbox
> > requester before writing MCAM entry for Ingress packets.
> > Similarly for Egress packets, verifying the PF_FUNC sent by the
> > mailbox user.
> >
> > Signed-off-by: Subbaraya Sundeep <sbhatta@marvell.com>
> > Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
> > Signed-off-by: Sunil Goutham <sgoutham@marvell.com>
> > Signed-off-by: Naveen Mamindlapalli <naveenm@marvell.com>
> 
> One minor nit below. Otherwise looks good to me.
> 
> Reviewed-by: Alexander Duyck <alexanderduyck@fb.com>
> 
> > ---
> >  drivers/net/ethernet/marvell/octeontx2/af/rvu.c    |  4 +-
> >  drivers/net/ethernet/marvell/octeontx2/af/rvu.h    |  2 +
> >  .../net/ethernet/marvell/octeontx2/af/rvu_npc.c    | 78
> ++++++++++++++++++++++
> >  3 files changed, 82 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu.c
> > b/drivers/net/ethernet/marvell/octeontx2/af/rvu.c
> > index a28a518c0eae..e8b5aaf73201 100644
> > --- a/drivers/net/ethernet/marvell/octeontx2/af/rvu.c
> > +++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu.c
> > @@ -2642,7 +2642,7 @@ static void rvu_enable_afvf_intr(struct rvu
> > *rvu)
> >
> >  #define PCI_DEVID_OCTEONTX2_LBK 0xA061
> >
> > -static int lbk_get_num_chans(void)
> > +int rvu_get_num_lbk_chans(void)
> >  {
> >         struct pci_dev *pdev;
> >         void __iomem *base;
> > @@ -2677,7 +2677,7 @@ static int rvu_enable_sriov(struct rvu *rvu)
> >                 return 0;
> >         }
> >
> > -       chans = lbk_get_num_chans();
> > +       chans = rvu_get_num_lbk_chans();
> >         if (chans < 0)
> >                 return chans;
> >
> > diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu.h
> > b/drivers/net/ethernet/marvell/octeontx2/af/rvu.h
> > index 5ac9bb12415f..1724dbd18847 100644
> > --- a/drivers/net/ethernet/marvell/octeontx2/af/rvu.h
> > +++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu.h
> > @@ -445,6 +445,7 @@ int rvu_get_lf(struct rvu *rvu, struct rvu_block
> > *block, u16 pcifunc, u16 slot);  int rvu_lf_reset(struct rvu *rvu,
> > struct rvu_block *block, int lf);  int rvu_get_blkaddr(struct rvu
> > *rvu, int blktype, u16 pcifunc);  int rvu_poll_reg(struct rvu *rvu,
> > u64 block, u64 offset, u64 mask, bool zero);
> > +int rvu_get_num_lbk_chans(void);
> >
> >  /* RVU HW reg validation */
> >  enum regmap_block {
> > @@ -535,6 +536,7 @@ bool is_npc_intf_tx(u8 intf);  bool
> > is_npc_intf_rx(u8 intf);  bool is_npc_interface_valid(struct rvu *rvu,
> > u8 intf);  int rvu_npc_get_tx_nibble_cfg(struct rvu *rvu, u64
> > nibble_ena);
> > +int npc_mcam_verify_channel(struct rvu *rvu, u16 pcifunc, u8 intf,
> > +u16 channel);
> >
> >  #ifdef CONFIG_DEBUG_FS
> >  void rvu_dbg_init(struct rvu *rvu);
> > diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c
> > b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c
> > index 989533a3d2ce..3666159bb6b6 100644
> > --- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c
> > +++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc.c
> > @@ -28,6 +28,8 @@
> >
> >  #define NPC_PARSE_RESULT_DMAC_OFFSET   8
> >  #define NPC_HW_TSTAMP_OFFSET           8
> > +#define NPC_KEX_CHAN_MASK              0xFFFULL
> > +#define NPC_KEX_PF_FUNC_MASK           0xFFFFULL
> >
> >  static const char def_pfl_name[] = "default";
> >
> > @@ -63,6 +65,54 @@ int rvu_npc_get_tx_nibble_cfg(struct rvu *rvu, u64
> nibble_ena)
> >         return 0;
> >  }
> >
> > +static int npc_mcam_verify_pf_func(struct rvu *rvu,
> > +                                  struct mcam_entry *entry_data, u8 intf,
> > +                                  u16 pcifunc) {
> > +       u16 pf_func, pf_func_mask;
> > +
> > +       if (is_npc_intf_rx(intf))
> > +               return 0;
> > +
> > +       pf_func_mask = (entry_data->kw_mask[0] >> 32) &
> > +               NPC_KEX_PF_FUNC_MASK;
> > +       pf_func = (entry_data->kw[0] >> 32) & NPC_KEX_PF_FUNC_MASK;
> > +
> > +       pf_func = be16_to_cpu((__force __be16)pf_func);
> > +       if (pf_func_mask != NPC_KEX_PF_FUNC_MASK ||
> > +           ((pf_func & ~RVU_PFVF_FUNC_MASK) !=
> > +            (pcifunc & ~RVU_PFVF_FUNC_MASK)))
> > +               return -EINVAL;
> > +
> > +       return 0;
> > +}
> > +
> > +int npc_mcam_verify_channel(struct rvu *rvu, u16 pcifunc, u8 intf,
> > +u16 channel) {
> > +       int pf = rvu_get_pf(pcifunc);
> > +       u8 cgx_id, lmac_id;
> > +       int base = 0, end;
> > +
> > +       if (is_npc_intf_tx(intf))
> > +               return 0;
> > +
> > +       if (is_afvf(pcifunc)) {
> > +               end = rvu_get_num_lbk_chans();
> > +               if (end < 0)
> > +                       return -EINVAL;
> > +       } else {
> > +               rvu_get_cgx_lmac_id(rvu->pf2cgxlmac_map[pf], &cgx_id,
> &lmac_id);
> > +               base = NIX_CHAN_CGX_LMAC_CHX(cgx_id, lmac_id, 0x0);
> > +               /* CGX mapped functions has maximum of 16 channels */
> > +               end = NIX_CHAN_CGX_LMAC_CHX(cgx_id, lmac_id, 0xF);
> > +       }
> > +
> > +       if (channel < base || channel > end)
> > +               return -EINVAL;
> > +
> > +       return 0;
> > +}
> > +
> >  void rvu_npc_set_pkind(struct rvu *rvu, int pkind, struct rvu_pfvf
> > *pfvf)  {
> >         int blkaddr;
> > @@ -1935,6 +1985,7 @@ int
> rvu_mbox_handler_npc_mcam_write_entry(struct rvu *rvu,
> >         struct rvu_pfvf *pfvf = rvu_get_pfvf(rvu, req->hdr.pcifunc);
> >         struct npc_mcam *mcam = &rvu->hw->mcam;
> >         u16 pcifunc = req->hdr.pcifunc;
> > +       u16 channel, chan_mask;
> >         int blkaddr, rc;
> >         u8 nix_intf;
> >
> > @@ -1942,6 +1993,10 @@ int
> rvu_mbox_handler_npc_mcam_write_entry(struct rvu *rvu,
> >         if (blkaddr < 0)
> >                 return NPC_MCAM_INVALID_REQ;
> >
> > +       chan_mask = req->entry_data.kw_mask[0] & NPC_KEX_CHAN_MASK;
> > +       channel = req->entry_data.kw[0] & NPC_KEX_CHAN_MASK;
> > +       channel &= chan_mask;
> > +
> >         mutex_lock(&mcam->lock);
> >         rc = npc_mcam_verify_entry(mcam, pcifunc, req->entry);
> >         if (rc)
> > @@ -1963,6 +2018,17 @@ int
> rvu_mbox_handler_npc_mcam_write_entry(struct rvu *rvu,
> >         else
> >                 nix_intf = pfvf->nix_rx_intf;
> >
> > +       if (npc_mcam_verify_channel(rvu, pcifunc, req->intf, channel)) {
> > +               rc = NPC_MCAM_INVALID_REQ;
> > +               goto exit;
> > +       }
> > +
> > +       if (npc_mcam_verify_pf_func(rvu, &req->entry_data, req->intf,
> > +                                   pcifunc)) {
> > +               rc = NPC_MCAM_INVALID_REQ;
> > +               goto exit;
> > +       }
> > +
> >         npc_config_mcam_entry(rvu, mcam, blkaddr, req->entry, nix_intf,
> >                               &req->entry_data, req->enable_entry);
> >
> > @@ -2299,6 +2365,7 @@ int
> rvu_mbox_handler_npc_mcam_alloc_and_write_entry(struct rvu *rvu,
> >         struct npc_mcam *mcam = &rvu->hw->mcam;
> >         u16 entry = NPC_MCAM_ENTRY_INVALID;
> >         u16 cntr = NPC_MCAM_ENTRY_INVALID;
> > +       u16 channel, chan_mask;
> >         int blkaddr, rc;
> >         u8 nix_intf;
> >
> > @@ -2309,6 +2376,17 @@ int
> rvu_mbox_handler_npc_mcam_alloc_and_write_entry(struct rvu *rvu,
> >         if (!is_npc_interface_valid(rvu, req->intf))
> >                 return NPC_MCAM_INVALID_REQ;
> >
> > +       chan_mask = req->entry_data.kw_mask[0] & NPC_KEX_CHAN_MASK;
> > +       channel = req->entry_data.kw[0] & NPC_KEX_CHAN_MASK;
> > +       channel &= chan_mask;
> > +
> > +       if (npc_mcam_verify_channel(rvu, req->hdr.pcifunc, req->intf, channel))
> > +               return NPC_MCAM_INVALID_REQ;
> > +
> 
> Why not just move the code for pulling the channel into the
> npc_mcam_verify_channel function like you did with the pf_func? Then you can
> avoid declaring variables here that won't be used anywhere else in the function.

The npc_mcam_verify_channel is called by other functions that can't pass the raw MCAM entry data. See patch 04.

> 
> 
> > +       if (npc_mcam_verify_pf_func(rvu, &req->entry_data, req->intf,
> > +                                   req->hdr.pcifunc))
> > +               return NPC_MCAM_INVALID_REQ;
> > +
> >         /* Try to allocate a MCAM entry */
> >         entry_req.hdr.pcifunc = req->hdr.pcifunc;
> >         entry_req.contig = true;
> > --
> > 2.16.5
> >

^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2020-11-14 19:00 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
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:39 [PATCH v3 net-next 02/13] octeontx2-af: Verify MCAM entry channel and PF_FUNC Naveen Mamindlapalli

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).