Netdev List
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, edumazet@google.com, pabeni@redhat.com,
	andrew+netdev@lunn.ch, horms@kernel.org,
	michael.chan@broadcom.com, manishc@marvell.com,
	joshwash@google.com, hramamurthy@google.com, tariqt@nvidia.com,
	saeedm@nvidia.com, daniel@iogearbox.net, hawk@kernel.org,
	sdf@fomichev.me, willemb@google.com,
	przemyslaw.kitszel@intel.com, bpf@vger.kernel.org,
	Jakub Kicinski <kuba@kernel.org>
Subject: [PATCH net-next v2 2/9] selftests: drv-net: gro_stats: use the shared set_ethtool_feat()
Date: Sat, 21 Nov 2026 17:01:05 -0800	[thread overview]
Message-ID: <20261122010112.1471146-3-kuba@kernel.org> (raw)
In-Reply-To: <20261122010112.1471146-1-kuba@kernel.org>

gro_stats.py carries its own copy of set_ethtool_feat(), which never
reads the features back. The only check whether HW GRO really ended up
enabled is the one guarding the generic XDP workaround, which is about
to go away. Use the shared helper, so that the test can ask for that
check like gro_lib.py does.

A fixed feature now results in an XFAIL rather than a SKIP, same as
in gro_lib.py.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
v2: new patch
---
 .../selftests/drivers/net/hw/gro_stats.py     | 45 +++++--------------
 1 file changed, 10 insertions(+), 35 deletions(-)

diff --git a/tools/testing/selftests/drivers/net/hw/gro_stats.py b/tools/testing/selftests/drivers/net/hw/gro_stats.py
index 70e76e3888bd..a413e6fed210 100755
--- a/tools/testing/selftests/drivers/net/hw/gro_stats.py
+++ b/tools/testing/selftests/drivers/net/hw/gro_stats.py
@@ -13,7 +13,7 @@ from lib.py import ksft_run, ksft_exit, ksft_pr
 from lib.py import ksft_eq, ksft_ge, ksft_variants
 from lib.py import NetDrvEpEnv, NetdevFamily
 from lib.py import KsftSkipEx
-from lib.py import bkg, cmd, defer, ethtool, ip
+from lib.py import bkg, cmd, defer, ethtool, ip, set_ethtool_feat
 
 
 # gro.c uses hardcoded DPORT=8000
@@ -137,41 +137,16 @@ def _run_gro_test(cfg, test_name, num_flows=None, ignore_fail=False,
             raise KsftSkipEx(f"Driver does not report '{stat}' via qstats")
 
 
-def _set_ethtool_feat(cfg, current, feats):
-    """Set ethtool features with defer to restore original state."""
-    s2n = {True: "on", False: "off"}
-
-    new = ["-K", cfg.ifname]
-    old = ["-K", cfg.ifname]
-    no_change = True
-    for name, state in feats.items():
-        new += [name, s2n[state]]
-        old += [name, s2n[current[name]["active"]]]
-
-        if current[name]["active"] != state:
-            no_change = False
-            if current[name]["fixed"]:
-                raise KsftSkipEx(f"Device does not support {name}")
-    if no_change:
-        return
-
-    eth_cmd = ethtool(" ".join(new))
-    defer(ethtool, " ".join(old))
-
-    # If ethtool printed something kernel must have modified some features
-    if eth_cmd.stdout:
-        ksft_pr(eth_cmd)
-
-
 def _setup_hw_gro(cfg):
     """Enable HW GRO on the device, disabling SW GRO."""
     feat = ethtool(f"-k {cfg.ifname}", json=True)[0]
 
     # Try to disable SW GRO and enable HW GRO
-    _set_ethtool_feat(cfg, feat,
-                      {"generic-receive-offload": False,
-                       "rx-gro-hw": True,
-                       "large-receive-offload": False})
+    set_ethtool_feat(cfg.ifname, feat,
+                     {"generic-receive-offload": False,
+                      "rx-gro-hw": True,
+                      "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
@@ -186,10 +161,10 @@ def _run_gro_test(cfg, test_name, num_flows=None, ignore_fail=False,
         # Attaching XDP may change features, fetch the latest state
         feat = ethtool(f"-k {cfg.ifname}", json=True)[0]
 
-        _set_ethtool_feat(cfg, feat,
-                          {"generic-receive-offload": True,
-                           "rx-gro-hw": True,
-                           "large-receive-offload": False})
+        set_ethtool_feat(cfg.ifname, feat,
+                         {"generic-receive-offload": True,
+                          "rx-gro-hw": True,
+                          "large-receive-offload": False})
 
 
 def _check_gro_stats(cfg, test_queue, stats_before,
-- 
2.56.1


  parent reply	other threads:[~2026-11-22  1:01 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-22  1:01 [PATCH net-next v2 0/9] net: make core auto-disable HW-GRO and LRO when XDP gets attached Jakub Kicinski
2026-11-22  1:01 ` [PATCH net-next v2 1/9] net: stop making HW-GRO depend on SW GRO Jakub Kicinski
2026-11-22  1:01 ` Jakub Kicinski [this message]
2026-11-22  1:01 ` [PATCH net-next v2 3/9] selftests: drv-net: drop the generic XDP hack from the HW GRO setup Jakub Kicinski
2026-11-22  1:01 ` [PATCH net-next v2 4/9] net: state the "XDP excludes HW-GRO" rule in the core Jakub Kicinski
2026-11-22  1:01 ` [PATCH net-next v2 5/9] net: state the "XDP excludes LRO" " Jakub Kicinski
2026-11-22  1:01 ` [PATCH net-next v2 6/9] eth: mlx5e: drop the now-dead HW-GRO and LRO vs XDP handling Jakub Kicinski
2026-11-22  1:01 ` [PATCH net-next v2 7/9] eth: bnxt_en: don't clear HW-GRO and LRO for XDP in ndo_fix_features Jakub Kicinski
2026-11-22  1:01 ` [PATCH net-next v2 8/9] eth: qede: drop the now-dead HW-GRO vs XDP handling Jakub Kicinski
2026-11-22  1:01 ` [PATCH net-next v2 9/9] eth: gve: drop the now-dead HW-GRO vs XDP interlock Jakub Kicinski

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=20261122010112.1471146-3-kuba@kernel.org \
    --to=kuba@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hawk@kernel.org \
    --cc=horms@kernel.org \
    --cc=hramamurthy@google.com \
    --cc=joshwash@google.com \
    --cc=manishc@marvell.com \
    --cc=michael.chan@broadcom.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=przemyslaw.kitszel@intel.com \
    --cc=saeedm@nvidia.com \
    --cc=sdf@fomichev.me \
    --cc=tariqt@nvidia.com \
    --cc=willemb@google.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox