* [PATCH net 0/2] selftests: drv-net: ring_reconfig: handle devices without channel config
@ 2026-11-06 15:05 Bilal Yazıcıoğlu
2026-11-06 15:05 ` [PATCH net 1/2] " Bilal Yazıcıoğlu
2026-11-06 15:05 ` [PATCH net 2/2] selftests: drv-net: ring_reconfig: skip tx stall test " Bilal Yazıcıoğlu
0 siblings, 2 replies; 5+ messages in thread
From: Bilal Yazıcıoğlu @ 2026-11-06 15:05 UTC (permalink / raw)
To: netdev
Cc: andrew+netdev, davem, edumazet, kuba, pabeni, shuah, hmohsin,
linux-kselftest, linux-kernel, Bilal Yazıcıoğlu
ring_reconfig.py assumes that a device which supports ring parameters
also supports the ethtool channel query. Drivers without a
get_channels op, such as e1000e, return -EOPNOTSUPP for it, and the
resulting NlError makes all three tests fail.
On a ThinkPad T480 with an I219-V (e1000e) "ethtool -g" works while
"ethtool -l" returns "Operation not supported", and running the test
functions through the in-tree YNL library against the device shows
the three failures.
Patch 1 skips channels() and lets ringparam() continue without the
optional channel reduction, patch 2 skips reconfig_tx_stall(). Only
EOPNOTSUPP is handled; any other error still fails. The patches are
split because the affected code came from two different commits.
Testing: there is no remote endpoint for the T480, so the full test
was not run. The test functions were run against the real device
under ksft_run with a stub environment and all ethtool set requests
blocked: before the series all three fail, after it two are skipped
and the channel helper returns after the query. They were also run
against an emulated ethtool family (unsupported channels, other
errors, devices with combined or separate rx/tx channels, failing
channel set and restore) to check that other errors still fail and
that behaviour with channel support is unchanged. pylint and ruff
report nothing new. Not tested: the full test with NETIF and a remote
endpoint, and the rest of ringparam() on e1000e (see the note in
patch 1 about ring size clamping).
I found this while looking for kernel tests I could validate on my
ThinkPad T480. I investigated and validated the issue on that
hardware, defined the scope of the fix, reviewed and refined the
implementation, and extended the regression tests used to validate
it.
This work was AI-assisted: OpenAI Codex helped with the initial
source analysis, and Claude Code drafted the implementation,
changelogs and test tooling. I take responsibility for the submitted
changes.
Bilal Yazıcıoğlu (2):
selftests: drv-net: ring_reconfig: handle devices without channel
config
selftests: drv-net: ring_reconfig: skip tx stall test without channel
config
.../selftests/drivers/net/ring_reconfig.py | 24 ++++++++++++++++---
1 file changed, 21 insertions(+), 3 deletions(-)
base-commit: 19a227903e65c7a9c179156485660a4e017575fe
--
2.56.0
^ permalink raw reply [flat|nested] 5+ messages in thread* [PATCH net 1/2] selftests: drv-net: ring_reconfig: handle devices without channel config 2026-11-06 15:05 [PATCH net 0/2] selftests: drv-net: ring_reconfig: handle devices without channel config Bilal Yazıcıoğlu @ 2026-11-06 15:05 ` Bilal Yazıcıoğlu 2026-11-10 15:27 ` netdev-bot+sashiko 2026-11-06 15:05 ` [PATCH net 2/2] selftests: drv-net: ring_reconfig: skip tx stall test " Bilal Yazıcıoğlu 1 sibling, 1 reply; 5+ messages in thread From: Bilal Yazıcıoğlu @ 2026-11-06 15:05 UTC (permalink / raw) To: netdev Cc: andrew+netdev, davem, edumazet, kuba, pabeni, shuah, hmohsin, linux-kselftest, linux-kernel, Bilal Yazıcıoğlu Drivers which don't implement the ethtool get_channels op (e.g. e1000e) make ETHTOOL_MSG_CHANNELS_GET fail with -EOPNOTSUPP. YNL raises that as an NlError, so ring_reconfig reports two failures on such devices: - channels() fails on its first channels_get call, although there is nothing to test; - ringparam() fails in _configure_min_ring_cnt() before any ring size is tested. The helper only reduces the channel count to speed up the reconfiguration, ringparam() does not depend on it. Skip channels() and return early from _configure_min_ring_cnt() when the channel query is not supported, logging that the channel count was left unchanged. Other netlink errors are still reported as failures. The issue was found through AI-assisted source code analysis (OpenAI Codex) and confirmed on a ThinkPad T480 with an Intel I219-V (e1000e, 8086:15d8): "ethtool -l" fails with "Operation not supported" while "ethtool -g" works, and running the test functions with the in-tree YNL library against the device fails with NlError 95 (EOPNOTSUPP). No remote endpoint was available, so the full test was not run. On the same machine the test functions were run under ksft_run with a stub environment and all ethtool set requests blocked: channels() is now skipped and _configure_min_ring_cnt() returns after the channel query. Behaviour on devices which support channels was only checked against an emulated ethtool family. Fixes: ecca75ae5ae6 ("selftests: drv-net: replace the nsim ring test with a drv-net one") Signed-off-by: Bilal Yazıcıoğlu <ahmetbilalyazicioglu@gmail.com> --- Notes: Note, not part of this fix: with this patch ringparam() gets past _configure_min_ring_cnt() on e1000e and reaches the ring size loop. e1000e clamps ring sizes below 64 instead of rejecting them, so the check that the requested minimum was applied is expected to fail on that driver. I could not run that part (it needs a remote endpoint), and whether the test or the driver should change is a separate question. .../selftests/drivers/net/ring_reconfig.py | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/drivers/net/ring_reconfig.py b/tools/testing/selftests/drivers/net/ring_reconfig.py index 6682d4badfb..baac20e8d3e 100755 --- a/tools/testing/selftests/drivers/net/ring_reconfig.py +++ b/tools/testing/selftests/drivers/net/ring_reconfig.py @@ -5,6 +5,7 @@ Test channel and ring size configuration via ethtool (-L / -G). """ +import errno import socket import struct import time @@ -26,6 +27,16 @@ MIN_TX_RING = 32 MAX_TX_RING = 1024 +def _channels_get_or_skip(cfg, ehdr): + """ Get the channel config, skip the test if the device has none. """ + try: + return cfg.eth.channels_get(ehdr) + except NlError as e: + if e.error == errno.EOPNOTSUPP: + raise KsftSkipEx("device does not support channel config") from e + raise + + def channels(cfg) -> None: """ Twiddle channel counts in various combinations of parameters. @@ -33,7 +44,7 @@ def channels(cfg) -> None: if the config is accepted and crashes. """ ehdr = {'header':{'dev-index': cfg.ifindex}} - chans = cfg.eth.channels_get(ehdr) + chans = _channels_get_or_skip(cfg, ehdr) all_keys = ["rx", "tx", "combined"] mixes = [{"combined"}, {"rx", "tx"}, {"rx", "combined"}, {"tx", "combined"}, @@ -88,7 +99,14 @@ def channels(cfg) -> None: def _configure_min_ring_cnt(cfg) -> None: """ Try to configure a single Rx/Tx ring. """ ehdr = {'header':{'dev-index': cfg.ifindex}} - chans = cfg.eth.channels_get(ehdr) + try: + chans = cfg.eth.channels_get(ehdr) + except NlError as e: + # Reducing the channel count is only an optimization + if e.error == errno.EOPNOTSUPP: + ksft_pr("Channel configuration unsupported; continuing ring test") + return + raise all_keys = ["rx-count", "tx-count", "combined-count"] restore = {} -- 2.56.0 ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net 1/2] selftests: drv-net: ring_reconfig: handle devices without channel config 2026-11-06 15:05 ` [PATCH net 1/2] " Bilal Yazıcıoğlu @ 2026-11-10 15:27 ` netdev-bot+sashiko 2026-11-10 16:12 ` Bilal Yazıcıoğlu 0 siblings, 1 reply; 5+ messages in thread From: netdev-bot+sashiko @ 2026-11-10 15:27 UTC (permalink / raw) To: ahmetbilalyazicioglu Cc: netdev, andrew+netdev, davem, edumazet, kuba, pabeni, shuah, hmohsin, linux-kselftest, linux-kernel Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider. Critical: 0 · High: 0 · Medium: 1 · Low: 0 If you believe none of the issues are legitimate, please reply to each issue of Medium severity or higher and explain why the AI is wrong. If any of them are legitimate and you plan to respin, please let patchwork know by including "pw-bot: cr" as a separate line at the end of your reply (one such reply per series is enough). - [Medium] _configure_min_ring_cnt() in tools/testing/selftests/drivers/net/ring_reconfig.py now catches… -- selftests: drv-net: ring_reconfig: handle devices without channel config This patch handles drivers that don't implement get_channels (e.g. e1000e) in ring_reconfig.py. When channels_get returns EOPNOTSUPP, channels() is now skipped and _configure_min_ring_cnt() returns early. Other netlink errors are still reported as failures. > diff --git a/tools/testing/selftests/drivers/net/ring_reconfig.py b/tools/testing/selftests/drivers/net/ring_reconfig.py > index 6682d4badfbfc..baac20e8d3eba 100755 > --- a/tools/testing/selftests/drivers/net/ring_reconfig.py > +++ b/tools/testing/selftests/drivers/net/ring_reconfig.py [ ... ] > @@ -88,7 +99,14 @@ def channels(cfg) -> None: > def _configure_min_ring_cnt(cfg) -> None: > """ Try to configure a single Rx/Tx ring. """ > ehdr = {'header':{'dev-index': cfg.ifindex}} > - chans = cfg.eth.channels_get(ehdr) > + try: > + chans = cfg.eth.channels_get(ehdr) > + except NlError as e: > + # Reducing the channel count is only an optimization > + if e.error == errno.EOPNOTSUPP: > + ksft_pr("Channel configuration unsupported; continuing ring test") > + return > + raise [Severity: Medium] This catches EOPNOTSUPP from channels_get, but what about drivers that implement get_channels but not set_channels? Further down in _configure_min_ring_cnt() the set call is still unguarded: if chans.get('combined-count', 0) > 1: config['combined-count'] = 1 elif chans.get('rx-count', 0) > 1 and chans.get('tx-count', 0) > 1: ... cfg.eth.channels_set(ehdr | config) defer(cfg.eth.channels_set, ehdr | restore) On the kernel side, CHANNELS_SET is rejected unless both ops are present: net/ethtool/channels.c:ethnl_set_channels_validate() { ... return ops->get_channels && ops->set_channels ? 1 : -EOPNOTSUPP; } vmxnet3 is one in-tree example. Its ethtool ops set only .get_channels = vmxnet3_get_channels, and in MSI-X buddy-share mode vmxnet3_get_channels() reports combined_count = num_tx_queues, which can be greater than 1. On such a device channels_get succeeds, so the new early return never runs. channels_set then raises NlError(95), which propagates out of _configure_min_ring_cnt() and ringparam(). That means ringparam() fails before any ring size is tested, which is the symptom the commit message says this patch fixes. The comment here says reducing the channel count is only an optimization. Wouldn't that reasoning also apply to a failed channels_set? Could the channels_set call get the same handling, i.e. log with ksft_pr() and return on EOPNOTSUPP before registering the defer? The later patch in this series ("selftests: drv-net: ring_reconfig: skip tx stall test without channel config") only changes reconfig_tx_stall(), so this case still fails after the full series is applied. > > all_keys = ["rx-count", "tx-count", "combined-count"] > restore = {} -- Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261106150509.30458-1-ahmetbilalyazicioglu%40gmail.com ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH net 1/2] selftests: drv-net: ring_reconfig: handle devices without channel config 2026-11-10 15:27 ` netdev-bot+sashiko @ 2026-11-10 16:12 ` Bilal Yazıcıoğlu 0 siblings, 0 replies; 5+ messages in thread From: Bilal Yazıcıoğlu @ 2026-11-10 16:12 UTC (permalink / raw) To: netdev-bot+sashiko Cc: netdev, Andrew Lunn, David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni, Shuah Khan, Mohsin Bashir, linux-kselftest, linux-kernel On Tue, 10 Nov 2026, netdev-bot+sashiko@kernel.org wrote: > This catches EOPNOTSUPP from channels_get, but what about drivers that > implement get_channels but not set_channels? [...] > Could the channels_set call get the same handling, i.e. log with > ksft_pr() and return on EOPNOTSUPP before registering the defer? Good catch, that's a real gap. ethnl_set_channels_validate() rejects the change with -EOPNOTSUPP when there is no set_channels, and a few drivers only implement get_channels (vmxnet3, r8169, enic, octeon_ep and others), so ringparam() still fails on them. The upcoming v2 handles it the way you suggest. Looking at the same drivers, channels() also fails there (its restore gets -EOPNOTSUPP), and so does reconfig_tx_stall() when a driver reports spare combined channels, so v2 skips those cases too. Other errors still fail. I don't have any of those NICs, so that part is only tested against an emulated ethtool family. pw-bot: cr ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH net 2/2] selftests: drv-net: ring_reconfig: skip tx stall test without channel config 2026-11-06 15:05 [PATCH net 0/2] selftests: drv-net: ring_reconfig: handle devices without channel config Bilal Yazıcıoğlu 2026-11-06 15:05 ` [PATCH net 1/2] " Bilal Yazıcıoğlu @ 2026-11-06 15:05 ` Bilal Yazıcıoğlu 1 sibling, 0 replies; 5+ messages in thread From: Bilal Yazıcıoğlu @ 2026-11-06 15:05 UTC (permalink / raw) To: netdev Cc: andrew+netdev, davem, edumazet, kuba, pabeni, shuah, hmohsin, linux-kselftest, linux-kernel, Bilal Yazıcıoğlu reconfig_tx_stall() needs at least two combined channels and already skips devices which don't report enough of them. On devices whose driver doesn't implement the ethtool get_channels op (e.g. e1000e) the initial channels_get call fails with -EOPNOTSUPP instead, which YNL raises as an NlError, so the test is reported as a failure. Use the _channels_get_or_skip() helper to skip the test in that case as well. Other netlink errors are still reported as failures. The issue was found through AI-assisted source code analysis (OpenAI Codex) and confirmed on a ThinkPad T480 with an Intel I219-V (e1000e, 8086:15d8). As for the previous patch, the test function was run against that device with a stub environment and ethtool set requests blocked, and is now skipped. Fixes: c98610c2eb70 ("selftests: drv-net: Test queue stall upon reconfig") Signed-off-by: Bilal Yazıcıoğlu <ahmetbilalyazicioglu@gmail.com> --- tools/testing/selftests/drivers/net/ring_reconfig.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/drivers/net/ring_reconfig.py b/tools/testing/selftests/drivers/net/ring_reconfig.py index baac20e8d3e..dd6ff6b2b64 100755 --- a/tools/testing/selftests/drivers/net/ring_reconfig.py +++ b/tools/testing/selftests/drivers/net/ring_reconfig.py @@ -319,7 +319,7 @@ def reconfig_tx_stall(cfg) -> None: other_queue = 0 ehdr = {'header': {'dev-index': cfg.ifindex}} - chans = cfg.eth.channels_get(ehdr) + chans = _channels_get_or_skip(cfg, ehdr) if "combined-max" not in chans: raise KsftSkipEx("device does not support combined channels") -- 2.56.0 ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-11-10 16:12 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2026-11-06 15:05 [PATCH net 0/2] selftests: drv-net: ring_reconfig: handle devices without channel config Bilal Yazıcıoğlu 2026-11-06 15:05 ` [PATCH net 1/2] " Bilal Yazıcıoğlu 2026-11-10 15:27 ` netdev-bot+sashiko 2026-11-10 16:12 ` Bilal Yazıcıoğlu 2026-11-06 15:05 ` [PATCH net 2/2] selftests: drv-net: ring_reconfig: skip tx stall test " Bilal Yazıcıoğlu
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®