netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net v2 0/2] bnxt: Fix failure to report RSS context in ntuple rule
@ 2024-11-12  2:23 Daniel Xu
  2024-11-12  2:23 ` [PATCH net v2 1/2] bnxt_en: ethtool: Supply ntuple rss context action Daniel Xu
  2024-11-12  2:23 ` [PATCH net v2 2/2] selftests: drv-net: rss_ctx: Add test for ntuple rule Daniel Xu
  0 siblings, 2 replies; 8+ messages in thread
From: Daniel Xu @ 2024-11-12  2:23 UTC (permalink / raw)
  To: kalesh-anakkur.purayil, netdev, linux-kernel, michael.chan,
	pavan.chebbi, kuba, linux-kselftest, martin.lau
  Cc: kernel-team

This patchset fixes a bug where bnxt driver was failing to report that
an ntuple rule is redirecting to an RSS context. First commit is the
fix, then second commit extends selftests to detect if other/new drivers
are compliant with ntuple/rss_ctx API.

Daniel Xu (2):
  bnxt_en: ethtool: Supply ntuple rss context action
  selftests: drv-net: rss_ctx: Add test for ntuple rule

 drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c |  8 ++++++--
 tools/testing/selftests/drivers/net/hw/rss_ctx.py | 13 ++++++++++++-
 2 files changed, 18 insertions(+), 3 deletions(-)

-- 
2.46.0


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

* [PATCH net v2 1/2] bnxt_en: ethtool: Supply ntuple rss context action
  2024-11-12  2:23 [PATCH net v2 0/2] bnxt: Fix failure to report RSS context in ntuple rule Daniel Xu
@ 2024-11-12  2:23 ` Daniel Xu
  2024-11-12  2:23 ` [PATCH net v2 2/2] selftests: drv-net: rss_ctx: Add test for ntuple rule Daniel Xu
  1 sibling, 0 replies; 8+ messages in thread
From: Daniel Xu @ 2024-11-12  2:23 UTC (permalink / raw)
  To: pabeni, kalesh-anakkur.purayil, michael.chan, pavan.chebbi,
	edumazet, davem, andrew+netdev, kuba, 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.

Fixes: 2f4f9fe5bf5f ("bnxt_en: Support adding ntuple rules on RSS contexts")
Reviewed-by: Michael Chan <michael.chan@broadcom.com>
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] 8+ messages in thread

* [PATCH net v2 2/2] selftests: drv-net: rss_ctx: Add test for ntuple rule
  2024-11-12  2:23 [PATCH net v2 0/2] bnxt: Fix failure to report RSS context in ntuple rule Daniel Xu
  2024-11-12  2:23 ` [PATCH net v2 1/2] bnxt_en: ethtool: Supply ntuple rss context action Daniel Xu
@ 2024-11-12  2:23 ` Daniel Xu
  2024-11-12 11:10   ` Edward Cree
  2024-11-13  1:44   ` Jakub Kicinski
  1 sibling, 2 replies; 8+ messages in thread
From: Daniel Xu @ 2024-11-12  2:23 UTC (permalink / raw)
  To: pabeni, edumazet, davem, shuah, andrew+netdev, kuba, michael.chan,
	martin.lau, pavan.chebbi
  Cc: netdev, linux-kselftest, linux-kernel, kernel-team

Extend the rss_ctx test suite to test that an ntuple action that
redirects to an RSS context contains that information in `ethtool -n`.
Otherwise the output from ethtool is highly deceiving. This test helps
ensure drivers are compliant with the API.

Signed-off-by: Daniel Xu <dxu@dxuuu.xyz>
---
 tools/testing/selftests/drivers/net/hw/rss_ctx.py | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/drivers/net/hw/rss_ctx.py b/tools/testing/selftests/drivers/net/hw/rss_ctx.py
index 29995586993c..4fa158f37155 100755
--- a/tools/testing/selftests/drivers/net/hw/rss_ctx.py
+++ b/tools/testing/selftests/drivers/net/hw/rss_ctx.py
@@ -3,7 +3,8 @@
 
 import datetime
 import random
-from lib.py import ksft_run, ksft_pr, ksft_exit, ksft_eq, ksft_ne, ksft_ge, ksft_lt
+import re
+from lib.py import ksft_run, ksft_pr, ksft_exit, ksft_eq, ksft_ne, ksft_ge, ksft_lt, ksft_true
 from lib.py import NetDrvEpEnv
 from lib.py import EthtoolFamily, NetdevFamily
 from lib.py import KsftSkipEx, KsftFailEx
@@ -96,6 +97,14 @@ def _send_traffic_check(cfg, port, name, params):
                 f"traffic on inactive queues ({name}): " + str(cnts))
 
 
+def _ntuple_rule_check(cfg, rule_id, ctx_id):
+    """Check that ntuple rule references RSS context ID"""
+    text = ethtool(f"-n {cfg.ifname} rule {rule_id}").stdout
+    pattern = f"RSS Context ID: {ctx_id}"
+    ksft_true(re.search(pattern, text, re.IGNORECASE),
+              "RSS context not referenced in ntuple rule")
+
+
 def test_rss_key_indir(cfg):
     """Test basics like updating the main RSS key and indirection table."""
 
@@ -433,6 +442,8 @@ def test_rss_context(cfg, ctx_cnt=1, create_with_cfg=None):
         ntuple = ethtool_create(cfg, "-N", flow)
         defer(ethtool, f"-N {cfg.ifname} delete {ntuple}")
 
+        _ntuple_rule_check(cfg, ntuple, ctx_id)
+
     for i in range(ctx_cnt):
         _send_traffic_check(cfg, ports[i], f"context {i}",
                             { 'target': (2+i*2, 3+i*2),
-- 
2.46.0


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

* Re: [PATCH net v2 2/2] selftests: drv-net: rss_ctx: Add test for ntuple rule
  2024-11-12  2:23 ` [PATCH net v2 2/2] selftests: drv-net: rss_ctx: Add test for ntuple rule Daniel Xu
@ 2024-11-12 11:10   ` Edward Cree
  2024-11-13  1:51     ` Daniel Xu
  2024-11-13  1:44   ` Jakub Kicinski
  1 sibling, 1 reply; 8+ messages in thread
From: Edward Cree @ 2024-11-12 11:10 UTC (permalink / raw)
  To: Daniel Xu, pabeni, edumazet, davem, shuah, andrew+netdev, kuba,
	michael.chan, martin.lau, pavan.chebbi
  Cc: netdev, linux-kselftest, linux-kernel, kernel-team

On 12/11/2024 02:23, Daniel Xu wrote:
> Extend the rss_ctx test suite to test that an ntuple action that
> redirects to an RSS context contains that information in `ethtool -n`.
> Otherwise the output from ethtool is highly deceiving. This test helps
> ensure drivers are compliant with the API.
> 
> Signed-off-by: Daniel Xu <dxu@dxuuu.xyz>
...
> +def _ntuple_rule_check(cfg, rule_id, ctx_id):
> +    """Check that ntuple rule references RSS context ID"""
> +    text = ethtool(f"-n {cfg.ifname} rule {rule_id}").stdout
> +    pattern = f"RSS Context ID: {ctx_id}"
> +    ksft_true(re.search(pattern, text, re.IGNORECASE),

This won't match the output from your ethtool patch, because that
 removes the colon.  Probably want to wait until the patch is
 finalised and then write a regex that matches both versions.

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

* Re: [PATCH net v2 2/2] selftests: drv-net: rss_ctx: Add test for ntuple rule
  2024-11-12  2:23 ` [PATCH net v2 2/2] selftests: drv-net: rss_ctx: Add test for ntuple rule Daniel Xu
  2024-11-12 11:10   ` Edward Cree
@ 2024-11-13  1:44   ` Jakub Kicinski
  2024-11-13  1:58     ` Daniel Xu
  1 sibling, 1 reply; 8+ messages in thread
From: Jakub Kicinski @ 2024-11-13  1:44 UTC (permalink / raw)
  To: Daniel Xu
  Cc: pabeni, edumazet, davem, shuah, andrew+netdev, michael.chan,
	martin.lau, pavan.chebbi, netdev, linux-kselftest, linux-kernel,
	kernel-team

On Mon, 11 Nov 2024 19:23:31 -0700 Daniel Xu wrote:
> Extend the rss_ctx test suite to test that an ntuple action that
> redirects to an RSS context contains that information in `ethtool -n`.
> Otherwise the output from ethtool is highly deceiving. This test helps
> ensure drivers are compliant with the API.

Looks like it doesn't apply, please base the v3 on net rather than
net-next, I'll deal with the merge.

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

* Re: [PATCH net v2 2/2] selftests: drv-net: rss_ctx: Add test for ntuple rule
  2024-11-12 11:10   ` Edward Cree
@ 2024-11-13  1:51     ` Daniel Xu
  2024-11-13  1:59       ` Jakub Kicinski
  0 siblings, 1 reply; 8+ messages in thread
From: Daniel Xu @ 2024-11-13  1:51 UTC (permalink / raw)
  To: Edward Cree, Paolo Abeni, Eric Dumazet, David Miller, Shuah Khan,
	andrew+netdev, Jakub Kicinski, Michael Chan, Martin KaFai Lau,
	Pavan Chebbi
  Cc: netdev, linux-kselftest, linux-kernel, Kernel Team

Hi Ed,

On Tue, Nov 12, 2024, at 3:10 AM, Edward Cree wrote:
> On 12/11/2024 02:23, Daniel Xu wrote:
>> Extend the rss_ctx test suite to test that an ntuple action that
>> redirects to an RSS context contains that information in `ethtool -n`.
>> Otherwise the output from ethtool is highly deceiving. This test helps
>> ensure drivers are compliant with the API.
>> 
>> Signed-off-by: Daniel Xu <dxu@dxuuu.xyz>
> ...
>> +def _ntuple_rule_check(cfg, rule_id, ctx_id):
>> +    """Check that ntuple rule references RSS context ID"""
>> +    text = ethtool(f"-n {cfg.ifname} rule {rule_id}").stdout
>> +    pattern = f"RSS Context ID: {ctx_id}"
>> +    ksft_true(re.search(pattern, text, re.IGNORECASE),
>
> This won't match the output from your ethtool patch, because that
>  removes the colon.  Probably want to wait until the patch is
>  finalised and then write a regex that matches both versions.

Argh, I meant to have wildcards here. But yeah, makes sense, will wait
until the other patch is finalized.

Thanks,
Daniel 

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

* Re: [PATCH net v2 2/2] selftests: drv-net: rss_ctx: Add test for ntuple rule
  2024-11-13  1:44   ` Jakub Kicinski
@ 2024-11-13  1:58     ` Daniel Xu
  0 siblings, 0 replies; 8+ messages in thread
From: Daniel Xu @ 2024-11-13  1:58 UTC (permalink / raw)
  To: Jakub Kicinski
  Cc: Paolo Abeni, Eric Dumazet, David Miller, Shuah Khan,
	andrew+netdev, Michael Chan, Martin KaFai Lau, Pavan Chebbi,
	netdev, linux-kselftest, linux-kernel, Kernel Team

Hi Jakub,

On Tue, Nov 12, 2024, at 5:44 PM, Jakub Kicinski wrote:
> On Mon, 11 Nov 2024 19:23:31 -0700 Daniel Xu wrote:
>> Extend the rss_ctx test suite to test that an ntuple action that
>> redirects to an RSS context contains that information in `ethtool -n`.
>> Otherwise the output from ethtool is highly deceiving. This test helps
>> ensure drivers are compliant with the API.
>
> Looks like it doesn't apply, please base the v3 on net rather than
> net-next, I'll deal with the merge.

Sorry about that. Will think on how to make my workflow not involve
manually retyping patches between different machines...

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

* Re: [PATCH net v2 2/2] selftests: drv-net: rss_ctx: Add test for ntuple rule
  2024-11-13  1:51     ` Daniel Xu
@ 2024-11-13  1:59       ` Jakub Kicinski
  0 siblings, 0 replies; 8+ messages in thread
From: Jakub Kicinski @ 2024-11-13  1:59 UTC (permalink / raw)
  To: Daniel Xu
  Cc: Edward Cree, Paolo Abeni, Eric Dumazet, David Miller, Shuah Khan,
	andrew+netdev, Michael Chan, Martin KaFai Lau, Pavan Chebbi,
	netdev, linux-kselftest, linux-kernel, Kernel Team

On Tue, 12 Nov 2024 17:51:50 -0800 Daniel Xu wrote:
> > This won't match the output from your ethtool patch, because that
> >  removes the colon.  Probably want to wait until the patch is
> >  finalised and then write a regex that matches both versions.  
> 
> Argh, I meant to have wildcards here. But yeah, makes sense, will wait
> until the other patch is finalized.

Keep in mind Michal scans ethtool patches once every week or two,
so there may be a bit of a delay there.

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

end of thread, other threads:[~2024-11-13  1:59 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-12  2:23 [PATCH net v2 0/2] bnxt: Fix failure to report RSS context in ntuple rule Daniel Xu
2024-11-12  2:23 ` [PATCH net v2 1/2] bnxt_en: ethtool: Supply ntuple rss context action Daniel Xu
2024-11-12  2:23 ` [PATCH net v2 2/2] selftests: drv-net: rss_ctx: Add test for ntuple rule Daniel Xu
2024-11-12 11:10   ` Edward Cree
2024-11-13  1:51     ` Daniel Xu
2024-11-13  1:59       ` Jakub Kicinski
2024-11-13  1:44   ` Jakub Kicinski
2024-11-13  1:58     ` Daniel Xu

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