* [PATCH net-next 1/8] net: stop making HW-GRO depend on SW GRO
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 ` Jakub Kicinski
2026-11-22 17:03 ` netdev-bot+sashiko
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
` (6 subsequent siblings)
7 siblings, 1 reply; 23+ messages in thread
From: Jakub Kicinski @ 2026-11-18 23:23 UTC (permalink / raw)
To: davem
Cc: netdev, edumazet, pabeni, andrew+netdev, horms, michael.chan,
manishc, joshwash, hramamurthy, tariqt, saeedm, daniel, hawk, sdf,
willemb, przemyslaw.kitszel, bpf, Jakub Kicinski
bnxt, qede and bnx2x clear NETIF_F_GRO_HW whenever NETIF_F_GRO is off.
Nothing in the stack needs that. HW-GRO'd skbs arrive already coalesced
with gso_size set, exactly like LRO frames, and LRO never depended on
the software GRO bit. netif_elide_gro() only gates the software path,
and the in-driver consumers of the offload key off the feature bit
itself, not off NETIF_F_GRO.
The coupling gets in the way of exercising the offload on its own:
turning SW GRO off to isolate HW GRO takes HW GRO down with it on these
three drivers, which is why the GRO selftests carry a generic XDP hack.
The core only ever constrained GRO_HW on RXCSUM, RXFCS and LRO, and the
other HW-GRO capable drivers do not couple the two either.
User visible change: "ethtool -K $dev gro off" no longer implies
"rx-gro-hw off" on bnxt, qede and bnx2x.
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | 2 +-
drivers/net/ethernet/broadcom/bnxt/bnxt.c | 3 ---
drivers/net/ethernet/qlogic/qede/qede_filter.c | 3 +--
3 files changed, 2 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
index 6fb0619731ae..5686c4ecb944 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
@@ -4934,7 +4934,7 @@ netdev_features_t bnx2x_fix_features(struct net_device *dev,
if (!(features & NETIF_F_RXCSUM))
features &= ~NETIF_F_LRO;
- if (!(features & NETIF_F_GRO) || !bnx2x_mtu_allows_gro(dev->mtu))
+ if (!bnx2x_mtu_allows_gro(dev->mtu))
features &= ~NETIF_F_GRO_HW;
if (features & NETIF_F_GRO_HW)
features &= ~NETIF_F_LRO;
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
index 6846a27bfef4..27c53db2c9e4 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
@@ -14092,9 +14092,6 @@ static netdev_features_t bnxt_fix_features(struct net_device *dev,
if ((bp->flags & BNXT_FLAG_NO_AGG_RINGS) || bp->xdp_prog)
features &= ~(NETIF_F_LRO | NETIF_F_GRO_HW);
- if (!(features & NETIF_F_GRO))
- features &= ~NETIF_F_GRO_HW;
-
if (features & NETIF_F_GRO_HW)
features &= ~NETIF_F_LRO;
diff --git a/drivers/net/ethernet/qlogic/qede/qede_filter.c b/drivers/net/ethernet/qlogic/qede/qede_filter.c
index 5bf32f1034e0..d0e203167e35 100644
--- a/drivers/net/ethernet/qlogic/qede/qede_filter.c
+++ b/drivers/net/ethernet/qlogic/qede/qede_filter.c
@@ -915,8 +915,7 @@ netdev_features_t qede_fix_features(struct net_device *dev,
{
struct qede_dev *edev = netdev_priv(dev);
- if (edev->xdp_prog || edev->ndev->mtu > PAGE_SIZE ||
- !(features & NETIF_F_GRO))
+ if (edev->xdp_prog || edev->ndev->mtu > PAGE_SIZE)
features &= ~NETIF_F_GRO_HW;
return features;
--
2.56.1
^ permalink raw reply related [flat|nested] 23+ messages in thread* Re: [PATCH net-next 1/8] net: stop making HW-GRO depend on SW GRO
2026-11-18 23:23 ` [PATCH net-next 1/8] net: stop making HW-GRO depend on SW GRO Jakub Kicinski
@ 2026-11-22 17:03 ` netdev-bot+sashiko
0 siblings, 0 replies; 23+ messages in thread
From: netdev-bot+sashiko @ 2026-11-22 17:03 UTC (permalink / raw)
To: kuba
Cc: davem, netdev, edumazet, pabeni, andrew+netdev, horms,
michael.chan, manishc, joshwash, hramamurthy, tariqt, saeedm,
daniel, hawk, sdf, willemb, przemyslaw.kitszel, bpf
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] On bnxt, `ethtool -K $dev gro off lro on` used to give
hardware LRO.
--
net: stop making HW-GRO depend on SW GRO
This patch removes the code in bnxt, qede and bnx2x that cleared
NETIF_F_GRO_HW whenever NETIF_F_GRO was off. The commit message gives
one user visible change: "ethtool -K $dev gro off" no longer implies
"rx-gro-hw off" on these drivers.
[ ... ]
> diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
> index 6846a27bfef4c..27c53db2c9e45 100644
> --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
> +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
> @@ -14092,9 +14092,6 @@ static netdev_features_t bnxt_fix_features(struct net_device *dev,
> if ((bp->flags & BNXT_FLAG_NO_AGG_RINGS) || bp->xdp_prog)
> features &= ~(NETIF_F_LRO | NETIF_F_GRO_HW);
>
> - if (!(features & NETIF_F_GRO))
> - features &= ~NETIF_F_GRO_HW;
> -
> if (features & NETIF_F_GRO_HW)
> features &= ~NETIF_F_LRO;
>
[Severity: Medium]
Does this change what "ethtool -K $dev gro off lro on" does on bnxt?
Before this patch, turning SW GRO off cleared NETIF_F_GRO_HW first. The
LRO request then got past the GRO_HW-over-LRO check below it, and
bnxt_set_features() picked LRO:
bnxt_set_features() {
...
if (features & NETIF_F_GRO_HW)
flags |= BNXT_FLAG_GRO;
else if (features & NETIF_F_LRO)
flags |= BNXT_FLAG_LRO;
...
}
With the check removed, NETIF_F_GRO_HW stays in wanted_features, since
bnxt_init_one() turns it on by default. bnxt_fix_features() then
clears NETIF_F_LRO, and netdev_fix_features() drops it again:
net/core/dev.c:netdev_fix_features() {
...
if ((features & NETIF_F_GRO_HW) && (features & NETIF_F_LRO)) {
netdev_dbg(dev, "Dropping LRO feature since HW-GRO is requested.\n");
features &= ~NETIF_F_LRO;
}
...
}
So the device ends up in BNXT_FLAG_GRO mode instead of BNXT_FLAG_LRO,
and ethtool shows large-receive-offload as "off [requested on]". To get
LRO now, the user also has to set "rx-gro-hw off".
This mapping looks intentional. Before commit 1054aee82321 ("bnxt_en:
Use NETIF_F_GRO_HW."), bnxt_set_features() chose hardware GRO based on
NETIF_F_GRO and fell back to LRO when GRO was off. The GRO -> GRO_HW
dependency kept that behaviour working.
bnx2x_fix_features() checks GRO_HW and LRO in the same order:
if (!bnx2x_mtu_allows_gro(dev->mtu))
features &= ~NETIF_F_GRO_HW;
if (features & NETIF_F_GRO_HW)
features &= ~NETIF_F_LRO;
Fewer users hit this by default, because bnx2x_init_dev() clears
GRO_HW when LRO is on. But if a user has enabled rx-gro-hw and later
runs "gro off lro on", they would also get HW-GRO instead of LRO.
Later patches in the series only remove the bp->xdp_prog clause from
bnxt_fix_features(). The GRO_HW-over-LRO ordering is still there at the
end of the series.
Should the commit message say that LRO requests with gro off are now
refused while rx-gro-hw is on? Or should an explicit LRO request take
precedence here?
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261118232315.3593731-1-kuba%40kernel.org
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH net-next 2/8] selftests: drv-net: drop the generic XDP hack from the HW GRO setup
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 ` Jakub Kicinski
2026-11-19 21:40 ` Willem de Bruijn
2026-11-22 17:03 ` netdev-bot+sashiko
2026-11-18 23:23 ` [PATCH net-next 3/8] net: state the "XDP excludes HW-GRO" rule in the core Jakub Kicinski
` (5 subsequent siblings)
7 siblings, 2 replies; 23+ messages in thread
From: Jakub Kicinski @ 2026-11-18 23:23 UTC (permalink / raw)
To: davem
Cc: netdev, edumazet, pabeni, andrew+netdev, horms, michael.chan,
manishc, joshwash, hramamurthy, tariqt, saeedm, daniel, hawk, sdf,
willemb, przemyslaw.kitszel, bpf, Jakub Kicinski
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
^ permalink raw reply related [flat|nested] 23+ messages in thread* Re: [PATCH net-next 2/8] selftests: drv-net: drop the generic XDP hack from the HW GRO setup
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
2026-11-22 17:03 ` netdev-bot+sashiko
1 sibling, 0 replies; 23+ messages in thread
From: Willem de Bruijn @ 2026-11-19 21:40 UTC (permalink / raw)
To: Jakub Kicinski, davem
Cc: netdev, edumazet, pabeni, andrew+netdev, horms, michael.chan,
manishc, joshwash, hramamurthy, tariqt, saeedm, daniel, hawk, sdf,
willemb, przemyslaw.kitszel, bpf, Jakub Kicinski
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
>
^ permalink raw reply [flat|nested] 23+ messages in thread* Re: [PATCH net-next 2/8] selftests: drv-net: drop the generic XDP hack from the HW GRO setup
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
@ 2026-11-22 17:03 ` netdev-bot+sashiko
1 sibling, 0 replies; 23+ messages in thread
From: netdev-bot+sashiko @ 2026-11-22 17:03 UTC (permalink / raw)
To: kuba
Cc: davem, netdev, edumazet, pabeni, andrew+netdev, horms,
michael.chan, manishc, joshwash, hramamurthy, tariqt, saeedm,
daniel, hawk, sdf, willemb, przemyslaw.kitszel, bpf
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
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH net-next 3/8] net: state the "XDP excludes HW-GRO" rule in the core
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-18 23:23 ` Jakub Kicinski
2026-11-19 22:59 ` Willem de Bruijn
2026-11-22 17:03 ` netdev-bot+sashiko
2026-11-18 23:23 ` [PATCH net-next 4/8] net: state the "XDP excludes LRO" " Jakub Kicinski
` (4 subsequent siblings)
7 siblings, 2 replies; 23+ messages in thread
From: Jakub Kicinski @ 2026-11-18 23:23 UTC (permalink / raw)
To: davem
Cc: netdev, edumazet, pabeni, andrew+netdev, horms, michael.chan,
manishc, joshwash, hramamurthy, tariqt, saeedm, daniel, hawk, sdf,
willemb, przemyslaw.kitszel, bpf, Jakub Kicinski
XDP has to see the frames as the wire delivered them, so HW-GRO must be
off while a program is attached. Drivers currently open-code that policy,
and they diverge: mlx5, gve and virtio_net refuse the attach, bnxt and
qede clear the feature from ndo_fix_features(), and idpf does nothing
at all and happily runs RSC under XDP.
Clear HW-GRO in __netdev_update_features(), and make sure XDP setup
paths refresh the features.
Take extra care to make sure the disablement actually works, some
drivers add the feature back in ndo_fix_features, even when removed
from wanted features (mlx5 does for header-data-split).
This change also removes the warn-only check dev_disable_gro_hw()
performed. On mlx5 with tcp-data-split on, attaching a multi-buf
generic XDP program reached generic_xdp_install(), whose
dev_disable_gro_hw() cleared wanted_features, recomputed, saw
mlx5e_fix_features() put NETIF_F_GRO_HW straight back, and splatted:
------------[ cut here ]------------
netdevice: eth0: failed to disable GRO_HW!
WARNING: net/core/dev.c:1880 at generic_xdp_install+0x135/0x190, CPU#53: ip/667
RIP: 0010:generic_xdp_install+0x17a/0x190
Call Trace:
<TASK>
dev_xdp_install+0x2aa/0x380
dev_xdp_attach+0x41f/0x460
dev_change_xdp_fd+0xbb/0x110
do_setlink+0xfb9/0x1030
rtnl_newlink+0x9f5/0xaf0
rtnetlink_rcv_msg+0x442/0x490
netlink_rcv_skb+0x16a/0x1a0
netlink_unicast+0x1fc/0x320
netlink_sendmsg+0x2d6/0x380
and then attached anyway, leaving XDP looking at coalesced frames.
The device also lost the bit from wanted_features for good, so HW-GRO
never came back after detach - on mlx5 that took header-data split
with it, and with it devmem and io_uring zero-copy Rx.
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
.../networking/net_cachelines/net_device.rst | 1 +
include/linux/netdevice.h | 6 ++
net/core/dev.c | 97 ++++++++++++++-----
3 files changed, 81 insertions(+), 23 deletions(-)
diff --git a/Documentation/networking/net_cachelines/net_device.rst b/Documentation/networking/net_cachelines/net_device.rst
index 7620d3fcb8dc..25cf02a184ec 100644
--- a/Documentation/networking/net_cachelines/net_device.rst
+++ b/Documentation/networking/net_cachelines/net_device.rst
@@ -169,6 +169,7 @@ unsigned_long:1 see_all_hwtstamp_requests
unsigned_long:1 change_proto_down
unsigned_long:1 netns_immutable
unsigned_long:1 fcoe_mtu
+unsigned_long:1 xdp_pending
unsigned_long:1 xdp_from_upper
struct list_head net_notifier_list
struct macsec_ops* macsec_ops
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 0325c6f2a7d1..049538b13e61 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -2531,6 +2531,12 @@ struct net_device {
unsigned long change_proto_down:1;
unsigned long netns_immutable:1;
unsigned long fcoe_mtu:1;
+ /**
+ * @xdp_pending: an XDP program is being installed, but is not in
+ * @xdp_state yet. Most users should access it implicitly via
+ * helpers like dev_xdp_prog_count(), rather than directly.
+ */
+ unsigned long xdp_pending:1;
/**
* @xdp_from_upper: the program in @xdp_state was installed by an
* upper device with netif_xdp_propagate(); it belongs to the
diff --git a/net/core/dev.c b/net/core/dev.c
index d88af07aea29..c0bb5eb9fdea 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1901,23 +1901,6 @@ void netif_disable_lro(struct net_device *dev)
}
}
-/**
- * dev_disable_gro_hw - disable HW Generic Receive Offload on a device
- * @dev: device
- *
- * Disable HW Generic Receive Offload (GRO_HW) on a net device. Must be
- * called under RTNL. This is needed if Generic XDP is installed on
- * the device.
- */
-static void dev_disable_gro_hw(struct net_device *dev)
-{
- dev->wanted_features &= ~NETIF_F_GRO_HW;
- netdev_update_features(dev);
-
- if (unlikely(dev->features & NETIF_F_GRO_HW))
- netdev_WARN(dev, "failed to disable GRO_HW!\n");
-}
-
const char *netdev_cmd_to_name(enum netdev_cmd cmd)
{
#define N(val) \
@@ -6652,7 +6635,6 @@ static int generic_xdp_install(struct net_device *dev, struct netdev_bpf *xdp)
} else if (new && !old) {
static_branch_inc(&generic_xdp_needed_key);
netif_disable_lro(dev);
- dev_disable_gro_hw(dev);
}
break;
@@ -10571,7 +10553,7 @@ u8 dev_xdp_prog_count(struct net_device *dev)
for (i = 0; i < __MAX_XDP_MODE; i++)
if (dev->xdp_state[i].prog || dev->xdp_state[i].link)
count++;
- return count;
+ return count ?: !!dev->xdp_pending;
}
EXPORT_SYMBOL_GPL(dev_xdp_prog_count);
@@ -10612,6 +10594,32 @@ static void dev_xdp_set_prog(struct net_device *dev, enum bpf_xdp_mode mode,
dev->xdp_state[mode].prog = prog;
}
+/* Try to clear HW-GRO before the driver reconfigures for XDP.
+ * Driver may add features back in via ndo_fix_features(), due to feature
+ * dependencies. In that case we can't run XDP at all.
+ */
+static int dev_xdp_clear_rx_agg(struct net_device *dev,
+ struct netlink_ext_ack *extack)
+{
+ if (!(dev->features & NETIF_F_GRO_HW))
+ return 0;
+ if (!(dev->hw_features & NETIF_F_GRO_HW)) {
+ NL_SET_ERR_MSG(extack,
+ "unable to disable HW-GRO, fixed on");
+ return -EOPNOTSUPP;
+ }
+
+ netdev_update_features(dev);
+
+ if (dev->features & NETIF_F_GRO_HW) {
+ NL_SET_ERR_MSG(extack,
+ "unable to disable HW-GRO, required by another feature");
+ return -EBUSY;
+ }
+
+ return 0;
+}
+
int netif_xdp_propagate(struct net_device *dev, struct netdev_bpf *bpf)
{
struct bpf_prog *old_prog;
@@ -10645,11 +10653,17 @@ int netif_xdp_propagate(struct net_device *dev, struct netdev_bpf *bpf)
"unable to propagate XDP to device using memory provider");
return -EBUSY;
}
+
+ dev->xdp_pending = 1;
+
+ err = dev_xdp_clear_rx_agg(dev, bpf->extack);
+ if (err)
+ goto err_clear_pending;
}
err = dev->netdev_ops->ndo_bpf(dev, bpf);
if (err)
- return err;
+ goto err_clear_pending;
if (bpf->prog)
bpf_prog_inc(bpf->prog);
@@ -10662,11 +10676,22 @@ int netif_xdp_propagate(struct net_device *dev, struct netdev_bpf *bpf)
old_prog = dev_xdp_prog(dev, XDP_MODE_DRV);
bpf_prog_change_xdp(old_prog, bpf->prog);
dev_xdp_set_prog(dev, XDP_MODE_DRV, bpf->prog);
+ dev->xdp_pending = 0;
dev->xdp_from_upper = !!bpf->prog;
- if (old_prog)
+
+ if (old_prog) {
bpf_prog_put(old_prog);
+ /* The last program is gone, HW-GRO may be available again */
+ if (!bpf->prog)
+ netdev_update_features(dev);
+ }
return 0;
+
+err_clear_pending:
+ dev->xdp_pending = 0;
+ netdev_update_features(dev);
+ return err;
}
EXPORT_SYMBOL_GPL(netif_xdp_propagate);
@@ -10875,19 +10900,36 @@ static int dev_xdp_attach(struct net_device *dev, struct netlink_ext_ack *extack
return -EOPNOTSUPP;
}
+ if (new_prog) {
+ dev->xdp_pending = 1;
+ err = dev_xdp_clear_rx_agg(dev, extack);
+ if (err)
+ goto err_clear_pending;
+ }
+
err = dev_xdp_install(dev, mode, bpf_op, extack, flags, new_prog);
if (err)
- return err;
+ goto err_clear_pending;
}
if (link)
dev_xdp_set_link(dev, mode, link);
else
dev_xdp_set_prog(dev, mode, new_prog);
- if (cur_prog)
+ dev->xdp_pending = 0;
+ if (cur_prog) {
bpf_prog_put(cur_prog);
+ /* The last program is gone, HW-GRO may be available again */
+ if (!new_prog)
+ netdev_update_features(dev);
+ }
return 0;
+
+err_clear_pending:
+ dev->xdp_pending = 0;
+ netdev_update_features(dev);
+ return err;
}
static int dev_xdp_attach_link(struct net_device *dev,
@@ -10913,6 +10955,7 @@ static int dev_xdp_detach_link(struct net_device *dev,
bpf_op = dev_xdp_bpf_op(dev, mode);
WARN_ON(dev_xdp_install(dev, mode, bpf_op, NULL, 0, NULL));
dev_xdp_set_link(dev, mode, NULL);
+ netdev_update_features(dev);
return 0;
}
@@ -11385,6 +11428,14 @@ int __netdev_update_features(struct net_device *dev)
features = netdev_get_wanted_features(dev);
+ /* GRO_HW may be added back in via ndo_fix_features e.g. if driver needs
+ * it to honor the HDS config, clear it before the fix features call.
+ */
+ if ((features & NETIF_F_GRO_HW) && dev_xdp_prog_count(dev)) {
+ netdev_dbg(dev, "Dropping HW-GRO feature since XDP is attached.\n");
+ features &= ~NETIF_F_GRO_HW;
+ }
+
if (dev->netdev_ops->ndo_fix_features)
features = dev->netdev_ops->ndo_fix_features(dev, features);
--
2.56.1
^ permalink raw reply related [flat|nested] 23+ messages in thread* Re: [PATCH net-next 3/8] net: state the "XDP excludes HW-GRO" rule in the core
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-19 22:59 ` Willem de Bruijn
2026-11-20 22:13 ` Jakub Kicinski
2026-11-22 17:03 ` netdev-bot+sashiko
1 sibling, 1 reply; 23+ messages in thread
From: Willem de Bruijn @ 2026-11-19 22:59 UTC (permalink / raw)
To: Jakub Kicinski, davem
Cc: netdev, edumazet, pabeni, andrew+netdev, horms, michael.chan,
manishc, joshwash, hramamurthy, tariqt, saeedm, daniel, hawk, sdf,
willemb, przemyslaw.kitszel, bpf, Jakub Kicinski
Jakub Kicinski wrote:
> XDP has to see the frames as the wire delivered them, so HW-GRO must be
> off while a program is attached. Drivers currently open-code that policy,
> and they diverge: mlx5, gve and virtio_net refuse the attach, bnxt and
> qede clear the feature from ndo_fix_features(), and idpf does nothing
> at all and happily runs RSC under XDP.
>
> Clear HW-GRO in __netdev_update_features(), and make sure XDP setup
> paths refresh the features.
>
> Take extra care to make sure the disablement actually works, some
> drivers add the feature back in ndo_fix_features, even when removed
> from wanted features (mlx5 does for header-data-split).
>
> This change also removes the warn-only check dev_disable_gro_hw()
> performed. On mlx5 with tcp-data-split on, attaching a multi-buf
> generic XDP program reached generic_xdp_install(), whose
> dev_disable_gro_hw() cleared wanted_features, recomputed, saw
> mlx5e_fix_features() put NETIF_F_GRO_HW straight back, and splatted:
>
> ------------[ cut here ]------------
> netdevice: eth0: failed to disable GRO_HW!
> WARNING: net/core/dev.c:1880 at generic_xdp_install+0x135/0x190, CPU#53: ip/667
> RIP: 0010:generic_xdp_install+0x17a/0x190
> Call Trace:
> <TASK>
> dev_xdp_install+0x2aa/0x380
> dev_xdp_attach+0x41f/0x460
> dev_change_xdp_fd+0xbb/0x110
> do_setlink+0xfb9/0x1030
> rtnl_newlink+0x9f5/0xaf0
> rtnetlink_rcv_msg+0x442/0x490
> netlink_rcv_skb+0x16a/0x1a0
> netlink_unicast+0x1fc/0x320
> netlink_sendmsg+0x2d6/0x380
>
> and then attached anyway, leaving XDP looking at coalesced frames.
> The device also lost the bit from wanted_features for good, so HW-GRO
> never came back after detach - on mlx5 that took header-data split
> with it, and with it devmem and io_uring zero-copy Rx.
>
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
> ---
> .../networking/net_cachelines/net_device.rst | 1 +
> include/linux/netdevice.h | 6 ++
> net/core/dev.c | 97 ++++++++++++++-----
> 3 files changed, 81 insertions(+), 23 deletions(-)
>
> diff --git a/Documentation/networking/net_cachelines/net_device.rst b/Documentation/networking/net_cachelines/net_device.rst
> index 7620d3fcb8dc..25cf02a184ec 100644
> --- a/Documentation/networking/net_cachelines/net_device.rst
> +++ b/Documentation/networking/net_cachelines/net_device.rst
> @@ -169,6 +169,7 @@ unsigned_long:1 see_all_hwtstamp_requests
> unsigned_long:1 change_proto_down
> unsigned_long:1 netns_immutable
> unsigned_long:1 fcoe_mtu
> +unsigned_long:1 xdp_pending
> unsigned_long:1 xdp_from_upper
> struct list_head net_notifier_list
> struct macsec_ops* macsec_ops
> diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
> index 0325c6f2a7d1..049538b13e61 100644
> --- a/include/linux/netdevice.h
> +++ b/include/linux/netdevice.h
> @@ -2531,6 +2531,12 @@ struct net_device {
> unsigned long change_proto_down:1;
> unsigned long netns_immutable:1;
> unsigned long fcoe_mtu:1;
> + /**
> + * @xdp_pending: an XDP program is being installed, but is not in
> + * @xdp_state yet. Most users should access it implicitly via
> + * helpers like dev_xdp_prog_count(), rather than directly.
> + */
> + unsigned long xdp_pending:1;
> /**
> * @xdp_from_upper: the program in @xdp_state was installed by an
> * upper device with netif_xdp_propagate(); it belongs to the
> diff --git a/net/core/dev.c b/net/core/dev.c
> index d88af07aea29..c0bb5eb9fdea 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -1901,23 +1901,6 @@ void netif_disable_lro(struct net_device *dev)
> }
> }
>
> -/**
> - * dev_disable_gro_hw - disable HW Generic Receive Offload on a device
> - * @dev: device
> - *
> - * Disable HW Generic Receive Offload (GRO_HW) on a net device. Must be
> - * called under RTNL. This is needed if Generic XDP is installed on
> - * the device.
> - */
> -static void dev_disable_gro_hw(struct net_device *dev)
> -{
> - dev->wanted_features &= ~NETIF_F_GRO_HW;
> - netdev_update_features(dev);
> -
> - if (unlikely(dev->features & NETIF_F_GRO_HW))
> - netdev_WARN(dev, "failed to disable GRO_HW!\n");
> -}
> -
> const char *netdev_cmd_to_name(enum netdev_cmd cmd)
> {
> #define N(val) \
> @@ -6652,7 +6635,6 @@ static int generic_xdp_install(struct net_device *dev, struct netdev_bpf *xdp)
> } else if (new && !old) {
> static_branch_inc(&generic_xdp_needed_key);
> netif_disable_lro(dev);
> - dev_disable_gro_hw(dev);
> }
> break;
>
> @@ -10571,7 +10553,7 @@ u8 dev_xdp_prog_count(struct net_device *dev)
> for (i = 0; i < __MAX_XDP_MODE; i++)
> if (dev->xdp_state[i].prog || dev->xdp_state[i].link)
> count++;
> - return count;
> + return count ?: !!dev->xdp_pending;
> }
> EXPORT_SYMBOL_GPL(dev_xdp_prog_count);
>
> @@ -10612,6 +10594,32 @@ static void dev_xdp_set_prog(struct net_device *dev, enum bpf_xdp_mode mode,
> dev->xdp_state[mode].prog = prog;
> }
>
> +/* Try to clear HW-GRO before the driver reconfigures for XDP.
> + * Driver may add features back in via ndo_fix_features(), due to feature
> + * dependencies. In that case we can't run XDP at all.
> + */
> +static int dev_xdp_clear_rx_agg(struct net_device *dev,
> + struct netlink_ext_ack *extack)
> +{
> + if (!(dev->features & NETIF_F_GRO_HW))
> + return 0;
> + if (!(dev->hw_features & NETIF_F_GRO_HW)) {
> + NL_SET_ERR_MSG(extack,
> + "unable to disable HW-GRO, fixed on");
> + return -EOPNOTSUPP;
> + }
> +
> + netdev_update_features(dev);
> +
> + if (dev->features & NETIF_F_GRO_HW) {
> + NL_SET_ERR_MSG(extack,
> + "unable to disable HW-GRO, required by another feature");
> + return -EBUSY;
> + }
> +
> + return 0;
> +}
> +
> int netif_xdp_propagate(struct net_device *dev, struct netdev_bpf *bpf)
> {
> struct bpf_prog *old_prog;
> @@ -10645,11 +10653,17 @@ int netif_xdp_propagate(struct net_device *dev, struct netdev_bpf *bpf)
> "unable to propagate XDP to device using memory provider");
> return -EBUSY;
> }
> +
> + dev->xdp_pending = 1;
> +
> + err = dev_xdp_clear_rx_agg(dev, bpf->extack);
> + if (err)
> + goto err_clear_pending;
> }
>
> err = dev->netdev_ops->ndo_bpf(dev, bpf);
> if (err)
> - return err;
> + goto err_clear_pending;
> if (bpf->prog)
> bpf_prog_inc(bpf->prog);
>
> @@ -10662,11 +10676,22 @@ int netif_xdp_propagate(struct net_device *dev, struct netdev_bpf *bpf)
> old_prog = dev_xdp_prog(dev, XDP_MODE_DRV);
> bpf_prog_change_xdp(old_prog, bpf->prog);
> dev_xdp_set_prog(dev, XDP_MODE_DRV, bpf->prog);
> + dev->xdp_pending = 0;
> dev->xdp_from_upper = !!bpf->prog;
> - if (old_prog)
> +
> + if (old_prog) {
> bpf_prog_put(old_prog);
> + /* The last program is gone, HW-GRO may be available again */
> + if (!bpf->prog)
> + netdev_update_features(dev);
> + }
>
> return 0;
> +
> +err_clear_pending:
> + dev->xdp_pending = 0;
> + netdev_update_features(dev);
> + return err;
> }
> EXPORT_SYMBOL_GPL(netif_xdp_propagate);
>
> @@ -10875,19 +10900,36 @@ static int dev_xdp_attach(struct net_device *dev, struct netlink_ext_ack *extack
> return -EOPNOTSUPP;
> }
>
> + if (new_prog) {
> + dev->xdp_pending = 1;
> + err = dev_xdp_clear_rx_agg(dev, extack);
> + if (err)
> + goto err_clear_pending;
> + }
> +
> err = dev_xdp_install(dev, mode, bpf_op, extack, flags, new_prog);
> if (err)
> - return err;
> + goto err_clear_pending;
> }
>
> if (link)
> dev_xdp_set_link(dev, mode, link);
> else
> dev_xdp_set_prog(dev, mode, new_prog);
> - if (cur_prog)
> + dev->xdp_pending = 0;
> + if (cur_prog) {
> bpf_prog_put(cur_prog);
> + /* The last program is gone, HW-GRO may be available again */
> + if (!new_prog)
> + netdev_update_features(dev);
> + }
>
> return 0;
> +
> +err_clear_pending:
> + dev->xdp_pending = 0;
> + netdev_update_features(dev);
> + return err;
> }
>
> static int dev_xdp_attach_link(struct net_device *dev,
> @@ -10913,6 +10955,7 @@ static int dev_xdp_detach_link(struct net_device *dev,
> bpf_op = dev_xdp_bpf_op(dev, mode);
> WARN_ON(dev_xdp_install(dev, mode, bpf_op, NULL, 0, NULL));
> dev_xdp_set_link(dev, mode, NULL);
> + netdev_update_features(dev);
> return 0;
> }
>
> @@ -11385,6 +11428,14 @@ int __netdev_update_features(struct net_device *dev)
>
> features = netdev_get_wanted_features(dev);
>
> + /* GRO_HW may be added back in via ndo_fix_features e.g. if driver needs
> + * it to honor the HDS config, clear it before the fix features call.
> + */
> + if ((features & NETIF_F_GRO_HW) && dev_xdp_prog_count(dev)) {
> + netdev_dbg(dev, "Dropping HW-GRO feature since XDP is attached.\n");
> + features &= ~NETIF_F_GRO_HW;
> + }
> +
Apparently drivers can enable HW_GRO in some edge case (that can be
plugged itself?):
The rule is only enforced at attach time (dev_xdp_clear_rx_agg). Later
recomputes don't re-check after ndo_fix_features. Example:
1. Attach a multi-buf XDP program to mlx5 with HDS off. HW-GRO goes off.
2. Enable tcp-data-split. rings.c:253 only refuses this for
single-buffer XDP, via dev_xdp_sb_prog_count().
3. The next feature recompute runs mlx5e_fix_features(), and its
"Keeping HW-GRO enabled" block (en_main.c:4643) sets GRO_HW again,
after this strip. HW-GRO is now on with XDP attached.
This already happens today, but once 5/8 removes mlx5's own XDP check
the core is the only guard, and it misses this case. Either add a
post-fix_features check here (warn and strip, or refuse the change), or
make the HDS-enable path in rings.c refuse while any XDP program is
attached and the driver ties HDS to HW-GRO.
> if (dev->netdev_ops->ndo_fix_features)
> features = dev->netdev_ops->ndo_fix_features(dev, features);
>
> --
> 2.56.1
>
^ permalink raw reply [flat|nested] 23+ messages in thread* Re: [PATCH net-next 3/8] net: state the "XDP excludes HW-GRO" rule in the core
2026-11-19 22:59 ` Willem de Bruijn
@ 2026-11-20 22:13 ` Jakub Kicinski
0 siblings, 0 replies; 23+ messages in thread
From: Jakub Kicinski @ 2026-11-20 22:13 UTC (permalink / raw)
To: Willem de Bruijn
Cc: davem, netdev, edumazet, pabeni, andrew+netdev, horms,
michael.chan, manishc, joshwash, hramamurthy, tariqt, saeedm,
daniel, hawk, sdf, willemb, przemyslaw.kitszel, bpf
On Thu, 19 Nov 2026 17:59:08 -0500 Willem de Bruijn wrote:
> Apparently drivers can enable HW_GRO in some edge case (that can be
> plugged itself?):
>
> The rule is only enforced at attach time (dev_xdp_clear_rx_agg). Later
> recomputes don't re-check after ndo_fix_features. Example:
> 1. Attach a multi-buf XDP program to mlx5 with HDS off. HW-GRO goes off.
> 2. Enable tcp-data-split. rings.c:253 only refuses this for
> single-buffer XDP, via dev_xdp_sb_prog_count().
> 3. The next feature recompute runs mlx5e_fix_features(), and its
> "Keeping HW-GRO enabled" block (en_main.c:4643) sets GRO_HW again,
> after this strip. HW-GRO is now on with XDP attached.
> This already happens today, but once 5/8 removes mlx5's own XDP check
> the core is the only guard, and it misses this case. Either add a
> post-fix_features check here (warn and strip, or refuse the change), or
> make the HDS-enable path in rings.c refuse while any XDP program is
> attached and the driver ties HDS to HW-GRO.
Enabling of HDS can't happen in the sequence you describe, driver
checks:
static bool mlx5e_ethtool_set_tcp_data_split(struct mlx5e_priv *priv,
...
if (tcp_data_split == ETHTOOL_TCP_DATA_SPLIT_ENABLED &&
!(dev->features & NETIF_F_GRO_HW)) {
and with XDP attached GRO_HW is not in features (only wanted_features)
Thanks for the reviews, I'll spin v2 before EOD
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH net-next 3/8] net: state the "XDP excludes HW-GRO" rule in the core
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-19 22:59 ` Willem de Bruijn
@ 2026-11-22 17:03 ` netdev-bot+sashiko
1 sibling, 0 replies; 23+ messages in thread
From: netdev-bot+sashiko @ 2026-11-22 17:03 UTC (permalink / raw)
To: kuba
Cc: davem, netdev, edumazet, pabeni, andrew+netdev, horms,
michael.chan, manishc, joshwash, hramamurthy, tariqt, saeedm,
daniel, hawk, sdf, willemb, przemyslaw.kitszel, bpf
Thank you for your contribution! Sashiko AI review found 3 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 2 · Low: 1
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] Generic (SKB-mode) XDP attach now fails on devices where
NETIF_F_GRO_HW is fixed on, i.e. present in dev->features but missing…
- [Medium] dev_xdp_attach() now sets dev->xdp_pending = 1 and calls
dev_xdp_clear_rx_agg() before dev_xdp_install() runs its validation.
- [Low] The commit fixes concrete user-visible bugs but carries no Fixes:
tag.
--
net: state the "XDP excludes HW-GRO" rule in the core
This commit moves the "XDP excludes HW-GRO" policy into the core. While an
XDP program is attached or pending, __netdev_update_features() now clears
NETIF_F_GRO_HW. The XDP attach paths call a new helper,
dev_xdp_clear_rx_agg(), which refuses the attach if HW-GRO cannot be
turned off, and the warn-only dev_disable_gro_hw() is removed.
> The device also lost the bit from wanted_features for good, so HW-GRO
> never came back after detach - on mlx5 that took header-data split
> with it, and with it devmem and io_uring zero-copy Rx.
>
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
[Severity: Low]
Should this carry a Fixes: tag? Two things combine to cause the splat and
the permanent loss of NETIF_F_GRO_HW from wanted_features:
- the HDS-forces-GRO_HW logic in mlx5e_fix_features()
- the warn-and-continue behavior of dev_disable_gro_hw()
The mlx5 logic was added by:
Fixes: 46bcce5dfd33 ("net/mlx5e: Support ethtool tcp-data-split settings")
Without a tag, stable and backport tooling can't tell which kernels are
affected. If the series is meant only for net-next, this can be ignored.
> diff --git a/net/core/dev.c b/net/core/dev.c
> index d88af07aea290..c0bb5eb9fdea0 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
[ ... ]
> @@ -10612,6 +10594,32 @@ static void dev_xdp_set_prog(struct net_device *dev, enum bpf_xdp_mode mode,
> dev->xdp_state[mode].prog = prog;
> }
>
> +/* Try to clear HW-GRO before the driver reconfigures for XDP.
> + * Driver may add features back in via ndo_fix_features(), due to feature
> + * dependencies. In that case we can't run XDP at all.
> + */
> +static int dev_xdp_clear_rx_agg(struct net_device *dev,
> + struct netlink_ext_ack *extack)
> +{
> + if (!(dev->features & NETIF_F_GRO_HW))
> + return 0;
> + if (!(dev->hw_features & NETIF_F_GRO_HW)) {
> + NL_SET_ERR_MSG(extack,
> + "unable to disable HW-GRO, fixed on");
> + return -EOPNOTSUPP;
> + }
[Severity: Medium]
Does this stop generic XDP from attaching to virtio_net devices where
GRO_HW is fixed on?
virtnet_probe() adds GRO_HW to dev->features whenever GUEST_TSO4/6 is
negotiated. It only adds it to hw_features when CTRL_GUEST_OFFLOADS is
negotiated, and that needs the optional ctrl vq:
drivers/net/virtio_net.c:virtnet_probe() {
...
if (virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_TSO4) ||
virtio_has_feature(vdev, VIRTIO_NET_F_GUEST_TSO6))
dev->features |= NETIF_F_GRO_HW;
...
if (virtio_has_feature(vdev, VIRTIO_NET_F_CTRL_GUEST_OFFLOADS) &&
(vi->guest_offloads_capable & GUEST_OFFLOAD_GRO_HW_MASK))
dev->hw_features |= NETIF_F_GRO_HW;
...
}
Before this patch, generic_xdp_install()->dev_disable_gro_hw() printed
the "failed to disable GRO_HW!" warning and then attached the program
anyway. Now dev_xdp_attach()->dev_xdp_clear_rx_agg() returns -EOPNOTSUPP
before dev_xdp_install() is reached.
virtnet_xdp_set() already refuses native XDP on these setups:
drivers/net/virtio_net.c:virtnet_xdp_set() {
...
NL_SET_ERR_MSG_MOD(extack, "Can't set XDP while host is implementing GRO_HW/CSUM, disable GRO_HW/CSUM first");
return -EOPNOTSUPP;
...
}
So xdpgeneric was the only option left, for example for loaders that fall
back from native to SKB mode.
The refusal matches the new rule. Even so, could the commit message say
that generic XDP attaches which used to succeed are now rejected? The
check is still there at the end of the series, where it also covers LRO.
[ ... ]
> @@ -10875,19 +10900,36 @@ static int dev_xdp_attach(struct net_device *dev, struct netlink_ext_ack *extack
> return -EOPNOTSUPP;
> }
>
> + if (new_prog) {
> + dev->xdp_pending = 1;
> + err = dev_xdp_clear_rx_agg(dev, extack);
> + if (err)
> + goto err_clear_pending;
> + }
> +
> err = dev_xdp_install(dev, mode, bpf_op, extack, flags, new_prog);
> if (err)
> - return err;
> + goto err_clear_pending;
> }
[Severity: Medium]
Is it intended that the hardware gets reconfigured here before
dev_xdp_install() has validated the request?
dev_xdp_clear_rx_agg() calls netdev_update_features(), which ends up in
ndo_set_features(). These checks in dev_xdp_install() only run after
that:
- native and generic XDP active at the same time
- an offloaded program without HW_MODE
- a device-bound program on the wrong device or in SKB mode
- a BPF_XDP_DEVMAP or BPF_XDP_CPUMAP attach type
- tcp-data-split enabled with a non-frags program
- a bound memory provider
The core used to reject such requests without touching the device. Now
it turns HW-GRO off first, the request fails, and err_clear_pending calls
netdev_update_features() again to turn HW-GRO back on.
On bnxt, a GRO_HW change toggles BNXT_FLAG_TPA, so
bnxt_set_features() calls bnxt_reinit_features():
drivers/net/ethernet/broadcom/bnxt/bnxt.c:bnxt_reinit_features() {
bnxt_close_nic(bp, irq_re_init, link_re_init);
bp->flags = flags;
if (update_tpa)
bnxt_set_ring_params(bp);
return bnxt_open_nic(bp, irq_re_init, link_re_init);
}
One rejected attach therefore costs two full close/open cycles of the
NIC, memory provider queues included.
If either bnxt_open_nic() call fails, __netdev_update_features() only
logs "set_features() failed". Could that leave the device with its rings
freed while it is still IFF_UP?
netif_xdp_propagate() already runs its hds and memory provider checks
before it calls dev_xdp_clear_rx_agg(). Could dev_xdp_attach() also run
the dev_xdp_install() pre-checks before clearing rx aggregation? The
ordering is the same at the end of the series.
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261118232315.3593731-1-kuba%40kernel.org
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH net-next 4/8] net: state the "XDP excludes LRO" rule in the core
2026-11-18 23:23 [PATCH net-next 0/8] net: adjust HW GRO and LRO feature handling Jakub Kicinski
` (2 preceding siblings ...)
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 ` Jakub Kicinski
2026-11-19 23:02 ` Willem de Bruijn
2026-11-22 17:03 ` netdev-bot+sashiko
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
` (3 subsequent siblings)
7 siblings, 2 replies; 23+ messages in thread
From: Jakub Kicinski @ 2026-11-18 23:23 UTC (permalink / raw)
To: davem
Cc: netdev, edumazet, pabeni, andrew+netdev, horms, michael.chan,
manishc, joshwash, hramamurthy, tariqt, saeedm, daniel, hawk, sdf,
willemb, przemyslaw.kitszel, bpf, Jakub Kicinski
LRO is the older take on the same thing as HW-GRO. And similarly to
HW-GRO XDP cannot be handed post-LRO frames. Drivers open-code
the exclusion just like they did for HW-GRO, and disagree just the
same: mlx5 and netvsc refuse the attach, bnxt and ixgbe clear the feature
from ndo_fix_features(), vmxnet3 writes dev->features behind the core's
back, and atlantic only minds single-buffer programs. Clear LRO next to
HW-GRO, with the same ordering and the same refusal if a driver insists
on keeping it.
atlantic loses LRO under a multi-buffer program now as well. XDP_TX and
redirect can't carry the GSO metadata of a coalesced frame, however
many buffers it spans.
Drop netif_disable_lro() from generic_xdp_install(), like the previous
patch dropped dev_disable_gro_hw(). The core covers the device itself,
and LRO no longer stays off after the detach.
This changes the behavior for lower devices. netif_disable_lro() walked
them, dev_disable_gro_hw() never did. And unlike HW-GRO, LRO is in
NETIF_F_UPPER_DISABLES, an upper which loses it clears it from the
wanted_features of its lowers for good. bond and team carry LRO only to
hand it down, so a program on a bond still turns LRO off on the slaves,
and they don't get it back after the detach. Making sure lowers don't
coalesce is a separate problem, for HW-GRO and LRO alike.
LRO state with the program [attached / after it's detached], netdevsim
as the single device, bond of two vmxnet3 ports:
program on device w/o patch w/ patch
------------ ------- ----------- ---------
dev, native dev on / on `1 off / on
dev, generic dev off / off off / on
bond, native bond on / on off / on
slaves off / off`2 off / off
bond, generic bond off / off off / on
slaves off / off off / off
`1 netdevsim ignores LRO under XDP, real drivers turned it off one
way or another
`2 vmxnet3 clears LRO from dev->features by itself and nothing turns
it back on, bnxt slaves would get it back
Ideally we'd want [off / on] (XDP disables LRO, LRO comes back once
XDP is cleared). But the two "off"s after detach on slaves are not
worth the complexity IMHO.
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
include/linux/netdev_features.h | 6 ++++++
net/core/dev.c | 36 ++++++++++++++++++++-------------
2 files changed, 28 insertions(+), 14 deletions(-)
diff --git a/include/linux/netdev_features.h b/include/linux/netdev_features.h
index 8eb6b8033606..62a05df8ee68 100644
--- a/include/linux/netdev_features.h
+++ b/include/linux/netdev_features.h
@@ -234,6 +234,12 @@ static inline int find_next_netdev_feature(u64 feature, unsigned long start)
*/
#define NETIF_F_UPPER_DISABLES NETIF_F_LRO
+/*
+ * Receive offloads which coalesce frames. XDP has to see the frames as the
+ * wire delivered them, so these are disabled while a program is attached.
+ */
+#define NETIF_F_XDP_DISABLES (NETIF_F_GRO_HW | NETIF_F_LRO)
+
/* changeable features with no special hardware requirements */
#define NETIF_F_SOFT_FEATURES (NETIF_F_GSO | NETIF_F_GRO)
diff --git a/net/core/dev.c b/net/core/dev.c
index c0bb5eb9fdea..2b9c7aac0969 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -6634,7 +6634,6 @@ static int generic_xdp_install(struct net_device *dev, struct netdev_bpf *xdp)
static_branch_dec(&generic_xdp_needed_key);
} else if (new && !old) {
static_branch_inc(&generic_xdp_needed_key);
- netif_disable_lro(dev);
}
break;
@@ -10594,26 +10593,35 @@ static void dev_xdp_set_prog(struct net_device *dev, enum bpf_xdp_mode mode,
dev->xdp_state[mode].prog = prog;
}
-/* Try to clear HW-GRO before the driver reconfigures for XDP.
+static const char *dev_xdp_rx_agg_name(netdev_features_t features)
+{
+ return features & NETIF_F_GRO_HW ? "HW-GRO" : "LRO";
+}
+
+/* Try to clear HW-GRO and LRO before the driver reconfigures for XDP.
* Driver may add features back in via ndo_fix_features(), due to feature
* dependencies. In that case we can't run XDP at all.
*/
static int dev_xdp_clear_rx_agg(struct net_device *dev,
struct netlink_ext_ack *extack)
{
- if (!(dev->features & NETIF_F_GRO_HW))
+ netdev_features_t agg = dev->features & NETIF_F_XDP_DISABLES;
+
+ if (!agg)
return 0;
- if (!(dev->hw_features & NETIF_F_GRO_HW)) {
- NL_SET_ERR_MSG(extack,
- "unable to disable HW-GRO, fixed on");
+ if (agg & ~dev->hw_features) {
+ NL_SET_ERR_MSG_FMT(extack, "unable to disable %s, fixed on",
+ dev_xdp_rx_agg_name(agg & ~dev->hw_features));
return -EOPNOTSUPP;
}
netdev_update_features(dev);
- if (dev->features & NETIF_F_GRO_HW) {
- NL_SET_ERR_MSG(extack,
- "unable to disable HW-GRO, required by another feature");
+ agg = dev->features & NETIF_F_XDP_DISABLES;
+ if (agg) {
+ NL_SET_ERR_MSG_FMT(extack,
+ "unable to disable %s, required by another feature",
+ dev_xdp_rx_agg_name(agg));
return -EBUSY;
}
@@ -10681,7 +10689,7 @@ int netif_xdp_propagate(struct net_device *dev, struct netdev_bpf *bpf)
if (old_prog) {
bpf_prog_put(old_prog);
- /* The last program is gone, HW-GRO may be available again */
+ /* No program left, HW-GRO and LRO may be available again */
if (!bpf->prog)
netdev_update_features(dev);
}
@@ -10919,7 +10927,7 @@ static int dev_xdp_attach(struct net_device *dev, struct netlink_ext_ack *extack
dev->xdp_pending = 0;
if (cur_prog) {
bpf_prog_put(cur_prog);
- /* The last program is gone, HW-GRO may be available again */
+ /* No program left, HW-GRO and LRO may be available again */
if (!new_prog)
netdev_update_features(dev);
}
@@ -11431,9 +11439,9 @@ int __netdev_update_features(struct net_device *dev)
/* GRO_HW may be added back in via ndo_fix_features e.g. if driver needs
* it to honor the HDS config, clear it before the fix features call.
*/
- if ((features & NETIF_F_GRO_HW) && dev_xdp_prog_count(dev)) {
- netdev_dbg(dev, "Dropping HW-GRO feature since XDP is attached.\n");
- features &= ~NETIF_F_GRO_HW;
+ if ((features & NETIF_F_XDP_DISABLES) && dev_xdp_prog_count(dev)) {
+ netdev_dbg(dev, "Dropping HW-GRO and LRO features since XDP is attached.\n");
+ features &= ~NETIF_F_XDP_DISABLES;
}
if (dev->netdev_ops->ndo_fix_features)
--
2.56.1
^ permalink raw reply related [flat|nested] 23+ messages in thread* Re: [PATCH net-next 4/8] net: state the "XDP excludes LRO" rule in the core
2026-11-18 23:23 ` [PATCH net-next 4/8] net: state the "XDP excludes LRO" " Jakub Kicinski
@ 2026-11-19 23:02 ` Willem de Bruijn
2026-11-22 17:03 ` netdev-bot+sashiko
1 sibling, 0 replies; 23+ messages in thread
From: Willem de Bruijn @ 2026-11-19 23:02 UTC (permalink / raw)
To: Jakub Kicinski, davem
Cc: netdev, edumazet, pabeni, andrew+netdev, horms, michael.chan,
manishc, joshwash, hramamurthy, tariqt, saeedm, daniel, hawk, sdf,
willemb, przemyslaw.kitszel, bpf, Jakub Kicinski
Jakub Kicinski wrote:
> LRO is the older take on the same thing as HW-GRO. And similarly to
> HW-GRO XDP cannot be handed post-LRO frames. Drivers open-code
> the exclusion just like they did for HW-GRO, and disagree just the
> same: mlx5 and netvsc refuse the attach, bnxt and ixgbe clear the feature
> from ndo_fix_features(), vmxnet3 writes dev->features behind the core's
> back, and atlantic only minds single-buffer programs. Clear LRO next to
> HW-GRO, with the same ordering and the same refusal if a driver insists
> on keeping it.
>
> atlantic loses LRO under a multi-buffer program now as well. XDP_TX and
> redirect can't carry the GSO metadata of a coalesced frame, however
> many buffers it spans.
>
> Drop netif_disable_lro() from generic_xdp_install(), like the previous
> patch dropped dev_disable_gro_hw(). The core covers the device itself,
> and LRO no longer stays off after the detach.
>
> This changes the behavior for lower devices. netif_disable_lro() walked
> them, dev_disable_gro_hw() never did. And unlike HW-GRO, LRO is in
> NETIF_F_UPPER_DISABLES, an upper which loses it clears it from the
> wanted_features of its lowers for good. bond and team carry LRO only to
> hand it down, so a program on a bond still turns LRO off on the slaves,
> and they don't get it back after the detach. Making sure lowers don't
> coalesce is a separate problem, for HW-GRO and LRO alike.
>
> LRO state with the program [attached / after it's detached], netdevsim
> as the single device, bond of two vmxnet3 ports:
>
> program on device w/o patch w/ patch
> ------------ ------- ----------- ---------
> dev, native dev on / on `1 off / on
> dev, generic dev off / off off / on
> bond, native bond on / on off / on
> slaves off / off`2 off / off
> bond, generic bond off / off off / on
> slaves off / off off / off
>
> `1 netdevsim ignores LRO under XDP, real drivers turned it off one
> way or another
> `2 vmxnet3 clears LRO from dev->features by itself and nothing turns
> it back on, bnxt slaves would get it back
>
> Ideally we'd want [off / on] (XDP disables LRO, LRO comes back once
> XDP is cleared). But the two "off"s after detach on slaves are not
> worth the complexity IMHO.
>
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Reviewed-by: Willem de Bruijn <willemb@google.com>
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH net-next 4/8] net: state the "XDP excludes LRO" rule in the core
2026-11-18 23:23 ` [PATCH net-next 4/8] net: state the "XDP excludes LRO" " Jakub Kicinski
2026-11-19 23:02 ` Willem de Bruijn
@ 2026-11-22 17:03 ` netdev-bot+sashiko
1 sibling, 0 replies; 23+ messages in thread
From: netdev-bot+sashiko @ 2026-11-22 17:03 UTC (permalink / raw)
To: kuba
Cc: davem, netdev, edumazet, pabeni, andrew+netdev, horms,
michael.chan, manishc, joshwash, hramamurthy, tariqt, saeedm,
daniel, hawk, sdf, willemb, przemyslaw.kitszel, bpf
Thank you for your contribution! Sashiko AI review found 4 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 3
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] A failed XDP attach now permanently turns LRO off on the
lowers of an upper device such as a bond.
- [Low] The netvsc documentation still tells users to disable LRO by hand
before attaching XDP: "XDP program cannot run with LRO (RSC) enabled,…
- [Low] The atlantic driver still encodes the old rule that LRO conflicts
only with single-buffer XDP.
- [Low] The comment above the XDP feature clearing in
__netdev_update_features() (net/core/dev.c:11439-11441) still covers…
--
net: state the "XDP excludes LRO" rule in the core
This commit adds NETIF_F_XDP_DISABLES (GRO_HW | LRO). With it, the core
clears LRO next to HW-GRO when an XDP program is attached, and refuses the
attach if the driver keeps LRO on. It also drops netif_disable_lro() from
generic_xdp_install(), so LRO comes back on the device after detach.
> diff --git a/include/linux/netdev_features.h b/include/linux/netdev_features.h
> index 8eb6b80336065..62a05df8ee686 100644
> --- a/include/linux/netdev_features.h
> +++ b/include/linux/netdev_features.h
> @@ -234,6 +234,12 @@ static inline int find_next_netdev_feature(u64 feature, unsigned long start)
> */
> #define NETIF_F_UPPER_DISABLES NETIF_F_LRO
>
> +/*
> + * Receive offloads which coalesce frames. XDP has to see the frames as the
> + * wire delivered them, so these are disabled while a program is attached.
> + */
> +#define NETIF_F_XDP_DISABLES (NETIF_F_GRO_HW | NETIF_F_LRO)
[Severity: Low]
The commit message says atlantic now loses LRO under multi-buffer programs
too. Should the atlantic driver be updated to match? It still has the
single-buffer-only rule:
drivers/net/ethernet/aquantia/atlantic/aq_main.c:aq_ndev_fix_features() {
...
prog = READ_ONCE(aq_nic->xdp_prog);
if (prog && !prog->aux->xdp_has_frags &&
aq_nic->xdp_prog && features & NETIF_F_LRO) {
netdev_err(ndev, "LRO is not supported with single buffer XDP, disabling\n");
features &= ~NETIF_F_LRO;
}
...
}
__netdev_update_features() now removes LRO before ndo_fix_features()
whenever dev_xdp_prog_count() is non-zero. That makes this branch dead.
aq_xdp_setup() also still writes ndev->features directly:
if (prog && ndev->features & NETIF_F_LRO) {
netdev_err(ndev,
"LRO is not supported with single buffer XDP, disabling\n");
ndev->features &= ~NETIF_F_LRO;
}
This check can no longer be true, because the core cleared LRO with
xdp_pending set before ndo_bpf runs.
Later patches in the series remove similar handling from mlx5, bnxt, qede
and gve. Nothing in the series touches drivers/net/ethernet/aquantia/.
[Severity: Low]
Documentation/networking/device_drivers/ethernet/microsoft/netvsc.rst
still says:
XDP program cannot run with LRO (RSC) enabled, so you need to disable LRO
before running XDP::
ethtool -K eth0 lro off
Should this text be updated? netvsc puts NETIF_F_LRO in hw_features when
the host supports RSC. So dev_xdp_clear_rx_agg() now clears LRO before
netvsc_bpf()->netvsc_xdp_set() runs. The "XDP: not support LRO" refusal in
netvsc_xdp_set() can no longer be reached from the core attach paths.
The document also doesn't say that LRO now comes back when the program is
detached.
> +
> /* changeable features with no special hardware requirements */
> #define NETIF_F_SOFT_FEATURES (NETIF_F_GSO | NETIF_F_GRO)
>
> diff --git a/net/core/dev.c b/net/core/dev.c
> index c0bb5eb9fdea0..2b9c7aac09693 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
[ ... ]
> @@ -10594,26 +10593,35 @@ static void dev_xdp_set_prog(struct net_device *dev, enum bpf_xdp_mode mode,
[ ... ]
> static int dev_xdp_clear_rx_agg(struct net_device *dev,
> struct netlink_ext_ack *extack)
> {
> - if (!(dev->features & NETIF_F_GRO_HW))
> + netdev_features_t agg = dev->features & NETIF_F_XDP_DISABLES;
> +
> + if (!agg)
> return 0;
> - if (!(dev->hw_features & NETIF_F_GRO_HW)) {
> - NL_SET_ERR_MSG(extack,
> - "unable to disable HW-GRO, fixed on");
> + if (agg & ~dev->hw_features) {
> + NL_SET_ERR_MSG_FMT(extack, "unable to disable %s, fixed on",
> + dev_xdp_rx_agg_name(agg & ~dev->hw_features));
> return -EOPNOTSUPP;
> }
>
> netdev_update_features(dev);
[Severity: Medium]
Now that LRO is in NETIF_F_XDP_DISABLES, can a rejected XDP attach leave
LRO off for good on the lowers of an upper device such as a bond?
dev_xdp_attach() sets xdp_pending and calls dev_xdp_clear_rx_agg() before
anything has had a chance to reject the program. Two sets of checks run
after it:
- the checks in dev_xdp_install(): BPF_XDP_DEVMAP/CPUMAP attach type,
device-bound mismatch, tcp-data-split, memory provider
- the driver's ndo_bpf
A bond has LRO in hw_features and in features by default. LRO is also in
NETIF_F_UPPER_DISABLES. So this netdev_update_features() call reaches the
following for every slave:
__netdev_update_features(bond)
netdev_sync_lower_features(bond, slave, features)
lower->wanted_features &= ~feature;
__netdev_update_features(lower);
bond_xdp_set() can then reject the program. One example:
if (!bond_xdp_check(bond, BOND_MODE(bond))) {
BOND_NL_ERR(dev, extack,
"No native XDP support for the current bonding mode");
return -EOPNOTSUPP;
}
Another is the "Slave device does not support XDP" error. In both cases
dev_xdp_attach() only does this:
err_clear_pending:
dev->xdp_pending = 0;
netdev_update_features(dev);
The bond gets LRO back from its own wanted_features. Nothing in net/core,
bonding or team puts LRO back into the slaves' wanted_features, and each
slave has already gone through an ndo_set_features() reconfiguration.
netif_xdp_propagate() clears and rolls back the same way when the lower
has lowers of its own.
Before this patch, GRO_HW was not in NETIF_F_UPPER_DISABLES.
netif_disable_lro() only ran from generic_xdp_install(), after all of the
dev_xdp_install() checks had passed.
The commit message covers slaves losing LRO after a successful attach and
detach, but not after a failed attach. Should that case be mentioned too,
or could clearing LRO on the lowers wait until the attach is known to
succeed?
[ ... ]
> @@ -11431,9 +11439,9 @@ int __netdev_update_features(struct net_device *dev)
> /* GRO_HW may be added back in via ndo_fix_features e.g. if driver needs
> * it to honor the HDS config, clear it before the fix features call.
> */
> - if ((features & NETIF_F_GRO_HW) && dev_xdp_prog_count(dev)) {
> - netdev_dbg(dev, "Dropping HW-GRO feature since XDP is attached.\n");
> - features &= ~NETIF_F_GRO_HW;
> + if ((features & NETIF_F_XDP_DISABLES) && dev_xdp_prog_count(dev)) {
> + netdev_dbg(dev, "Dropping HW-GRO and LRO features since XDP is attached.\n");
> + features &= ~NETIF_F_XDP_DISABLES;
> }
[Severity: Low]
This isn't a bug, but the comment above still only mentions GRO_HW. The
code under it now clears all of NETIF_F_XDP_DISABLES (GRO_HW and LRO).
This patch updated the matching comments in dev_xdp_clear_rx_agg(),
netif_xdp_propagate() and dev_xdp_attach(). Should this one be updated as
well?
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261118232315.3593731-1-kuba%40kernel.org
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH net-next 5/8] eth: mlx5e: drop the now-dead HW-GRO and LRO vs XDP handling
2026-11-18 23:23 [PATCH net-next 0/8] net: adjust HW GRO and LRO feature handling Jakub Kicinski
` (3 preceding siblings ...)
2026-11-18 23:23 ` [PATCH net-next 4/8] net: state the "XDP excludes LRO" " Jakub Kicinski
@ 2026-11-18 23:23 ` Jakub Kicinski
2026-11-19 15:42 ` Dragos Tatulea
2026-11-22 17:03 ` netdev-bot+sashiko
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
` (2 subsequent siblings)
7 siblings, 2 replies; 23+ messages in thread
From: Jakub Kicinski @ 2026-11-18 23:23 UTC (permalink / raw)
To: davem
Cc: netdev, edumazet, pabeni, andrew+netdev, horms, michael.chan,
manishc, joshwash, hramamurthy, tariqt, saeedm, daniel, hawk, sdf,
willemb, przemyslaw.kitszel, bpf, Jakub Kicinski
The core clears HW-GRO and LRO before ndo_bpf runs and keeps them off
for as long as a program is attached. mlx5e_fix_features() never sees
either with params->xdp_prog set, and packet merge is always off by the
time mlx5e_xdp_set() gets called, packet_merge.type only follows the two
feature handlers. If tcp-data-split keeps HW-GRO on, the core refuses
the attach with -EBUSY before calling the driver.
The AF_XDP check stays, the core doesn't know about XSK pools.
This does change user visible behavior: attaching XDP with HW-GRO or LRO
on used to fail with -EINVAL and now succeeds with them turned off.
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
.../net/ethernet/mellanox/mlx5/core/en_main.c | 32 ++-----------------
1 file changed, 3 insertions(+), 29 deletions(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
index d8563f863844..e462dfc725ae 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
@@ -4585,17 +4585,6 @@ static netdev_features_t mlx5e_fix_features(struct net_device *netdev,
}
}
- if (params->xdp_prog) {
- if (features & NETIF_F_LRO) {
- netdev_warn(netdev, "LRO is incompatible with XDP\n");
- features &= ~NETIF_F_LRO;
- }
- if (features & NETIF_F_GRO_HW) {
- netdev_warn(netdev, "HW GRO is incompatible with XDP\n");
- features &= ~NETIF_F_GRO_HW;
- }
- }
-
if (priv->xsk.refcnt) {
if (features & NETIF_F_LRO) {
netdev_warn(netdev, "LRO is incompatible with AF_XDP (%u XSKs are active)\n",
@@ -5177,20 +5166,6 @@ static void mlx5e_tx_timeout(struct net_device *dev, unsigned int txqueue)
queue_work(priv->wq, &priv->tx_timeout_work);
}
-static int mlx5e_xdp_allowed(struct net_device *netdev, struct mlx5_core_dev *mdev,
- struct mlx5e_params *params)
-{
- if (params->packet_merge.type != MLX5E_PACKET_MERGE_NONE) {
- netdev_warn(netdev, "can't set XDP while HW-GRO/LRO is on, disable them first\n");
- return -EINVAL;
- }
-
- if (!mlx5e_params_validate_xdp(netdev, mdev, params))
- return -EINVAL;
-
- return 0;
-}
-
static void mlx5e_rq_replace_xdp_prog(struct mlx5e_rq *rq, struct bpf_prog *prog)
{
struct bpf_prog *old_prog;
@@ -5215,10 +5190,9 @@ static int mlx5e_xdp_set(struct net_device *netdev, struct bpf_prog *prog)
new_params = priv->channels.params;
new_params.xdp_prog = prog;
- if (prog) {
- err = mlx5e_xdp_allowed(netdev, priv->mdev, &new_params);
- if (err)
- goto unlock;
+ if (prog && !mlx5e_params_validate_xdp(netdev, priv->mdev, &new_params)) {
+ err = -EINVAL;
+ goto unlock;
}
/* no need for full reset when exchanging programs */
--
2.56.1
^ permalink raw reply related [flat|nested] 23+ messages in thread* Re: [PATCH net-next 5/8] eth: mlx5e: drop the now-dead HW-GRO and LRO vs XDP handling
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-22 17:03 ` netdev-bot+sashiko
1 sibling, 0 replies; 23+ messages in thread
From: Dragos Tatulea @ 2026-11-19 15:42 UTC (permalink / raw)
To: Jakub Kicinski, davem
Cc: netdev, edumazet, pabeni, andrew+netdev, horms, michael.chan,
manishc, joshwash, hramamurthy, tariqt, saeedm, daniel, hawk, sdf,
willemb, przemyslaw.kitszel, bpf
On 19.11.26 00:23, Jakub Kicinski wrote:
> The core clears HW-GRO and LRO before ndo_bpf runs and keeps them off
> for as long as a program is attached. mlx5e_fix_features() never sees
> either with params->xdp_prog set, and packet merge is always off by the
> time mlx5e_xdp_set() gets called, packet_merge.type only follows the two
> feature handlers. If tcp-data-split keeps HW-GRO on, the core refuses
> the attach with -EBUSY before calling the driver.
>
> The AF_XDP check stays, the core doesn't know about XSK pools.
>
> This does change user visible behavior: attaching XDP with HW-GRO or LRO
> on used to fail with -EINVAL and now succeeds with them turned off.
>
Thanks for the cleanup!
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
> ---
> .../net/ethernet/mellanox/mlx5/core/en_main.c | 32 ++-----------------
> 1 file changed, 3 insertions(+), 29 deletions(-)
>
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
> index d8563f863844..e462dfc725ae 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
> @@ -4585,17 +4585,6 @@ static netdev_features_t mlx5e_fix_features(struct net_device *netdev,
> }
> }
>
> - if (params->xdp_prog) {
> - if (features & NETIF_F_LRO) {
> - netdev_warn(netdev, "LRO is incompatible with XDP\n");
> - features &= ~NETIF_F_LRO;
> - }
> - if (features & NETIF_F_GRO_HW) {
> - netdev_warn(netdev, "HW GRO is incompatible with XDP\n");
> - features &= ~NETIF_F_GRO_HW;
> - }
> - }
> -
> if (priv->xsk.refcnt) {
> if (features & NETIF_F_LRO) {
> netdev_warn(netdev, "LRO is incompatible with AF_XDP (%u XSKs are active)\n",
> @@ -5177,20 +5166,6 @@ static void mlx5e_tx_timeout(struct net_device *dev, unsigned int txqueue)
> queue_work(priv->wq, &priv->tx_timeout_work);
> }
>
> -static int mlx5e_xdp_allowed(struct net_device *netdev, struct mlx5_core_dev *mdev,
> - struct mlx5e_params *params)
> -{
> - if (params->packet_merge.type != MLX5E_PACKET_MERGE_NONE) {
> - netdev_warn(netdev, "can't set XDP while HW-GRO/LRO is on, disable them first\n");
> - return -EINVAL;
> - }
> -
> - if (!mlx5e_params_validate_xdp(netdev, mdev, params))
> - return -EINVAL;
> -
> - return 0;
> -}
> -
> static void mlx5e_rq_replace_xdp_prog(struct mlx5e_rq *rq, struct bpf_prog *prog)
> {
> struct bpf_prog *old_prog;
> @@ -5215,10 +5190,9 @@ static int mlx5e_xdp_set(struct net_device *netdev, struct bpf_prog *prog)
> new_params = priv->channels.params;
> new_params.xdp_prog = prog;
>
> - if (prog) {
> - err = mlx5e_xdp_allowed(netdev, priv->mdev, &new_params);
> - if (err)
> - goto unlock;
> + if (prog && !mlx5e_params_validate_xdp(netdev, priv->mdev, &new_params)) {
> + err = -EINVAL;
> + goto unlock;
> }
>
> /* no need for full reset when exchanging programs */
There's a netdev_update_features() at the end of mlx5e_xdp_set(). It
doesn't seem necessary anyore.
Also, there's a check left in mlx5e_set_xdp_feature().
Thanks,
Dragos
^ permalink raw reply [flat|nested] 23+ messages in thread* Re: [PATCH net-next 5/8] eth: mlx5e: drop the now-dead HW-GRO and LRO vs XDP handling
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-22 17:03 ` netdev-bot+sashiko
1 sibling, 0 replies; 23+ messages in thread
From: netdev-bot+sashiko @ 2026-11-22 17:03 UTC (permalink / raw)
To: kuba
Cc: davem, netdev, edumazet, pabeni, andrew+netdev, horms,
michael.chan, manishc, joshwash, hramamurthy, tariqt, saeedm,
daniel, hawk, sdf, willemb, przemyslaw.kitszel, bpf
Thank you for your contribution! Sashiko AI review found 3 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 2
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] mlx5e_set_xdp_feature() in
drivers/net/ethernet/mellanox/mlx5/core/en_main.c still sets…
- [Low] The commit message calls the removed code 'now-dead' and then
says 'This does change user visible behavior: attaching XDP with HW-…
- [Low] mlx5e_xdp_set() still ends with '/* Need to fix some features.
--
eth: mlx5e: drop the now-dead HW-GRO and LRO vs XDP handling
The core now clears HW-GRO and LRO before ndo_bpf and keeps them off
while an XDP program is attached. This patch removes the xdp_prog clause
from mlx5e_fix_features() and the packet_merge refusal in
mlx5e_xdp_allowed(), and calls mlx5e_params_validate_xdp() directly from
mlx5e_xdp_set().
> This does change user visible behavior: attaching XDP with HW-GRO or LRO
> on used to fail with -EINVAL and now succeeds with them turned off.
[Severity: Low]
Is this attribution accurate? The subject calls the removed code
"now-dead". At the parent commit, the -EINVAL in mlx5e_xdp_allowed()
already looks unreachable:
dev_xdp_attach()
dev->xdp_pending = 1;
dev_xdp_clear_rx_agg()
netdev_update_features()
__netdev_update_features()
strips NETIF_F_XDP_DISABLES (xdp_pending is counted
by dev_xdp_prog_count())
mlx5e_set_features()
set_feature_lro() / set_feature_hw_gro()
packet_merge.type = MLX5E_PACKET_MERGE_NONE
ndo_bpf -> mlx5e_xdp_set()
netif_xdp_propagate() follows the same sequence. When HW-GRO is pinned,
the core returns -EBUSY before ndo_bpf is called.
So the change from -EINVAL to success seems to come from the earlier core
commits ("net: state the "XDP excludes HW-GRO" rule in the core" and
"net: state the "XDP excludes LRO" rule in the core"), not from this
patch.
Could the message say that, and also mention the dependency in the other
direction? This patch removes both mlx5e guards: the xdp_prog clause in
mlx5e_fix_features() and the packet_merge refusal. If it is applied or
backported without the core commits, XDP could run on LRO/HW-GRO
coalesced frames.
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
> index d8563f8638447..e462dfc725ae4 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_main.c
[ ... ]
> @@ -5177,20 +5166,6 @@ static void mlx5e_tx_timeout(struct net_device *dev, unsigned int txqueue)
> queue_work(priv->wq, &priv->tx_timeout_work);
> }
>
> -static int mlx5e_xdp_allowed(struct net_device *netdev, struct mlx5_core_dev *mdev,
> - struct mlx5e_params *params)
> -{
> - if (params->packet_merge.type != MLX5E_PACKET_MERGE_NONE) {
> - netdev_warn(netdev, "can't set XDP while HW-GRO/LRO is on, disable them first\n");
> - return -EINVAL;
> - }
[Severity: Medium]
With this refusal gone, does mlx5e_set_xdp_feature() also need an
update? It still advertises native XDP only when packet merge is off:
drivers/net/ethernet/mellanox/mlx5/core/en_main.c:mlx5e_set_xdp_feature() {
...
if (netdev->netdev_ops->ndo_bpf &&
params->packet_merge.type == MLX5E_PACKET_MERGE_NONE)
val = NETDEV_XDP_ACT_BASIC | NETDEV_XDP_ACT_REDIRECT |
NETDEV_XDP_ACT_XSK_ZEROCOPY |
NETDEV_XDP_ACT_RX_SG;
...
}
With LRO or HW-GRO on and no program attached, the netdev netlink
xdp-features attribute reports no BASIC, REDIRECT or RX_SG. A native
attach in that state now succeeds anyway:
dev_xdp_attach()->dev_xdp_clear_rx_agg() turns the offloads off before
ndo_bpf, and xdp_features is never checked.
Userspace would then see no XDP support on a device where attaching an
XDP program works. The same goes for bond_xdp_set_features(), which
intersects the slave xdp_features. After detach, the core turns
LRO/HW-GRO back on and the advertised mask is empty again.
The empty mask only looks correct when tcp-data-split pins HW-GRO, since
the core returns -EBUSY there. Would it match the new behavior better to
key this gate off the HDS state instead of packet_merge in general?
> -
> - if (!mlx5e_params_validate_xdp(netdev, mdev, params))
> - return -EINVAL;
> -
> - return 0;
> -}
> -
> static void mlx5e_rq_replace_xdp_prog(struct mlx5e_rq *rq, struct bpf_prog *prog)
> {
> struct bpf_prog *old_prog;
> @@ -5215,10 +5190,9 @@ static int mlx5e_xdp_set(struct net_device *netdev, struct bpf_prog *prog)
> new_params = priv->channels.params;
> new_params.xdp_prog = prog;
>
> - if (prog) {
> - err = mlx5e_xdp_allowed(netdev, priv->mdev, &new_params);
> - if (err)
> - goto unlock;
> + if (prog && !mlx5e_params_validate_xdp(netdev, priv->mdev, &new_params)) {
> + err = -EINVAL;
> + goto unlock;
> }
>
> /* no need for full reset when exchanging programs */
[Severity: Low]
This isn't a bug, but should the tail of mlx5e_xdp_set() be removed as
well?
unlock:
mutex_unlock(&priv->state_lock);
/* Need to fix some features. */
if (!err)
netdev_update_features(netdev);
Commit f6279f113ad5 ("net/mlx5e: Update netdev features after changing
XDP state") added this call so mlx5e_fix_features() could apply or
release the params->xdp_prog LRO/HW-GRO clause. This patch removes that
clause.
On attach, the core has already called netdev_update_features() via
dev_xdp_clear_rx_agg().
On detach, this call runs while dev_xdp_prog_count() is still non-zero,
because dev_xdp_set_prog() only runs after dev_xdp_install() returns. So
it cannot restore LRO/HW-GRO. That happens in the core's own
netdev_update_features() call in dev_xdp_attach(), after the program is
cleared.
The comment also suggests a dependency that no longer exists.
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261118232315.3593731-1-kuba%40kernel.org
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH net-next 6/8] eth: bnxt_en: don't clear HW-GRO and LRO for XDP in ndo_fix_features
2026-11-18 23:23 [PATCH net-next 0/8] net: adjust HW GRO and LRO feature handling Jakub Kicinski
` (4 preceding siblings ...)
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-18 23:23 ` 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
7 siblings, 0 replies; 23+ messages in thread
From: Jakub Kicinski @ 2026-11-18 23:23 UTC (permalink / raw)
To: davem
Cc: netdev, edumazet, pabeni, andrew+netdev, horms, michael.chan,
manishc, joshwash, hramamurthy, tariqt, saeedm, daniel, hawk, sdf,
willemb, przemyslaw.kitszel, bpf, Jakub Kicinski
The core keeps HW-GRO and LRO off while a program is attached, from
before ndo_bpf is called until it's gone. The xdp_prog check in
bnxt_fix_features() never changes the outcome any more. Without agg
rings, which single-buffer XDP at a small MTU implies, neither offload
works, so that part stays.
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
drivers/net/ethernet/broadcom/bnxt/bnxt.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
index 27c53db2c9e4..a5d22198aa11 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
@@ -14089,7 +14089,7 @@ static netdev_features_t bnxt_fix_features(struct net_device *dev,
bp->tx_ring_size < 2 * BNXT_SW_USO_MAX_DESCS)
features &= ~NETIF_F_GSO_UDP_L4;
- if ((bp->flags & BNXT_FLAG_NO_AGG_RINGS) || bp->xdp_prog)
+ if (bp->flags & BNXT_FLAG_NO_AGG_RINGS)
features &= ~(NETIF_F_LRO | NETIF_F_GRO_HW);
if (features & NETIF_F_GRO_HW)
--
2.56.1
^ permalink raw reply related [flat|nested] 23+ messages in thread* [PATCH net-next 7/8] eth: qede: drop the now-dead HW-GRO vs XDP handling
2026-11-18 23:23 [PATCH net-next 0/8] net: adjust HW GRO and LRO feature handling Jakub Kicinski
` (5 preceding siblings ...)
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 ` Jakub Kicinski
2026-11-22 17:03 ` netdev-bot+sashiko
2026-11-18 23:23 ` [PATCH net-next 8/8] eth: gve: drop the now-dead HW-GRO vs XDP interlock Jakub Kicinski
7 siblings, 1 reply; 23+ messages in thread
From: Jakub Kicinski @ 2026-11-18 23:23 UTC (permalink / raw)
To: davem
Cc: netdev, edumazet, pabeni, andrew+netdev, horms, michael.chan,
manishc, joshwash, hramamurthy, tariqt, saeedm, daniel, hawk, sdf,
willemb, przemyslaw.kitszel, bpf, Jakub Kicinski
The core clears HW-GRO before ndo_bpf runs and keeps it off for as long
as a program is attached, which makes three bits of qede dead:
- the xdp_prog check in qede_fix_features();
- qede_alloc_mem_rxq() clearing NETIF_F_GRO_HW from dev->features
directly, the feature is already off by the time the reload for
the program allocates the rings;
- qede_set_features() skipping the reload when a program is attached,
HW-GRO can't change while edev->xdp_prog is set any more.
The direct write in qede_alloc_mem_rxq() is also why HW-GRO used to
stay off after the program was removed - nothing recomputed the
features. The core does that on detach now.
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
drivers/net/ethernet/qlogic/qede/qede_filter.c | 11 ++---------
drivers/net/ethernet/qlogic/qede/qede_main.c | 1 -
2 files changed, 2 insertions(+), 10 deletions(-)
diff --git a/drivers/net/ethernet/qlogic/qede/qede_filter.c b/drivers/net/ethernet/qlogic/qede/qede_filter.c
index d0e203167e35..9c68579c5b33 100644
--- a/drivers/net/ethernet/qlogic/qede/qede_filter.c
+++ b/drivers/net/ethernet/qlogic/qede/qede_filter.c
@@ -915,7 +915,7 @@ netdev_features_t qede_fix_features(struct net_device *dev,
{
struct qede_dev *edev = netdev_priv(dev);
- if (edev->xdp_prog || edev->ndev->mtu > PAGE_SIZE)
+ if (edev->ndev->mtu > PAGE_SIZE)
features &= ~NETIF_F_GRO_HW;
return features;
@@ -936,15 +936,8 @@ int qede_set_features(struct net_device *dev, netdev_features_t features)
args.u.features = features;
args.func = &qede_set_features_reload;
- /* Make sure that we definitely need to reload.
- * In case of an eBPF attached program, there will be no FW
- * aggregations, so no need to actually reload.
- */
__qede_lock(edev);
- if (edev->xdp_prog)
- args.func(edev, &args);
- else
- qede_reload(edev, &args, true);
+ qede_reload(edev, &args, true);
__qede_unlock(edev);
return 1;
diff --git a/drivers/net/ethernet/qlogic/qede/qede_main.c b/drivers/net/ethernet/qlogic/qede/qede_main.c
index 7ed17faced54..b24baf0e808e 100644
--- a/drivers/net/ethernet/qlogic/qede/qede_main.c
+++ b/drivers/net/ethernet/qlogic/qede/qede_main.c
@@ -1571,7 +1571,6 @@ static int qede_alloc_mem_rxq(struct qede_dev *edev, struct qede_rx_queue *rxq)
rxq->rx_buf_seg_size = roundup_pow_of_two(size);
} else {
rxq->rx_buf_seg_size = PAGE_SIZE;
- edev->ndev->features &= ~NETIF_F_GRO_HW;
}
/* Allocate the parallel driver ring for Rx buffers */
--
2.56.1
^ permalink raw reply related [flat|nested] 23+ messages in thread* Re: [PATCH net-next 7/8] eth: qede: drop the now-dead HW-GRO vs XDP handling
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-22 17:03 ` netdev-bot+sashiko
0 siblings, 0 replies; 23+ messages in thread
From: netdev-bot+sashiko @ 2026-11-22 17:03 UTC (permalink / raw)
To: kuba
Cc: davem, netdev, edumazet, pabeni, andrew+netdev, horms,
michael.chan, manishc, joshwash, hramamurthy, tariqt, saeedm,
daniel, hawk, sdf, willemb, przemyslaw.kitszel, bpf
Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.
Critical: 0 · High: 1 · Medium: 0 · 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).
- [High] The commit message says the `edev->ndev->features &=
~NETIF_F_GRO_HW` line in the XDP branch of qede_alloc_mem_rxq() is…
--
eth: qede: drop the now-dead HW-GRO vs XDP handling
This commit removes the qede driver's own handling of the HW-GRO vs XDP
interaction. It relies on the core to clear NETIF_F_GRO_HW before
ndo_bpf runs and to keep it off while a program is attached. It drops
the xdp_prog check in qede_fix_features(), the reload skip in
qede_set_features(), and the direct dev->features write in
qede_alloc_mem_rxq().
> diff --git a/drivers/net/ethernet/qlogic/qede/qede_main.c b/drivers/net/ethernet/qlogic/qede/qede_main.c
> index 7ed17faced542..b24baf0e808e1 100644
> --- a/drivers/net/ethernet/qlogic/qede/qede_main.c
> +++ b/drivers/net/ethernet/qlogic/qede/qede_main.c
> @@ -1571,7 +1571,6 @@ static int qede_alloc_mem_rxq(struct qede_dev *edev, struct qede_rx_queue *rxq)
> rxq->rx_buf_seg_size = roundup_pow_of_two(size);
> } else {
> rxq->rx_buf_seg_size = PAGE_SIZE;
> - edev->ndev->features &= ~NETIF_F_GRO_HW;
> }
[Severity: High]
Is this line really dead? The commit message says:
the feature is already off by the time the reload for the program
allocates the rings;
That is true for the ndo_bpf path. The firmware error recovery path,
though, seems to reach this else branch with GRO_HW set in dev->features
while edev->xdp_prog is still attached:
qede_sp_task()
qede_recovery_handler()
qede_unload(edev, QEDE_UNLOAD_RECOVERY, true)
__qede_remove(edev->pdev, QEDE_REMOVE_RECOVERY)
__qede_probe(..., QEDE_PROBE_RECOVERY)
qede_init_ndev()
qede_load(edev, QEDE_LOAD_RECOVERY, true)
...
qede_alloc_mem_rxq()
In recovery mode, edev and edev->xdp_prog are kept. However,
qede_init_ndev() writes dev->features directly:
hw_features = NETIF_F_GRO | NETIF_F_GRO_HW | NETIF_F_SG |
...
ndev->features = hw_features | NETIF_F_RXHASH | NETIF_F_RXCSUM |
Nothing on this path calls netdev_update_features(), so the core never
gets a chance to strip GRO_HW again.
With the clear gone, the end of qede_alloc_mem_rxq() then computes:
edev->gro_disable = !(edev->ndev->features & NETIF_F_GRO_HW);
if (!edev->gro_disable)
qede_set_tpa_param(rxq);
qede_start_queues() then sets start.gro_enable = !edev->gro_disable,
so TPA is enabled in firmware while XDP is attached.
In qede_rx_process_cqe(), TPA CQEs return before the XDP hook runs:
/* Handle TPA cqes */
if (cqe_type != ETH_RX_CQE_TYPE_REGULAR)
return qede_rx_process_tpa_cqe(edev, fp, rxq, cqe, cqe_type);
...
/* Run eBPF program if one is attached */
if (xdp_prog)
After a recovery with XDP attached and the interface up, would
aggregated TCP traffic skip the attached program, so its XDP_DROP or
XDP_REDIRECT decisions are never applied? dev->features would also show
HW-GRO as on. This would last until something unrelated calls
netdev_update_features().
Would it be better to keep an XDP-aware check when computing
gro_disable, for example edev->xdp_prog || !(features & NETIF_F_GRO_HW)?
Other options would be to stop qede_init_ndev() from overwriting
dev->features on the recovery probe, or to call netdev_update_features()
once recovery completes.
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261118232315.3593731-1-kuba%40kernel.org
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH net-next 8/8] eth: gve: drop the now-dead HW-GRO vs XDP interlock
2026-11-18 23:23 [PATCH net-next 0/8] net: adjust HW GRO and LRO feature handling Jakub Kicinski
` (6 preceding siblings ...)
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 ` Jakub Kicinski
2026-11-18 23:44 ` Ankit Garg
` (2 more replies)
7 siblings, 3 replies; 23+ messages in thread
From: Jakub Kicinski @ 2026-11-18 23:23 UTC (permalink / raw)
To: davem
Cc: netdev, edumazet, pabeni, andrew+netdev, horms, michael.chan,
manishc, joshwash, hramamurthy, tariqt, saeedm, daniel, hawk, sdf,
willemb, przemyslaw.kitszel, bpf, Jakub Kicinski
The core clears NETIF_F_GRO_HW before ndo_bpf runs and refuses to turn
it back on while a program is attached, so neither of these can fire
any more. That holds for a program an upper device pushes down as well,
which is why this comes last - gve_verify_xdp_configuration() was the
only thing standing between a bonded gve port and XDP running with RSC
still on.
The user visible behavior changes as intended: attaching XDP to a gve
device with HW-GRO on used to fail with -EOPNOTSUPP and now succeeds
with HW-GRO turned off, which is what bnxt and qede have always done.
The header-data split refusal right below keys off
priv->header_split_enabled and stays.
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
drivers/net/ethernet/google/gve/gve_main.c | 12 ------------
1 file changed, 12 deletions(-)
diff --git a/drivers/net/ethernet/google/gve/gve_main.c b/drivers/net/ethernet/google/gve/gve_main.c
index 0ee69bc11d83..8b65b8119662 100644
--- a/drivers/net/ethernet/google/gve/gve_main.c
+++ b/drivers/net/ethernet/google/gve/gve_main.c
@@ -1798,12 +1798,6 @@ static int gve_verify_xdp_configuration(struct net_device *dev,
struct gve_priv *priv = netdev_priv(dev);
u16 max_xdp_mtu;
- if (dev->features & NETIF_F_GRO_HW) {
- NL_SET_ERR_MSG_MOD(extack,
- "XDP is not supported when HW-GRO is on.");
- return -EOPNOTSUPP;
- }
-
if (priv->header_split_enabled) {
NL_SET_ERR_MSG_MOD(extack,
"XDP is not supported when header-data split is enabled.");
@@ -2212,12 +2206,6 @@ static int gve_set_features(struct net_device *netdev,
if ((netdev->features & NETIF_F_GRO_HW) !=
(features & NETIF_F_GRO_HW)) {
netdev->features ^= NETIF_F_GRO_HW;
- if (priv->xdp_prog && (netdev->features & NETIF_F_GRO_HW)) {
- netdev_warn(netdev,
- "HW-GRO is not supported when XDP is on.");
- err = -EOPNOTSUPP;
- goto revert_features;
- }
if (netif_running(netdev)) {
err = gve_adjust_config(priv, &tx_alloc_cfg, &rx_alloc_cfg);
if (err)
--
2.56.1
^ permalink raw reply related [flat|nested] 23+ messages in thread* Re: [PATCH net-next 8/8] eth: gve: drop the now-dead HW-GRO vs XDP interlock
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
2026-11-19 22:14 ` Harshitha Ramamurthy
2026-11-22 17:03 ` netdev-bot+sashiko
2 siblings, 0 replies; 23+ messages in thread
From: Ankit Garg @ 2026-11-18 23:44 UTC (permalink / raw)
To: Jakub Kicinski
Cc: davem, netdev, edumazet, pabeni, andrew+netdev, horms,
michael.chan, manishc, joshwash, hramamurthy, tariqt, saeedm,
daniel, hawk, sdf, willemb, przemyslaw.kitszel, bpf
On Wed, Nov 18, 2026 at 3:24 PM Jakub Kicinski <kuba@kernel.org> wrote:
>
> The core clears NETIF_F_GRO_HW before ndo_bpf runs and refuses to turn
> it back on while a program is attached, so neither of these can fire
> any more. That holds for a program an upper device pushes down as well,
> which is why this comes last - gve_verify_xdp_configuration() was the
> only thing standing between a bonded gve port and XDP running with RSC
> still on.
>
> The user visible behavior changes as intended: attaching XDP to a gve
> device with HW-GRO on used to fail with -EOPNOTSUPP and now succeeds
> with HW-GRO turned off, which is what bnxt and qede have always done.
> The header-data split refusal right below keys off
> priv->header_split_enabled and stays.
>
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Reviewed-by: Ankit Garg <nktgrg@google.com>
> ---
> drivers/net/ethernet/google/gve/gve_main.c | 12 ------------
> 1 file changed, 12 deletions(-)
>
> diff --git a/drivers/net/ethernet/google/gve/gve_main.c b/drivers/net/ethernet/google/gve/gve_main.c
> index 0ee69bc11d83..8b65b8119662 100644
> --- a/drivers/net/ethernet/google/gve/gve_main.c
> +++ b/drivers/net/ethernet/google/gve/gve_main.c
> @@ -1798,12 +1798,6 @@ static int gve_verify_xdp_configuration(struct net_device *dev,
> struct gve_priv *priv = netdev_priv(dev);
> u16 max_xdp_mtu;
>
> - if (dev->features & NETIF_F_GRO_HW) {
> - NL_SET_ERR_MSG_MOD(extack,
> - "XDP is not supported when HW-GRO is on.");
> - return -EOPNOTSUPP;
> - }
> -
> if (priv->header_split_enabled) {
> NL_SET_ERR_MSG_MOD(extack,
> "XDP is not supported when header-data split is enabled.");
> @@ -2212,12 +2206,6 @@ static int gve_set_features(struct net_device *netdev,
> if ((netdev->features & NETIF_F_GRO_HW) !=
> (features & NETIF_F_GRO_HW)) {
> netdev->features ^= NETIF_F_GRO_HW;
> - if (priv->xdp_prog && (netdev->features & NETIF_F_GRO_HW)) {
> - netdev_warn(netdev,
> - "HW-GRO is not supported when XDP is on.");
> - err = -EOPNOTSUPP;
> - goto revert_features;
> - }
> if (netif_running(netdev)) {
> err = gve_adjust_config(priv, &tx_alloc_cfg, &rx_alloc_cfg);
> if (err)
> --
> 2.56.1
>
>
^ permalink raw reply [flat|nested] 23+ messages in thread* Re: [PATCH net-next 8/8] eth: gve: drop the now-dead HW-GRO vs XDP interlock
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
@ 2026-11-19 22:14 ` Harshitha Ramamurthy
2026-11-22 17:03 ` netdev-bot+sashiko
2 siblings, 0 replies; 23+ messages in thread
From: Harshitha Ramamurthy @ 2026-11-19 22:14 UTC (permalink / raw)
To: Jakub Kicinski
Cc: davem, netdev, edumazet, pabeni, andrew+netdev, horms,
michael.chan, manishc, joshwash, tariqt, saeedm, daniel, hawk,
sdf, willemb, przemyslaw.kitszel, bpf
On Wed, Nov 18, 2026 at 3:24 PM Jakub Kicinski <kuba@kernel.org> wrote:
>
> The core clears NETIF_F_GRO_HW before ndo_bpf runs and refuses to turn
> it back on while a program is attached, so neither of these can fire
> any more. That holds for a program an upper device pushes down as well,
> which is why this comes last - gve_verify_xdp_configuration() was the
> only thing standing between a bonded gve port and XDP running with RSC
> still on.
>
> The user visible behavior changes as intended: attaching XDP to a gve
> device with HW-GRO on used to fail with -EOPNOTSUPP and now succeeds
> with HW-GRO turned off, which is what bnxt and qede have always done.
> The header-data split refusal right below keys off
> priv->header_split_enabled and stays.
>
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Reviewed-by: Harshitha Ramamurthy <hramamurthy@google.com>
Thanks!
> ---
> drivers/net/ethernet/google/gve/gve_main.c | 12 ------------
> 1 file changed, 12 deletions(-)
>
> diff --git a/drivers/net/ethernet/google/gve/gve_main.c b/drivers/net/ethernet/google/gve/gve_main.c
> index 0ee69bc11d83..8b65b8119662 100644
> --- a/drivers/net/ethernet/google/gve/gve_main.c
> +++ b/drivers/net/ethernet/google/gve/gve_main.c
> @@ -1798,12 +1798,6 @@ static int gve_verify_xdp_configuration(struct net_device *dev,
> struct gve_priv *priv = netdev_priv(dev);
> u16 max_xdp_mtu;
>
> - if (dev->features & NETIF_F_GRO_HW) {
> - NL_SET_ERR_MSG_MOD(extack,
> - "XDP is not supported when HW-GRO is on.");
> - return -EOPNOTSUPP;
> - }
> -
> if (priv->header_split_enabled) {
> NL_SET_ERR_MSG_MOD(extack,
> "XDP is not supported when header-data split is enabled.");
> @@ -2212,12 +2206,6 @@ static int gve_set_features(struct net_device *netdev,
> if ((netdev->features & NETIF_F_GRO_HW) !=
> (features & NETIF_F_GRO_HW)) {
> netdev->features ^= NETIF_F_GRO_HW;
> - if (priv->xdp_prog && (netdev->features & NETIF_F_GRO_HW)) {
> - netdev_warn(netdev,
> - "HW-GRO is not supported when XDP is on.");
> - err = -EOPNOTSUPP;
> - goto revert_features;
> - }
> if (netif_running(netdev)) {
> err = gve_adjust_config(priv, &tx_alloc_cfg, &rx_alloc_cfg);
> if (err)
> --
> 2.56.1
>
^ permalink raw reply [flat|nested] 23+ messages in thread* Re: [PATCH net-next 8/8] eth: gve: drop the now-dead HW-GRO vs XDP interlock
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
2026-11-19 22:14 ` Harshitha Ramamurthy
@ 2026-11-22 17:03 ` netdev-bot+sashiko
2 siblings, 0 replies; 23+ messages in thread
From: netdev-bot+sashiko @ 2026-11-22 17:03 UTC (permalink / raw)
To: kuba
Cc: davem, netdev, edumazet, pabeni, andrew+netdev, horms,
michael.chan, manishc, joshwash, hramamurthy, tariqt, saeedm,
daniel, hawk, sdf, willemb, przemyslaw.kitszel, bpf
Thank you for your contribution! Sashiko AI review found 3 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 2 · Low: 1
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] A gve XDP attach that gve will reject now rebuilds every queue
twice before failing.
- [Medium] Removing the `priv->xdp_prog && GRO_HW` refusal from
gve_set_features() lets gve rebuild its DQO RX queues with RSC on…
- [Low] The core reports a misleading -EBUSY "required by another
feature" when gve's ndo_set_features fails while it is clearing HW-GRO…
--
eth: gve: drop the now-dead HW-GRO vs XDP interlock
This patch removes two gve checks. One refused an XDP attach while
NETIF_F_GRO_HW was on, and the other refused to turn NETIF_F_GRO_HW back
on while an XDP program was attached. The core now clears HW-GRO before
ndo_bpf runs and keeps it off while a program is attached, so an XDP
attach with HW-GRO on now succeeds with HW-GRO turned off.
> diff --git a/drivers/net/ethernet/google/gve/gve_main.c b/drivers/net/ethernet/google/gve/gve_main.c
> index 0ee69bc11d836..8b65b8119662d 100644
> --- a/drivers/net/ethernet/google/gve/gve_main.c
> +++ b/drivers/net/ethernet/google/gve/gve_main.c
> @@ -1798,12 +1798,6 @@ static int gve_verify_xdp_configuration(struct net_device *dev,
> struct gve_priv *priv = netdev_priv(dev);
> u16 max_xdp_mtu;
>
> - if (dev->features & NETIF_F_GRO_HW) {
> - NL_SET_ERR_MSG_MOD(extack,
> - "XDP is not supported when HW-GRO is on.");
> - return -EOPNOTSUPP;
> - }
> -
> if (priv->header_split_enabled) {
> NL_SET_ERR_MSG_MOD(extack,
> "XDP is not supported when header-data split is enabled.");
[Severity: Medium]
With this check gone, does an XDP attach that gve will reject anyway now
rebuild all of the queues twice before it fails?
In dev_xdp_attach(), the core clears HW-GRO before the driver sees the
program:
net/core/dev.c:dev_xdp_attach() {
...
if (new_prog) {
dev->xdp_pending = 1;
err = dev_xdp_clear_rx_agg(dev, extack);
if (err)
goto err_clear_pending;
}
err = dev_xdp_install(dev, mode, bpf_op, extack, flags, new_prog);
if (err)
goto err_clear_pending;
...
err_clear_pending:
dev->xdp_pending = 0;
netdev_update_features(dev);
return err;
}
On a running DQO device with HW-GRO on (the probe default), the sequence
is:
dev_xdp_clear_rx_agg()
netdev_update_features()
gve_set_features()
gve_adjust_config() <- rebuild 1, RSC off
dev_xdp_install()
gve_xdp()
gve_verify_xdp_configuration() <- returns -EOPNOTSUPP
err_clear_pending:
netdev_update_features()
gve_set_features()
gve_adjust_config() <- rebuild 2, RSC back on
gve_verify_xdp_configuration() can still refuse the attach at that point
in several cases:
- a jumbo MTU above 2048 - ETH_HLEN
- a packet_buffer_size other than SZ_2K
- header split with a frags-capable program (the core hds_config check
only rejects !xdp_has_frags)
- an RX/TX queue count mismatch
Before this change, the same request failed with -EOPNOTSUPP and the
queues were left alone. Now a refused attach interrupts traffic twice.
Either rebuild can also end up in the failure branch of
gve_adjust_config():
err = gve_queues_start(priv, tx_alloc_cfg, rx_alloc_cfg);
if (err) {
...
gve_queues_mem_remove(priv);
gve_turndown(priv);
return err;
}
Would it make sense to check gve's XDP preconditions before the core
reconfigures HW-GRO? If not, could the commit message mention this cost
on the failure path? The ordering comes from the core patch "net: state
the "XDP excludes HW-GRO" rule in the core".
> @@ -2212,12 +2206,6 @@ static int gve_set_features(struct net_device *netdev,
> if ((netdev->features & NETIF_F_GRO_HW) !=
> (features & NETIF_F_GRO_HW)) {
> netdev->features ^= NETIF_F_GRO_HW;
> - if (priv->xdp_prog && (netdev->features & NETIF_F_GRO_HW)) {
> - netdev_warn(netdev,
> - "HW-GRO is not supported when XDP is on.");
> - err = -EOPNOTSUPP;
> - goto revert_features;
> - }
[Severity: Medium]
Can this check still fire when the core's XDP state and gve's
priv->xdp_prog disagree after a failed detach?
dev_xdp_detach_link() ignores the driver's return value and then
recomputes the features:
net/core/dev.c:dev_xdp_detach_link() {
...
WARN_ON(dev_xdp_install(dev, mode, bpf_op, NULL, 0, NULL));
dev_xdp_set_link(dev, mode, NULL);
netdev_update_features(dev);
...
}
gve_set_xdp() only writes priv->xdp_prog on success. So when the detach
fails, the program and the XDP rings stay active. There are at least two
ways for gve's detach to fail:
(a) gve_xdp() runs gve_verify_xdp_configuration() even for a NULL
program. gve has no ndo_change_mtu, so the MTU can be raised above
2048 - ETH_HLEN while XDP is attached. The detach then fails with
-EOPNOTSUPP.
(b) gve_configure_rings_xdp(priv, 0)->gve_adjust_config()->
gve_queues_mem_alloc() returns -ENOMEM.
Once the link is cleared, dev_xdp_prog_count() returns 0. That means
__netdev_update_features() keeps NETIF_F_GRO_HW from wanted_features
and calls gve_set_features().
Before this patch, the priv->xdp_prog check reverted that change. Now
gve_adjust_config() runs with the XDP rings still configured, and
gve_adminq_create_rx_queue() programs RSC from dev->features alone:
cmd->create_rx_queue.enable_rsc =
!!(priv->dev->features & NETIF_F_GRO_HW);
The DQO RX path would then run the program that is still attached on
only the first 2K buffer of each coalesced frame. A later
"ethtool -K rx-gro-hw on" would reach the same state.
Doesn't that contradict the statement in the commit message that
"neither of these can fire any more"?
> if (netif_running(netdev)) {
> err = gve_adjust_config(priv, &tx_alloc_cfg, &rx_alloc_cfg);
> if (err)
[Severity: Low]
The core's dev_xdp_clear_rx_agg() is now the only thing that turns
HW-GRO off before XDP on gve. What error does userspace see when this
gve_adjust_config() call fails during an XDP attach?
If gve_queues_mem_alloc(), gve_close() or gve_queues_start() fails,
gve_set_features() jumps to revert_features. That restores orig_features
with NETIF_F_GRO_HW still set:
revert_features:
netdev->features = orig_features;
return err;
__netdev_update_features() logs the real errno with netdev_err() and
returns -1, but netdev_update_features() throws that away.
dev_xdp_clear_rx_agg() then treats the bit that is still set as a
feature dependency:
netdev_update_features(dev);
agg = dev->features & NETIF_F_XDP_DISABLES;
if (agg) {
NL_SET_ERR_MSG_FMT(extack,
"unable to disable %s, required by another feature",
dev_xdp_rx_agg_name(agg));
return -EBUSY;
}
gve has no ndo_fix_features, so no feature dependency exists here.
Could the core check the return value of __netdev_update_features(), so
that this case reports the driver's error instead of -EBUSY and a
dependency message? This also comes from the core patch "net: state the
"XDP excludes HW-GRO" rule in the core".
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261118232315.3593731-1-kuba%40kernel.org
^ permalink raw reply [flat|nested] 23+ messages in thread