Linux Kernel Selftest development
 help / color / mirror / Atom feed
From: <edward.cree@amd.com>
To: <davem@davemloft.net>, <kuba@kernel.org>, <edumazet@google.com>,
	<pabeni@redhat.com>
Cc: Edward Cree <ecree.xilinx@gmail.com>, <netdev@vger.kernel.org>,
	<horms@kernel.org>, <andrew+netdev@lunn.ch>, <shuah@kernel.org>,
	<linux-kselftest@vger.kernel.org>
Subject: [PATCH net-next 5/5] selftest: extend test_rss_context_queue_reconfigure for action addition
Date: Wed, 13 Nov 2024 12:13:13 +0000	[thread overview]
Message-ID: <58276b800ab78c0a79c1918046ccae7fe45ba802.1731499022.git.ecree.xilinx@gmail.com> (raw)
In-Reply-To: <cover.1731499021.git.ecree.xilinx@gmail.com>

From: Edward Cree <ecree.xilinx@gmail.com>

The combination of ntuple action (ring_cookie) and RSS context can
 cause an ntuple rule to target a higher queue than appears in any
 RSS indirection table or directly in the ntuple rule, since the two
 numbers are added together.  Verify the logic that prevents reducing
 the queue count in this case.

Signed-off-by: Edward Cree <ecree.xilinx@gmail.com>
---
I'm not able to run this selftest myself, because sfc doesn't support
ethtool set-channels (-L).  If someone else can verify that it works
on their hardware that would be much appreciated.

 .../selftests/drivers/net/hw/rss_ctx.py       | 26 +++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/tools/testing/selftests/drivers/net/hw/rss_ctx.py b/tools/testing/selftests/drivers/net/hw/rss_ctx.py
index 8f62dc29bd26..0b49ce7ae678 100755
--- a/tools/testing/selftests/drivers/net/hw/rss_ctx.py
+++ b/tools/testing/selftests/drivers/net/hw/rss_ctx.py
@@ -238,6 +238,32 @@ def test_rss_queue_reconfigure(cfg, main_ctx=True):
     else:
         raise Exception(f"Driver didn't prevent us from deactivating a used queue (context {ctx_id})")
 
+    if not main_ctx:
+        ethtool(f"-L {cfg.ifname} combined 4")
+        flow = f"flow-type tcp{cfg.addr_ipver} dst-ip {cfg.addr} dst-port {port} context {ctx_id} action 1"
+        try:
+            # this targets queue 4, which doesn't exist
+            ntuple2 = ethtool_create(cfg, "-N", flow)
+        except CmdExitFailure:
+            pass
+        else:
+            raise Exception(f"Driver didn't prevent us from targeting a nonexistent queue (context {ctx_id})")
+        # change the table to target queues 0 and 2
+        ethtool(f"-X {cfg.ifname} {ctx_ref} weight 1 0 1 0")
+        # ntuple rule therefore targets queues 1 and 3
+        ntuple2 = ethtool_create(cfg, "-N", flow)
+        # should replace existing filter
+        ksft_eq(ntuple, ntuple2)
+        _send_traffic_check(cfg, port, ctx_ref, { 'target': (1, 3),
+                                                  'noise' : (0, 2) })
+        # Setting queue count to 3 should fail, queue 3 is used
+        try:
+            ethtool(f"-L {cfg.ifname} combined 3")
+        except CmdExitFailure:
+            pass
+        else:
+            raise Exception(f"Driver didn't prevent us from deactivating a used queue (context {ctx_id})")
+
 
 def test_rss_resize(cfg):
     """Test resizing of the RSS table.

  parent reply	other threads:[~2024-11-13 12:15 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-13 12:13 [PATCH net-next 0/5] net: make RSS+RXNFC semantics more explicit edward.cree
2024-11-13 12:13 ` [PATCH net-next 1/5] net: ethtool: only allow set_rxnfc with rss + ring_cookie if driver opts in edward.cree
2024-11-14  9:21   ` Martin Habets
2024-11-25  7:11   ` Gal Pressman
2024-11-25 13:21     ` Edward Cree
2024-11-25 14:10       ` Gal Pressman
2024-11-25 14:20         ` Ahmed Zaki
2024-11-25 14:26           ` Gal Pressman
2024-11-25 14:42           ` Edward Cree
2024-11-25 19:01             ` Ahmed Zaki
2024-12-02 15:19               ` Ahmed Zaki
2024-11-25 18:13         ` Edward Cree
2024-11-13 12:13 ` [PATCH net-next 2/5] net: ethtool: account for RSS+RXNFC add semantics when checking channel count edward.cree
2024-11-13 12:13 ` [PATCH net-next 3/5] selftest: include dst-ip in ethtool ntuple rules edward.cree
2024-11-14  9:54   ` Martin Habets
2024-11-13 12:13 ` [PATCH net-next 4/5] selftest: validate RSS+ntuple filters with nonzero ring_cookie edward.cree
2024-11-13 12:13 ` edward.cree [this message]
2024-11-15  4:40 ` [PATCH net-next 0/5] net: make RSS+RXNFC semantics more explicit patchwork-bot+netdevbpf

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=58276b800ab78c0a79c1918046ccae7fe45ba802.1731499022.git.ecree.xilinx@gmail.com \
    --to=edward.cree@amd.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=ecree.xilinx@gmail.com \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=shuah@kernel.org \
    /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