🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: linux.kernel.netdev
3 messages
3 total messages Started by Jakub Kicinski Wed, 18 Nov 2026 23:23
[PATCH net-next 2/8] selftests: drv-net: drop the generic XDP hack from the HW GRO setup
#18799
Author: Jakub Kicinski
Date: Wed, 18 Nov 2026 23:23
79 lines
11823 bytes
The HW GRO tests want SW GRO out of the way so that what they observe
can only have come from the device. On drivers which keyed HW GRO off
NETIF_F_GRO that was not expressible with ethtool alone, so the setup
fell back to attaching a generic XDP program, which suppresses SW GRO
as a side effect.

Those drivers no longer tie the two features together, so ask for the
feature combination directly.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
 .../testing/selftests/drivers/net/gro_lib.py  | 21 +------------------
 .../selftests/drivers/net/hw/gro_stats.py     | 18 ----------------
 2 files changed, 1 insertion(+), 38 deletions(-)

diff --git a/tools/testing/selftests/drivers/net/gro_lib.py b/tools/testing/selftests/drivers/net/gro_lib.py
index 875a715b2ae1..6eff19db3541 100644
--- a/tools/testing/selftests/drivers/net/gro_lib.py
+++ b/tools/testing/selftests/drivers/net/gro_lib.py
@@ -263,26 +263,7 @@ def _run_gro_bin(cfg, test_name, protocol=None, num_flows=None,
         set_ethtool_feat(cfg.ifname, cfg.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
-        # to skip SW GRO, even when enabled.
-        feat = ethtool(f"-k {cfg.ifname}", json=True)[0]
-        if not feat["rx-gro-hw"]["active"]:
-            ksft_pr("Driver clears HW GRO and SW GRO is cleared, using generic XDP workaround")
-            prog = cfg.net_lib_dir / "xdp_dummy.bpf.o"
-            ip(f"link set dev {cfg.ifname} xdpgeneric obj {prog} sec xdp")
-            defer(ip, f"link set dev {cfg.ifname} xdpgeneric off")
-
-            # Attaching XDP may change features, fetch the latest state
-            feat = ethtool(f"-k {cfg.ifname}", json=True)[0]
-
-            set_ethtool_feat(cfg.ifname, feat,
-                             {"generic-receive-offload": True,
-                              "rx-gro-hw": True,
-                              "large-receive-offload": False})
+                          "large-receive-offload": False})
     elif mode == "lro":
         # netdevsim advertises LRO for feature inheritance testing with
         # bonding/team tests but it doesn't actually perform the offload
diff --git a/tools/testing/selftests/drivers/net/hw/gro_stats.py b/tools/testing/selftests/drivers/net/hw/gro_stats.py
index 70e76e3888bd..569ca81368e6 100755
--- a/tools/testing/selftests/drivers/net/hw/gro_stats.py
+++ b/tools/testing/selftests/drivers/net/hw/gro_stats.py
@@ -173,24 +173,6 @@ def _run_gro_test(cfg, test_name, num_flows=None, ignore_fail=False,
                        "rx-gro-hw": True,
                        "large-receive-offload": 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
-    # to skip SW GRO, even when enabled.
-    feat = ethtool(f"-k {cfg.ifname}", json=True)[0]
-    if not feat["rx-gro-hw"]["active"]:
-        ksft_pr("Driver clears HW GRO when SW GRO is cleared, using generic XDP workaround")
-        prog = cfg.net_lib_dir / "xdp_dummy.bpf.o"
-        ip(f"link set dev {cfg.ifname} xdpgeneric obj {prog} sec xdp")
-        defer(ip, f"link set dev {cfg.ifname} xdpgeneric off")
-
-        # 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})
-
 
 def _check_gro_stats(cfg, test_queue, stats_before,
                      expect_rx, expect_gro, expect_wire):
-- 
2.56.1
Re: [PATCH net-next 2/8] selftests: drv-net: drop the generic XDP hack from the HW GRO setup
#19391
Author: Willem de Bruijn
Date: Thu, 19 Nov 2026 21:40
100 lines
16361 bytes
Jakub Kicinski wrote:
> The HW GRO tests want SW GRO out of the way so that what they observe
> can only have come from the device. On drivers which keyed HW GRO off
> NETIF_F_GRO that was not expressible with ethtool alone, so the setup
> fell back to attaching a generic XDP program, which suppresses SW GRO
> as a side effect.
> 
> Those drivers no longer tie the two features together, so ask for the
> feature combination directly.
> 
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
> ---
>  .../testing/selftests/drivers/net/gro_lib.py  | 21 +------------------
>  .../selftests/drivers/net/hw/gro_stats.py     | 18 ----------------
>  2 files changed, 1 insertion(+), 38 deletions(-)
> 
> diff --git a/tools/testing/selftests/drivers/net/gro_lib.py b/tools/testing/selftests/drivers/net/gro_lib.py
> index 875a715b2ae1..6eff19db3541 100644
> --- a/tools/testing/selftests/drivers/net/gro_lib.py
> +++ b/tools/testing/selftests/drivers/net/gro_lib.py
> @@ -263,26 +263,7 @@ def _run_gro_bin(cfg, test_name, protocol=None, num_flows=None,
>          set_ethtool_feat(cfg.ifname, cfg.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
> -        # to skip SW GRO, even when enabled.
> -        feat = ethtool(f"-k {cfg.ifname}", json=True)[0]
> -        if not feat["rx-gro-hw"]["active"]:
> -            ksft_pr("Driver clears HW GRO and SW GRO is cleared, using generic XDP workaround")
> -            prog = cfg.net_lib_dir / "xdp_dummy.bpf.o"
> -            ip(f"link set dev {cfg.ifname} xdpgeneric obj {prog} sec xdp")
> -            defer(ip, f"link set dev {cfg.ifname} xdpgeneric off")
> -
> -            # Attaching XDP may change features, fetch the latest state
> -            feat = ethtool(f"-k {cfg.ifname}", json=True)[0]
> -
> -            set_ethtool_feat(cfg.ifname, feat,
> -                             {"generic-receive-offload": True,
> -                              "rx-gro-hw": True,
> -                              "large-receive-offload": False})
> +                          "large-receive-offload": False})
>      elif mode == "lro":
>          # netdevsim advertises LRO for feature inheritance testing with
>          # bonding/team tests but it doesn't actually perform the offload
> diff --git a/tools/testing/selftests/drivers/net/hw/gro_stats.py b/tools/testing/selftests/drivers/net/hw/gro_stats.py
> index 70e76e3888bd..569ca81368e6 100755
> --- a/tools/testing/selftests/drivers/net/hw/gro_stats.py
> +++ b/tools/testing/selftests/drivers/net/hw/gro_stats.py
> @@ -173,24 +173,6 @@ def _run_gro_test(cfg, test_name, num_flows=None, ignore_fail=False,
>                         "rx-gro-hw": True,
>                         "large-receive-offload": 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
> -    # to skip SW GRO, even when enabled.
> -    feat = ethtool(f"-k {cfg.ifname}", json=True)[0]
> -    if not feat["rx-gro-hw"]["active"]:
> -        ksft_pr("Driver clears HW GRO when SW GRO is cleared, using generic XDP workaround")
> -        prog = cfg.net_lib_dir / "xdp_dummy.bpf.o"
> -        ip(f"link set dev {cfg.ifname} xdpgeneric obj {prog} sec xdp")
> -        defer(ip, f"link set dev {cfg.ifname} xdpgeneric off")
> -
> -        # 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})
> -

Not sure how likely these driver edge cases would be to reach, but FYI:

    gro_stats.py uses its own _set_ethtool_feat(), which, unlike the shared
    set_ethtool_feat() in lib/py/feat.py, never reads the features back
    after `ethtool -K`. This removed `if not feat["rx-gro-hw"]["active"]`
    was the only check that HW GRO actually turned on. Drivers still drop
    GRO_HW in ndo_fix_features for reasons unrelated to SW GRO:
      - qede with MTU > PAGE_SIZE;
      - bnx2x when the MTU doesn't allow GRO;
      - bnxt with BNXT_FLAG_NO_AGG_RINGS;
      - mlx5 with legacy RQ or CQE compression;
      - and, after 3/8, any attached XDP program.
    In those cases the test now runs with both SW and HW GRO off and fails
    later in _check_gro_stats() with a confusing count mismatch, instead of
    skipping. gro_lib.py got that check by dropping check=False, so the two
    tests now behave differently. Either switch _setup_hw_gro() to the
    shared set_ethtool_feat() (and delete the local copy), or keep a short
    read-back
>  
>  def _check_gro_stats(cfg, test_queue, stats_before,
>                       expect_rx, expect_gro, expect_wire):
> -- 
> 2.56.1
> 
Re: [PATCH net-next 2/8] selftests: drv-net: drop the generic XDP hack from the HW GRO setup
#20475
Author: netdev-bot+sashiko
Date: Sun, 22 Nov 2026 17:03
109 lines
12313 bytes
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] After this patch, nothing in
  tools/testing/selftests/drivers/net/hw/gro_stats.py checks that rx-…

--

selftests: drv-net: drop the generic XDP hack from the HW GRO setup

This commit removes the generic XDP fallback from the HW GRO setup in
gro_lib.py and hw/gro_stats.py. Drivers no longer tie HW GRO to
NETIF_F_GRO, so the setup now asks ethtool for SW GRO off and rx-gro-hw
on directly.

> diff --git a/tools/testing/selftests/drivers/net/gro_lib.py b/tools/testing/selftests/drivers/net/gro_lib.py
> index 875a715b2ae1c..6eff19db3541f 100644
> --- a/tools/testing/selftests/drivers/net/gro_lib.py
> +++ b/tools/testing/selftests/drivers/net/gro_lib.py
> @@ -263,26 +263,7 @@ 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},
> -                          check=False)

