Netdev List
 help / color / mirror / Atom feed
From: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
To: Jakub Kicinski <kuba@kernel.org>,  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: Re: [PATCH net-next 2/8] selftests: drv-net: drop the generic XDP hack from the HW GRO setup
Date: Thu, 19 Nov 2026 16:40:35 -0500	[thread overview]
Message-ID: <willemdebruijn.kernel.66eaabdbc8a1@gmail.com> (raw)
In-Reply-To: <20261118232315.3593731-3-kuba@kernel.org>

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
> 



  reply	other threads:[~2026-11-19 21:40 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-18 23:23 [PATCH net-next 0/8] net: adjust HW GRO and LRO feature handling Jakub Kicinski
2026-11-18 23:23 ` [PATCH net-next 1/8] net: stop making HW-GRO depend on SW GRO Jakub Kicinski
2026-11-18 23:23 ` [PATCH net-next 2/8] selftests: drv-net: drop the generic XDP hack from the HW GRO setup Jakub Kicinski
2026-11-19 21:40   ` Willem de Bruijn [this message]
2026-11-18 23:23 ` [PATCH net-next 3/8] net: state the "XDP excludes HW-GRO" rule in the core Jakub Kicinski
2026-11-18 23:23 ` [PATCH net-next 4/8] net: state the "XDP excludes LRO" " Jakub Kicinski
2026-11-18 23:23 ` [PATCH net-next 5/8] eth: mlx5e: drop the now-dead HW-GRO and LRO vs XDP handling Jakub Kicinski
2026-11-19 15:42   ` Dragos Tatulea
2026-11-18 23:23 ` [PATCH net-next 6/8] eth: bnxt_en: don't clear HW-GRO and LRO for XDP in ndo_fix_features Jakub Kicinski
2026-11-18 23:23 ` [PATCH net-next 7/8] eth: qede: drop the now-dead HW-GRO vs XDP handling Jakub Kicinski
2026-11-18 23:23 ` [PATCH net-next 8/8] eth: gve: drop the now-dead HW-GRO vs XDP interlock Jakub Kicinski
2026-11-18 23:44   ` Ankit Garg

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=willemdebruijn.kernel.66eaabdbc8a1@gmail.com \
    --to=willemdebruijn.kernel@gmail.com \
    --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=kuba@kernel.org \
    --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