[Devel] [PATCH hci-8.1 v2 3/3] selftests: drv-net: read the channel count over netlink
Eva Kurchatova
eva.kurchatova at virtuozzo.com
Mon Sep 28 22:37:17 MSK 2026
napi_threaded.py asks ethtool for the channel count as JSON, which
ethtool 6.11 cannot print for -l:
ethtool: bad command line argument(s)
JSON output not available for this subcommand
not ok 1 napi_threaded.napi_init
Read the count over ethtool netlink instead, so the test does not
depend on the ethtool version installed.
https://virtuozzo.atlassian.net/browse/VSTOR-139651
Feature: fix selftests
Signed-off-by: Eva Kurchatova <eva.kurchatova at virtuozzo.com>
---
tools/testing/selftests/drivers/net/napi_threaded.py | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/tools/testing/selftests/drivers/net/napi_threaded.py b/tools/testing/selftests/drivers/net/napi_threaded.py
index ed66efa481b0..33cc3f8752d3 100755
--- a/tools/testing/selftests/drivers/net/napi_threaded.py
+++ b/tools/testing/selftests/drivers/net/napi_threaded.py
@@ -7,7 +7,7 @@ Test napi threaded states.
from lib.py import ksft_run, ksft_exit
from lib.py import ksft_eq, ksft_ne, ksft_ge
-from lib.py import NetDrvEnv, NetdevFamily
+from lib.py import EthtoolFamily, NetDrvEnv, NetdevFamily
from lib.py import cmd, defer, ethtool
@@ -28,7 +28,9 @@ def _set_threaded_state(cfg, threaded) -> None:
def _setup_deferred_cleanup(cfg) -> None:
- combined = ethtool(f"-l {cfg.ifname}", json=True)[0].get("combined", 0)
+ # Not every ethtool prints -l as JSON, ask the kernel
+ chan = EthtoolFamily().channels_get({'header': {'dev-index': cfg.ifindex}})
+ combined = chan.get('combined-count', 0)
ksft_ge(combined, 2)
defer(ethtool, f"-L {cfg.ifname} combined {combined}")
--
2.55.0
More information about the Devel
mailing list