[ ... ]

> diff --git a/tools/testing/selftests/drivers/net/hw/gro_stats.py b/tools/testing/selftests/drivers/net/hw/gro_stats.py
> index 70e76e3888bdb..569ca81368e69 100755
> --- a/tools/testing/selftests/drivers/net/hw/gro_stats.py
> +++ b/tools/testing/selftests/drivers/net/hw/gro_stats.py
> @@ -173,24 +173,6 @@ def _setup_hw_gro(cfg):
>                         "rx-gro-hw": True,
>                         "large-receive-offload": 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
> -    # to skip SW GRO, even when enabled.
> -    feat = ethtool(f"-k {cfg.ifname}", json=True)[0]
> -    if not feat["rx-gro-hw"]["active"]:

[ ... ]

> -        _set_ethtool_feat(cfg, feat,
> -                          {"generic-receive-offload": True,
> -                           "rx-gro-hw": True,
> -                           "large-receive-offload": False})
> -

[Severity: Medium]
Now that this read-back is gone, does anything in gro_stats.py still check
that rx-gro-hw is actually active after _setup_hw_gro() runs?

_setup_hw_gro() calls the file-local _set_ethtool_feat(). That helper only
raises KsftSkipEx when a feature is marked fixed. It never re-reads the
features after running ethtool -K:

tools/testing/selftests/drivers/net/hw/gro_stats.py:_set_ethtool_feat() {
    ...
    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)
}

In the same patch, _setup() in gro_lib.py drops check=False. It now relies
on the read-back in the shared helper:

tools/testing/selftests/drivers/net/lib/py/feat.py:set_ethtool_feat() {
    ...
    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]}")
}

The kernel can still clear rx-gro-hw even when the feature is not fixed:

- netdev_fix_features() drops NETIF_F_GRO_HW when RXCSUM is off or RX-FCS
  is on.
- A driver's ndo_fix_features can clear it.
- The tests may run on a kernel without "net: stop making HW-GRO depend
  on SW GRO".

In those cases, would gro_stats.py go on to run with both SW and HW GRO
disabled?

If so, test_gro_stats_full would fail its ksft_ge(gro_coalesced, 1) and
rx-hw-gro-* checks with misleading messages. Meanwhile test_gro_stats_single
and test_gro_order could pass without HW GRO ever having run.

Would it make sense to switch _setup_hw_gro() to the shared
set_ethtool_feat()? Another option is to re-read ethtool -k after the set
and skip or xfail when rx-gro-hw is not active.

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261118232315.3593731-1-kuba%40kernel.org
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads