Thread View: linux.kernel.netdev
6 messages
6 total messages
Started by Jakub Kicinski
Wed, 18 Nov 2026 23:23
[PATCH net-next 0/8] net: adjust HW GRO and LRO feature handling
Author: Jakub Kicinski
Date: Wed, 18 Nov 2026 23:23
Date: Wed, 18 Nov 2026 23:23
51 lines
10063 bytes
10063 bytes
XDP has no understanding of GSO frames. GSO frame looks to XDP like a large packet. Pushing / popping headers cannot be reflected in GSO metadata. XDP redirect is completely blind to GSO since struct xdp_frame carries no GSO fields. For those reasons most (read: all well behaved?) drivers disable LRO and HW GRO when XDP is attached. This series lifts the auto-clearing of HW-GRO and LRO from drivers up to netdev core. This gives us uniform behavior - previously some drivers would reject XDP attach w/ HW-GRO and others would auto- -clear the HW-GRO features. More importantly (for me) after this series the HW-GRO/LRO features should consistently remain in wanted_features, and get re-enabled after XDP is detached. I started looking at this because XDP generic tests in NIPA unintentionally clear HW-GRO, which in turn makes devmem tests fail / skip on mlx5. Note that XDP generic mangling GSO state is its own can of worms this series doesn't try to address. There are multiple paths (xdpgeneric, tun, veth...) which end up calling XDP on skbs, with varying level of assurance that the skb is not a GSO super-frame... Jakub Kicinski (8): net: stop making HW-GRO depend on SW GRO selftests: drv-net: drop the generic XDP hack from the HW GRO setup net: state the "XDP excludes HW-GRO" rule in the core net: state the "XDP excludes LRO" rule in the core eth: mlx5e: drop the now-dead HW-GRO and LRO vs XDP handling eth: bnxt_en: don't clear HW-GRO and LRO for XDP in ndo_fix_features eth: qede: drop the now-dead HW-GRO vs XDP handling eth: gve: drop the now-dead HW-GRO vs XDP interlock .../networking/net_cachelines/net_device.rst | 1 + include/linux/netdev_features.h | 6 + include/linux/netdevice.h | 6 + .../net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | 2 +- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 5 +- drivers/net/ethernet/google/gve/gve_main.c | 12 -- .../net/ethernet/mellanox/mlx5/core/en_main.c | 32 +----- .../net/ethernet/qlogic/qede/qede_filter.c | 12 +- drivers/net/ethernet/qlogic/qede/qede_main.c | 1 - net/core/dev.c | 107 ++++++++++++++---- .../testing/selftests/drivers/net/gro_lib.py | 21 +--- .../selftests/drivers/net/hw/gro_stats.py | 18 --- 12 files changed, 104 insertions(+), 119 deletions(-) -- 2.56.1
[PATCH net-next 6/8] eth: bnxt_en: don't clear HW-GRO and LRO for XDP in ndo_fix_features
Author: Jakub Kicinski
Date: Wed, 18 Nov 2026 23:23
Date: Wed, 18 Nov 2026 23:23
27 lines
8922 bytes
8922 bytes
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
[PATCH net-next 7/8] eth: qede: drop the now-dead HW-GRO vs XDP handling
Author: Jakub Kicinski
Date: Wed, 18 Nov 2026 23:23
Date: Wed, 18 Nov 2026 23:23
65 lines
10409 bytes
10409 bytes
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
[PATCH net-next 8/8] eth: gve: drop the now-dead HW-GRO vs XDP interlock
Author: Jakub Kicinski
Date: Wed, 18 Nov 2026 23:23
Date: Wed, 18 Nov 2026 23:23
51 lines
9866 bytes
9866 bytes
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
Re: [PATCH net-next 7/8] eth: qede: drop the now-dead HW-GRO vs XDP handling
Author: netdev-bot+sashiko
Date: Sun, 22 Nov 2026 17:03
Date: Sun, 22 Nov 2026 17:03
100 lines
11772 bytes
11772 bytes
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
Re: [PATCH net-next 8/8] eth: gve: drop the now-dead HW-GRO vs XDP interlock
Author: netdev-bot+sashiko
Date: Sun, 22 Nov 2026 17:03
Date: Sun, 22 Nov 2026 17:03
211 lines
15578 bytes
15578 bytes
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
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads