netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] bnxt_en: ethtool: Supply ntuple rss context action
@ 2024-11-08 19:07 Daniel Xu
  2024-11-09  0:49 ` Michael Chan
  2024-11-09 17:25 ` Jakub Kicinski
  0 siblings, 2 replies; 5+ messages in thread
From: Daniel Xu @ 2024-11-08 19:07 UTC (permalink / raw)
  To: michael.chan, kuba, edumazet, davem, andrew+netdev, pabeni,
	martin.lau
  Cc: netdev, linux-kernel, kernel-team

Commit 2f4f9fe5bf5f ("bnxt_en: Support adding ntuple rules on RSS
contexts") added support for redirecting to an RSS context as an ntuple
rule action. However, it forgot to update the ETHTOOL_GRXCLSRULE
codepath. This caused `ethtool -n` to always report the action as
"Action: Direct to queue 0" which is wrong.

Fix by teaching bnxt driver to report the RSS context when applicable.

Signed-off-by: Daniel Xu <dxu@dxuuu.xyz>
---
 drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
index cfd2c65b1c90..a218802befa8 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
@@ -1187,10 +1187,14 @@ static int bnxt_grxclsrule(struct bnxt *bp, struct ethtool_rxnfc *cmd)
 		}
 	}
 
-	if (fltr->base.flags & BNXT_ACT_DROP)
+	if (fltr->base.flags & BNXT_ACT_DROP) {
 		fs->ring_cookie = RX_CLS_FLOW_DISC;
-	else
+	} else if (fltr->base.flags & BNXT_ACT_RSS_CTX) {
+		fs->flow_type |= FLOW_RSS;
+		cmd->rss_context = fltr->base.fw_vnic_id;
+	} else {
 		fs->ring_cookie = fltr->base.rxq;
+	}
 	rc = 0;
 
 fltr_err:
-- 
2.46.0


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

* Re: [PATCH net-next] bnxt_en: ethtool: Supply ntuple rss context action
  2024-11-08 19:07 [PATCH net-next] bnxt_en: ethtool: Supply ntuple rss context action Daniel Xu
@ 2024-11-09  0:49 ` Michael Chan
  2024-11-09  3:10   ` Pavan Chebbi
  2024-11-09 17:25 ` Jakub Kicinski
  1 sibling, 1 reply; 5+ messages in thread
From: Michael Chan @ 2024-11-09  0:49 UTC (permalink / raw)
  To: Daniel Xu, Pavan Chebbi
  Cc: kuba, edumazet, davem, andrew+netdev, pabeni, martin.lau, netdev,
	linux-kernel, kernel-team

[-- Attachment #1: Type: text/plain, Size: 1646 bytes --]

On Fri, Nov 8, 2024 at 11:07 AM Daniel Xu <dxu@dxuuu.xyz> wrote:
>
> Commit 2f4f9fe5bf5f ("bnxt_en: Support adding ntuple rules on RSS
> contexts") added support for redirecting to an RSS context as an ntuple
> rule action. However, it forgot to update the ETHTOOL_GRXCLSRULE
> codepath. This caused `ethtool -n` to always report the action as
> "Action: Direct to queue 0" which is wrong.
>
> Fix by teaching bnxt driver to report the RSS context when applicable.
>
> Signed-off-by: Daniel Xu <dxu@dxuuu.xyz>
> ---
>  drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
> index cfd2c65b1c90..a218802befa8 100644
> --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
> +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
> @@ -1187,10 +1187,14 @@ static int bnxt_grxclsrule(struct bnxt *bp, struct ethtool_rxnfc *cmd)
>                 }
>         }
>
> -       if (fltr->base.flags & BNXT_ACT_DROP)
> +       if (fltr->base.flags & BNXT_ACT_DROP) {
>                 fs->ring_cookie = RX_CLS_FLOW_DISC;
> -       else
> +       } else if (fltr->base.flags & BNXT_ACT_RSS_CTX) {
> +               fs->flow_type |= FLOW_RSS;
> +               cmd->rss_context = fltr->base.fw_vnic_id;

I think the rss_context should be the index and not the VNIC ID.

Pavan, please take a look.

> +       } else {
>                 fs->ring_cookie = fltr->base.rxq;
> +       }
>         rc = 0;
>
>  fltr_err:
> --
> 2.46.0
>

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4209 bytes --]

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

* Re: [PATCH net-next] bnxt_en: ethtool: Supply ntuple rss context action
  2024-11-09  0:49 ` Michael Chan
