Skip to contentSkip to conversation

selftests: drv-net: test the napi init state

PATCH Applied Jakub Kicinski 3 participants 3 messages Aug 15, 2025 – Aug 19, 2025

Subsystems (3)
lore
Share & tools
lore

Jakub Kicinski

author maintainer
#0 lore raw

PATCH 1/1 selftests: drv-net: test the napi init state

Test that threaded state (in the persistent NAPI config) gets updated even when NAPI with given ID is not allocated at the time.

This test is validating commit ccba9f6baa90 ("net: update NAPI threaded config even for disabled NAPIs").

---
Somehow I missed sending this out with the fix series.

---
 .../selftests/drivers/net/napi_threaded.py    | 31 ++++++++++++++++++-
 1 file changed, 30 insertions(+), 1 deletion(-)
tools/testing/selftests/drivers/net/napi_threaded.py +30 -1
index 9699a100a87d..ed66efa481b0 100755
@@ -38,6 +38,34 @@ from lib.py import cmd, defer, ethtool
     return combined
 
 
+def napi_init(cfg, nl) -> None:
+    """
+    Test that threaded state (in the persistent NAPI config) gets updated
+    even when NAPI with given ID is not allocated at the time.
+    """
+
+    qcnt = _setup_deferred_cleanup(cfg)
+
+    _set_threaded_state(cfg, 1)
+    cmd(f"ethtool -L {cfg.ifname} combined 1")
+    _set_threaded_state(cfg, 0)
+    cmd(f"ethtool -L {cfg.ifname} combined {qcnt}")
+
+    napis = nl.napi_get({'ifindex': cfg.ifindex}, dump=True)
+    for napi in napis:
+        ksft_eq(napi['threaded'], 'disabled')
+        ksft_eq(napi.get('pid'), None)
+
+    cmd(f"ethtool -L {cfg.ifname} combined 1")
+    _set_threaded_state(cfg, 1)
+    cmd(f"ethtool -L {cfg.ifname} combined {qcnt}")
+
+    napis = nl.napi_get({'ifindex': cfg.ifindex}, dump=True)
+    for napi in napis:
+        ksft_eq(napi['threaded'], 'enabled')
+        ksft_ne(napi.get('pid'), None)
+
+
 def enable_dev_threaded_disable_napi_threaded(cfg, nl) -> None:
     """
     Test that when napi threaded is enabled at device level and
@@ -103,7 +131,8 @@ from lib.py import cmd, defer, ethtool
     """ Ksft boiler plate main """
 
     with NetDrvEnv(__file__, queue_count=2) as cfg:
-        ksft_run([change_num_queues,
+        ksft_run([napi_init,
+                  change_num_queues,
                   enable_dev_threaded_disable_napi_threaded],
                  args=(cfg, NetdevFamily()))
     ksft_exit()
Signature · 1 line
2.50.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 10 lines · Jakub Kicinski

Test that threaded state (in the persistent NAPI config) gets updated even when NAPI with given ID is not allocated at the time.

This test is validating commit ccba9f6baa90 ("net: update NAPI threaded config even for disabled NAPIs").

---
Somehow I missed sending this out with the fix series.

Quoted 7 lines
---
 .../selftests/drivers/net/napi_threaded.py    | 31 ++++++++++++++++++-
 1 file changed, 30 insertions(+), 1 deletion(-)
#2 lore raw
In reply to Jakub Kicinski
This patch was applied to netdev/net-next.git (main) by Paolo Abeni <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by Paolo Abeni <[email protected]>:

Quoted 9 lines · On Thu, 14 Aug 2025 18:33:14 -0700 you wrote:

Test that threaded state (in the persistent NAPI config) gets updated even when NAPI with given ID is not allocated at the time.

This test is validating commit ccba9f6baa90 ("net: update NAPI threaded config even for disabled NAPIs").

[...]

Here is the summary with links:
- [net-next] selftests: drv-net: test the napi init state

    https://git.kernel.org/netdev/net-next/c/0283b8f134e4

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html