public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Michael Chan <michael.chan@broadcom.com>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, edumazet@google.com, kuba@kernel.org,
	pabeni@redhat.com, andrew+netdev@lunn.ch,
	pavan.chebbi@broadcom.com, andrew.gospodarek@broadcom.com
Subject: [PATCH net 4/4] selftests: drv-net: rss_ctx: test RSS contexts persist after ifdown/up
Date: Wed, 28 Jan 2026 22:16:46 -0800	[thread overview]
Message-ID: <20260129061646.1417185-5-michael.chan@broadcom.com> (raw)
In-Reply-To: <20260129061646.1417185-1-michael.chan@broadcom.com>

From: Pavan Chebbi <pavan.chebbi@broadcom.com>

Add tests to verify
1. that RSS contexts persist across interface down/up
2. that RSS contexts persist across interface down/up along
with their associated Ntuple fitlers

Testing on bnxt_en:

 TAP version 13
 1..1
 # timeout set to 0
 # selftests: drivers/net/hw: rss_ctx.py
 # TAP version 13
 # 1..2
 # ok 1 rss_ctx.test_rss_context_persist_ifupdown
 # ok 2 rss_ctx.test_rss_context_ntuple_persist_ifupdown
 # # Totals: pass:2 fail:0 xfail:0 xpass:0 skip:0 error:0
 ok 1 selftests: drivers/net/hw: rss_ctx.py

Reviewed-by: Andy Gospodarek <andrew.gospodarek@broadcom.com>
Signed-off-by: Pavan Chebbi <pavan.chebbi@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
---
 .../selftests/drivers/net/hw/rss_ctx.py       | 117 +++++++++++++++++-
 1 file changed, 116 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 ed7e405682f0..4e46c5931c7f 100755
--- a/tools/testing/selftests/drivers/net/hw/rss_ctx.py
+++ b/tools/testing/selftests/drivers/net/hw/rss_ctx.py
@@ -809,6 +809,119 @@ def test_rss_default_context_rule(cfg):
                           'noise' : (0, 1) })
 
 