@ 2024-11-09  3:10   ` Pavan Chebbi
  2024-11-09  4:21     ` Michael Chan
  0 siblings, 1 reply; 5+ messages in thread
From: Pavan Chebbi @ 2024-11-09  3:10 UTC (permalink / raw)
  To: Michael Chan
  Cc: Daniel Xu, kuba, edumazet, davem, andrew+netdev, pabeni,
	martin.lau, netdev, linux-kernel, kernel-team

[-- Attachment #1: Type: text/plain, Size: 1937 bytes --]

On Sat, Nov 9, 2024 at 6:19 AM Michael Chan <michael.chan@broadcom.com> wrote:
>
> On Fri, Nov 8, 2024 at 11:07 AM Daniel Xu <dxu@dxuuu.xyz> wrote:
> >
> > Commit 2f4f9fe5bf5f ("bnxt_en: Support adding ntuple rules on RSS
> > contexts") added support for redirecting to an RSS context as an ntuple
> > rule action. However, it forgot to update the ETHTOOL_GRXCLSRULE
> > codepath. This caused `ethtool -n` to always report the action as
> > "Action: Direct to queue 0" which is wrong.
> >
> > Fix by teaching bnxt driver to report the RSS context when applicable.
> >
> > Signed-off-by: Daniel Xu <dxu@dxuuu.xyz>
> > ---
> >  drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 8 ++++++--
> >  1 file changed, 6 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
> > index cfd2c65b1c90..a218802befa8 100644
> > --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
> > +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
> > @@ -1187,10 +1187,14 @@ static int bnxt_grxclsrule(struct bnxt *bp, struct ethtool_rxnfc *cmd)
> >                 }
> >         }
> >
> > -       if (fltr->base.flags & BNXT_ACT_DROP)
> > +       if (fltr->base.flags & BNXT_ACT_DROP) {
> >                 fs->ring_cookie = RX_CLS_FLOW_DISC;
> > -       else
> > +       } else if (fltr->base.flags & BNXT_ACT_RSS_CTX) {
> > +               fs->flow_type |= FLOW_RSS;
> > +               cmd->rss_context = fltr->base.fw_vnic_id;
>
> I think the rss_context should be the index and not the VNIC ID.

No, for RSS contexts, we save their index in the fw_vnic_id of the
filters. Hence what Daniel has done is correct.

>
> Pavan, please take a look.
>
> > +       } else {
> >                 fs->ring_cookie = fltr->base.rxq;
> > +       }
> >         rc = 0;
> >
> >  fltr_err:
> > --
> > 2.46.0
> >

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4209 bytes --]

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

* Re: [PATCH net-next] bnxt_en: ethtool: Supply ntuple rss context action
  2024-11-09  3:10   ` Pavan Chebbi
@ 2024-11-09  4:21     ` Michael Chan
  0 siblings, 0 replies; 5+ messages in thread
From: Michael Chan @ 2024-11-09  4:21 UTC (permalink / raw)
  To: Pavan Chebbi
  Cc: Daniel Xu, kuba, edumazet, davem, andrew+netdev, pabeni,
	martin.lau, netdev, linux-kernel, kernel-team

