From: Ovidiu Panait <ovidiu.panait.rb@renesas.com>
To: andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com,
kuba@kernel.org, pabeni@redhat.com, shuah@kernel.org,
nb@tipi-net.de
Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
linux-kselftest@vger.kernel.org,
Ovidiu Panait <ovidiu.panait.rb@renesas.com>
Subject: [PATCH net-next v2 2/3] selftests: drv-net: Check the features set by set_ethtool_feat()
Date: Fri, 18 Sep 2026 11:25:28 +0000 [thread overview]
Message-ID: <20260918112529.96039-3-ovidiu.panait.rb@renesas.com> (raw)
In-Reply-To: <20260918112529.96039-1-ovidiu.panait.rb@renesas.com>
Read back the features after running ethtool -K to check if they were
actually applied. The drivers might refuse to set a feature silently and
the test could run with a different configuration than the requested one.
Add a 'check' parameter to skip this, as the GRO "hw" mode handles the
case where HW GRO is cleared by the driver.
Signed-off-by: Ovidiu Panait <ovidiu.panait.rb@renesas.com>
---
v2: New patch.
tools/testing/selftests/drivers/net/gro_lib.py | 3 ++-
tools/testing/selftests/drivers/net/lib/py/feat.py | 10 +++++++++-
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/tools/testing/selftests/drivers/net/gro_lib.py b/tools/testing/selftests/drivers/net/gro_lib.py
index 7856ebdd49d3..875a715b2ae1 100644
--- a/tools/testing/selftests/drivers/net/gro_lib.py
+++ b/tools/testing/selftests/drivers/net/gro_lib.py
@@ -263,7 +263,8 @@ def _setup(cfg, mode, test_name):
set_ethtool_feat(cfg.ifname, cfg.feat,
{"generic-receive-offload": False,
"rx-gro-hw": True,
- "large-receive-offload": False})
+ "large-receive-offload": False},
+ check=False)
# Some NICs treat HW GRO as a GRO sub-feature so disabling GRO
# will also clear HW GRO. Use a hack of installing XDP generic
diff --git a/tools/testing/selftests/drivers/net/lib/py/feat.py b/tools/testing/selftests/drivers/net/lib/py/feat.py
index b94a24214e59..f0630844f023 100644
--- a/tools/testing/selftests/drivers/net/lib/py/feat.py
+++ b/tools/testing/selftests/drivers/net/lib/py/feat.py
@@ -9,7 +9,7 @@ Provides common operations for changing device features via ethtool.
from . import KsftXfailEx, defer, ethtool, ksft_pr
-def set_ethtool_feat(dev, current, feats, host=None):
+def set_ethtool_feat(dev, current, feats, host=None, check=True):
"""Set ethtool features with defer to restore original state."""
s2n = {True: "on", False: "off"}
@@ -33,3 +33,11 @@ def set_ethtool_feat(dev, current, feats, host=None):
# If ethtool printed something kernel must have modified some features
if eth_cmd.stdout:
ksft_pr(eth_cmd)
+
+ if not check:
+ return
+
+ current = ethtool(f"-k {dev}", json=True, host=host)[0]
+ for name, state in feats.items():
+ if current[name]["active"] != state:
+ raise KsftXfailEx(f"{name} was not set to {s2n[state]}")
--
2.34.1
next prev parent reply other threads:[~2026-09-18 11:26 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-18 11:25 [PATCH net-next v2 0/3] selftests: drv-net: Add VLAN test Ovidiu Panait
2026-09-18 11:25 ` [PATCH net-next v2 1/3] selftests: drv-net: Move _set_ethtool_feat() into lib Ovidiu Panait
2026-09-18 11:25 ` Ovidiu Panait [this message]
2026-09-18 11:51 ` [PATCH net-next v2 2/3] selftests: drv-net: Check the features set by set_ethtool_feat() Nicolai Buchwitz
2026-09-22 12:01 ` netdev-bot+sashiko
2026-09-18 11:25 ` [PATCH net-next v2 3/3] selftests: drv-net: Add VLAN test Ovidiu Panait
2026-09-18 12:04 ` Nicolai Buchwitz
2026-09-18 22:12 ` Jakub Kicinski
2026-09-19 21:43 ` Nicolai Buchwitz
2026-09-22 12:01 ` netdev-bot+sashiko
2026-09-24 15:30 ` [PATCH net-next v2 0/3] " 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=20260918112529.96039-3-ovidiu.panait.rb@renesas.com \
--to=ovidiu.panait.rb@renesas.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=nb@tipi-net.de \
--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