+def test_rss_context_persist_ifupdown(cfg):
+    """
+    Check that RSS contexts persist across an interface down/up cycle.
+    """
+
+    require_context_cnt(cfg, 10)
+
+    # Create 10 RSS contexts and store their IDs and configurations
+    ctx_ids = []
+    ctx_configs_before = {}
+    try:
+        for i in range(10):
+            ctx_id = ethtool_create(cfg, "-X", "context new")
+            ctx_ids.append(ctx_id)
+            defer(ethtool, f"-X {cfg.ifname} context {ctx_id} delete")
+    except CmdExitFailure:
+        raise KsftSkipEx(f"Could only create {len(ctx_ids)} contexts, test requires 10")
+
+    # Bring interface down
+    ip(f"link set dev {cfg.ifname} down")
+
+    # Bring interface back up
+    ip(f"link set dev {cfg.ifname} up")
+
+    # Wait for interface to be fully up
+    cfg.wait_hw_stats_settle()
+
+    # Verify all 10 contexts still exist after ifup
+    missing_contexts = []
+    persisted_contexts = []
+
+    for ctx_id in ctx_ids:
+        try:
+            data = get_rss(cfg, context=ctx_id)
+            _rss_key_check(cfg, data=data, context=ctx_id)
+            persisted_contexts.append(ctx_id)
+        except CmdExitFailure:
+            missing_contexts.append(ctx_id)
+            ksft_pr(f"Context {ctx_id} is missing after ifup")
+
+
+def test_rss_context_ntuple_persist_ifupdown(cfg):
+    """
+    Test that RSS contexts and their associated ntuple filters persist across
+    an interface down/up cycle.
+    """
+
+    require_ntuple(cfg)
+    require_context_cnt(cfg, 10)
+
+    # Create 10 RSS contexts with ntuple filters
+    ctx_ids = []
+    ntuple_ids = []
+    ports = []
+
+    try:
+        for i in range(10):
+            # Create RSS context
+            ctx_id = ethtool_create(cfg, "-X", "context new")
+            ctx_ids.append(ctx_id)
+            defer(ethtool, f"-X {cfg.ifname} context {ctx_id} delete")
+
+            # Create ntuple filter for this context
+            port = rand_port()
+            ports.append(port)
+            flow = f"flow-type tcp{cfg.addr_ipver} dst-ip {cfg.addr} dst-port {port} context {ctx_id}"
+            ntuple_id = ethtool_create(cfg, "-N", flow)
+            ntuple_ids.append(ntuple_id)
+            defer(ethtool, f"-N {cfg.ifname} delete {ntuple_id}")
+
+    except CmdExitFailure:
+        raise KsftSkipEx(f"Could only create {len(ctx_ids)} contexts with ntuple filters, test requires 10")
+
+    # Bring interface down
+    ip(f"link set dev {cfg.ifname} down")
+
+    # Bring interface back up
+    ip(f"link set dev {cfg.ifname} up")
+
+    # Wait for interface to be fully up
+    cfg.wait_hw_stats_settle()
+
+    # Verify all contexts and ntuple rules still exist after ifup
+    missing_contexts = []
+    persisted_contexts = []
+    missing_ntuple_rules = []
+    persisted_ntuple_rules = []
+    broken_associations = []
+
+    for i, ctx_id in enumerate(ctx_ids):
+        # Check if context persists
+        try:
+            data = get_rss(cfg, context=ctx_id)
+            _rss_key_check(cfg, data=data, context=ctx_id)
+            persisted_contexts.append(ctx_id)
+        except CmdExitFailure:
+            missing_contexts.append(ctx_id)
+            ksft_pr(f"Context {ctx_id} is missing after ifup")
+            continue
+
+        # Check if ntuple rule persists
+        ntuple_id = ntuple_ids[i]
+        try:
+            _ntuple_rule_check(cfg, ntuple_id, ctx_id)
+            persisted_ntuple_rules.append(ntuple_id)
+        except CmdExitFailure:
+            missing_ntuple_rules.append(ntuple_id)
+            ksft_pr(f"Ntuple rule {ntuple_id} is missing after ifup")
+        except Exception as e:
+            broken_associations.append((ntuple_id, ctx_id))
+            ksft_pr(f"Ntuple rule {ntuple_id} exists but is not properly associated with context {ctx_id}: {e}")
+
+
 def main() -> None:
     with NetDrvEpEnv(__file__, nsim_test=False) as cfg:
         cfg.context_cnt = None
@@ -823,7 +936,9 @@ def main() -> None:
                   test_rss_context_out_of_order, test_rss_context4_create_with_cfg,
                   test_flow_add_context_missing,
                   test_delete_rss_context_busy, test_rss_ntuple_addition,
-                  test_rss_default_context_rule],
+                  test_rss_default_context_rule,
+                  test_rss_context_persist_ifupdown,
+                  test_rss_context_ntuple_persist_ifupdown],
                  args=(cfg, ))
     ksft_exit()
 
-- 
2.51.0


  parent reply	other threads:[~2026-01-29  6:17 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-29  6:16 [PATCH net 0/4] bnxt_en: Fix RSS context and ntuple filter issues Michael Chan
2026-01-29  6:16 ` [PATCH net 1/4] bnxt_en: Fix RSS context delete logic Michael Chan
2026-01-29  6:16 ` [PATCH net 2/4] bnxt_en: Don't overload fw_vnic_id for RSS context's filters Michael Chan
2026-01-29  6:16 ` [PATCH net 3/4] bnxt_en: Fix deleting of Ntuple filters Michael Chan
2026-01-29  6:16 ` Michael Chan [this message]
2026-01-29 20:19   ` [PATCH net 4/4] selftests: drv-net: rss_ctx: test RSS contexts persist after ifdown/up Joe Damato
2026-01-29 23:58     ` Jakub Kicinski
2026-01-30  2:03   ` Jakub Kicinski
2026-01-30  3:52     ` Pavan Chebbi
2026-01-30  5:24     ` Pavan Chebbi
2026-01-30 16:09       ` Jakub Kicinski
2026-02-04 16:15     ` Pavan Chebbi
2026-02-05  2:09       ` Jakub Kicinski
2026-02-05  5:41         ` Pavan Chebbi

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=20260129061646.1417185-5-michael.chan@broadcom.com \
    --to=michael.chan@broadcom.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=andrew.gospodarek@broadcom.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=pavan.chebbi@broadcom.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