[-- Attachment #1: Type: text/plain, Size: 2033 bytes --]

On Fri, Nov 8, 2024 at 7:10 PM Pavan Chebbi <pavan.chebbi@broadcom.com> wrote:
>
> On Sat, Nov 9, 2024 at 6:19 AM Michael Chan <michael.chan@broadcom.com> wrote:
> >
> > On Fri, Nov 8, 2024 at 11:07 AM Daniel Xu <dxu@dxuuu.xyz> wrote:
> > >
> > > Commit 2f4f9fe5bf5f ("bnxt_en: Support adding ntuple rules on RSS
> > > contexts") added support for redirecting to an RSS context as an ntuple
> > > rule action. However, it forgot to update the ETHTOOL_GRXCLSRULE
> > > codepath. This caused `ethtool -n` to always report the action as
> > > "Action: Direct to queue 0" which is wrong.
> > >
> > > Fix by teaching bnxt driver to report the RSS context when applicable.
> > >
> > > Signed-off-by: Daniel Xu <dxu@dxuuu.xyz>
> > > ---
> > >  drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 8 ++++++--
> > >  1 file changed, 6 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
> > > index cfd2c65b1c90..a218802befa8 100644
> > > --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
> > > +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c
> > > @@ -1187,10 +1187,14 @@ static int bnxt_grxclsrule(struct bnxt *bp, struct ethtool_rxnfc *cmd)
> > >                 }
> > >         }
> > >
> > > -       if (fltr->base.flags & BNXT_ACT_DROP)
> > > +       if (fltr->base.flags & BNXT_ACT_DROP) {
> > >                 fs->ring_cookie = RX_CLS_FLOW_DISC;
> > > -       else
> > > +       } else if (fltr->base.flags & BNXT_ACT_RSS_CTX) {
> > > +               fs->flow_type |= FLOW_RSS;
> > > +               cmd->rss_context = fltr->base.fw_vnic_id;
> >
> > I think the rss_context should be the index and not the VNIC ID.
>
> No, for RSS contexts, we save their index in the fw_vnic_id of the
> filters. Hence what Daniel has done is correct.
>

I see now.   The index is stored in the fltr->base.fw_vnic_id.  Thanks.

Reviewed-by: Michael Chan <michael.chan@broadcom.com>

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4209 bytes --]

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

* Re: [PATCH net-next] bnxt_en: ethtool: Supply ntuple rss context action
  2024-11-08 19:07 [PATCH net-next] bnxt_en: ethtool: Supply ntuple rss context action Daniel Xu
  2024-11-09  0:49 ` Michael Chan
@ 2024-11-09 17:25 ` Jakub Kicinski
  1 sibling, 0 replies; 5+ messages in thread
From: Jakub Kicinski @ 2024-11-09 17:25 UTC (permalink / raw)
  To: Daniel Xu
  Cc: michael.chan, edumazet, davem, andrew+netdev, pabeni, martin.lau,
	netdev, linux-kernel, kernel-team

On Fri,  8 Nov 2024 12:07:29 -0700 Daniel Xu wrote:
> Commit 2f4f9fe5bf5f ("bnxt_en: Support adding ntuple rules on RSS
> contexts") added support for redirecting to an RSS context as an ntuple
> rule action. However, it forgot to update the ETHTOOL_GRXCLSRULE
> codepath. This caused `ethtool -n` to always report the action as
> "Action: Direct to queue 0" which is wrong.
> 
> Fix by teaching bnxt driver to report the RSS context when applicable.

Ah, so it was a driver bug after all.

Please add a fixes tag here, add a test case for this in
tools/testing/selftests/drivers/net/hw/rss_ctx.py
as a second patch of the series.
-- 
pw-bot: cr

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

end of thread, other threads:[~2024-11-09 17:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-08 19:07 [PATCH net-next] bnxt_en: ethtool: Supply ntuple rss context action Daniel Xu
2024-11-09  0:49 ` Michael Chan
2024-11-09  3:10   ` Pavan Chebbi
2024-11-09  4:21     ` Michael Chan
2024-11-09 17:25 ` Jakub Kicinski

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