mbox series

[net-next,0/6] Add ingress ratelimit offload

Message ID 1623756871-12524-1-git-send-email-sbhatta@marvell.com
Headers show
Series Add ingress ratelimit offload | expand

Message

Subbaraya Sundeep June 15, 2021, 11:34 a.m. UTC
This patchset adds ingress rate limiting hardware
offload support for CN10K silicons. Police actions
are added for TC matchall and flower filters.
CN10K has ingress rate limiting feature where
a receive queue is mapped to bandwidth profile
and the profile is configured with rate and burst
parameters by software. CN10K hardware supports
three levels of ingress policing or ratelimiting.
Multiple leaf profiles can  point to a single mid
level profile and multiple mid level profile can
point to a single top level one. Only leaf level
profiles are used for configuring rate limiting.

Patch 1 adds the new bandwidth profile contexts
in AF driver similar to other hardware contexts
Patch 2 adds the debugfs changes to dump bandwidth
profile contexts
Patch 3 adds support for police action with TC matchall filter
Patch 4 uses NL_SET_ERR_MSG_MOD for tc code
Patch 5 adds support for police action with TC flower filter


Subbaraya Sundeep (2):
  octeontx2-pf: Use NL_SET_ERR_MSG_MOD for TC
  octeontx2-pf: Add police action for TC flower

Sunil Goutham (3):
  octeontx2-af: cn10k: Bandwidth profiles config support
  octeontx2-af: cn10k: Debugfs support for bandwidth profiles
  octeontx2-pf: TC_MATCHALL ingress ratelimiting offload

 drivers/net/ethernet/marvell/octeontx2/af/mbox.h   |  40 +-
 drivers/net/ethernet/marvell/octeontx2/af/rvu.c    |   8 +
 drivers/net/ethernet/marvell/octeontx2/af/rvu.h    |  16 +
 .../ethernet/marvell/octeontx2/af/rvu_debugfs.c    | 163 ++++++
 .../net/ethernet/marvell/octeontx2/af/rvu_nix.c    | 619 ++++++++++++++++++++-
 .../net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c |   5 +
 .../net/ethernet/marvell/octeontx2/af/rvu_reg.h    |   8 +
 .../net/ethernet/marvell/octeontx2/af/rvu_struct.h |  85 ++-
 drivers/net/ethernet/marvell/octeontx2/nic/cn10k.c | 323 +++++++++++
 drivers/net/ethernet/marvell/octeontx2/nic/cn10k.h |  11 +
 .../ethernet/marvell/octeontx2/nic/otx2_common.h   |   3 +
 .../ethernet/marvell/octeontx2/nic/otx2_ethtool.c  |   6 +
 .../net/ethernet/marvell/octeontx2/nic/otx2_pf.c   |   3 +
 .../net/ethernet/marvell/octeontx2/nic/otx2_tc.c   | 299 ++++++++--
 14 files changed, 1554 insertions(+), 35 deletions(-)

Comments

Kees Cook June 18, 2021, 4:07 p.m. UTC | #1
On Tue, Jun 15, 2021 at 05:04:27PM +0530, Subbaraya Sundeep wrote:
> [...]

> @@ -885,6 +906,9 @@ static int rvu_nix_blk_aq_enq_inst(struct rvu *rvu, struct nix_hw *nix_hw,

>  			else if (req->ctype == NIX_AQ_CTYPE_MCE)

>  				memcpy(&rsp->mce, ctx,

>  				       sizeof(struct nix_rx_mce_s));

> +			else if (req->ctype == NIX_AQ_CTYPE_BANDPROF)

> +				memcpy(&rsp->prof, ctx,

> +				       sizeof(struct nix_bandprof_s));


rsp->prof is u64 not struct nix_bandprof_s, so the compiler thinks this
memcpy() is overflowing the "prof" field.

Can you please fix this up?

-- 
Kees Cook
Subbaraya Sundeep June 21, 2021, 10:19 a.m. UTC | #2
Hi Kees Cook,

Thanks. I will send the fix to net.

Sundeep

________________________________________
From: Kees Cook <keescook@chromium.org>

Sent: Friday, June 18, 2021 9:37 PM
To: Subbaraya Sundeep Bhatta
Cc: netdev@vger.kernel.org; davem@davemloft.net; kuba@kernel.org; Sunil Kovvuri Goutham; Hariprasad Kelam; Geethasowjanya Akula
Subject: [EXT] Re: [net-next PATCH 1/5] octeontx2-af: cn10k: Bandwidth profiles config support

External Email

----------------------------------------------------------------------
On Tue, Jun 15, 2021 at 05:04:27PM +0530, Subbaraya Sundeep wrote:
> [...]

> @@ -885,6 +906,9 @@ static int rvu_nix_blk_aq_enq_inst(struct rvu *rvu, struct nix_hw *nix_hw,

>                       else if (req->ctype == NIX_AQ_CTYPE_MCE)

>                               memcpy(&rsp->mce, ctx,

>                                      sizeof(struct nix_rx_mce_s));

> +                     else if (req->ctype == NIX_AQ_CTYPE_BANDPROF)

> +                             memcpy(&rsp->prof, ctx,

> +                                    sizeof(struct nix_bandprof_s));


rsp->prof is u64 not struct nix_bandprof_s, so the compiler thinks this
memcpy() is overflowing the "prof" field.

Can you please fix this up?

--
Kees Cook