From: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
To: khorenko@virtuozzo.com
Cc: devel@openvz.org
Subject: [Devel] [PATCH vz10 3/3] selftests: drv-net: read the channel count over netlink
Date: Tue, 1 Sep 2026 02:43:49 +0300 [thread overview]
Message-ID: <20260831234411.1649762-3-eva.kurchatova@virtuozzo.com> (raw)
In-Reply-To: <20260831234411.1649762-1-eva.kurchatova@virtuozzo.com>
napi_threaded needs the number of combined channels of the device and
asks ethtool to print it as JSON. Not every ethtool prints that one:
ethtool 6.11 does it for -k, -a, -c, -g and -x, but not for -l, and
the test ends in the first case:
CmdExitFailure: Command failed: ethtool --json -l eth4
STDERR: b'ethtool: bad command line argument(s)
JSON output not available for this subcommand
not ok 1 napi_threaded.napi_init
Ask the kernel for the count over netlink, which is where ethtool reads
it too, so the test no longer depends on the ethtool version installed.
Changing the count stays with ethtool -L, which needs no JSON. No other
test in the group asks ethtool for something it cannot print, so this is
the only one that needs it.
https://virtuozzo.atlassian.net/browse/VSTOR-139651
Feature: fix selftests
Signed-off-by: Eva Kurchatova <eva.kurchatova@virtuozzo.com>
---
tools/testing/selftests/drivers/net/napi_threaded.py | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/tools/testing/selftests/drivers/net/napi_threaded.py b/tools/testing/selftests/drivers/net/napi_threaded.py
index 20f1a12552da..6662aee3442b 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,13 @@ 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 the channel counts as JSON, the one on
+ # the test machine here does not:
+ # ethtool: bad command line argument(s)
+ # JSON output not available for this subcommand
+ # Ask the kernel for them instead, it is the same number.
+ 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
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel
prev parent reply other threads:[~2026-08-31 23:45 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-31 23:43 [Devel] [PATCH vz10 1/3] selftests: drv-net: let NetDrvEnv take nsim_test Eva Kurchatova
2026-08-31 23:43 ` [Devel] [PATCH vz10 2/3] selftests: drv-net: run ping in its own netns Eva Kurchatova
2026-08-31 23:43 ` Eva Kurchatova [this message]
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=20260831234411.1649762-3-eva.kurchatova@virtuozzo.com \
--to=eva.kurchatova@virtuozzo.com \
--cc=devel@openvz.org \
--cc=khorenko@virtuozzo.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.