From: netdev-bot+sashiko@kernel.org
To: kuba@kernel.org
Cc: davem@davemloft.net, netdev@vger.kernel.org, edumazet@google.com,
pabeni@redhat.com, andrew+netdev@lunn.ch, horms@kernel.org,
michael.chan@broadcom.com, manishc@marvell.com,
joshwash@google.com, hramamurthy@google.com, tariqt@nvidia.com,
saeedm@nvidia.com, daniel@iogearbox.net, hawk@kernel.org,
sdf@fomichev.me, willemb@google.com,
przemyslaw.kitszel@intel.com, bpf@vger.kernel.org,
nktgrg@google.com
Subject: Re: [PATCH net-next v2 5/9] net: state the "XDP excludes LRO" rule in the core
Date: Mon, 23 Nov 2026 01:33:49 +0000 [thread overview]
Message-ID: <179539762917.3135.17061480086535171425@kernel.org> (raw)
In-Reply-To: <20261122010112.1471146-6-kuba@kernel.org>
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] On a stacked device, an XDP attach that fails now turns LRO
off on every lower device, and it stays off.
- [Low] The netvsc driver documentation is now out of date.
- [Low] The comment above the XDP feature-clearing block in
__netdev_update_features() (net/core/dev.c:11444-11446) still covers…
--
net: state the "XDP excludes LRO" rule in the core
This patch adds NETIF_F_XDP_DISABLES (GRO_HW | LRO). The core now clears
LRO next to HW-GRO before 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 itself after the
detach.
> diff --git a/net/core/dev.c b/net/core/dev.c
> index 5d38cdb6c3260..308501d384b6f 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
[ ... ]
> @@ -10599,26 +10598,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]
Can a refused XDP attach on a bond now leave LRO off on the slaves for
good?
dev_xdp_attach() calls dev_xdp_clear_rx_agg() before dev_xdp_install() runs
its checks and before the driver's bpf_op is called:
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;
...
}
LRO is now in NETIF_F_XDP_DISABLES. So for a bond with LRO on, this
netdev_update_features(bond) call drops LRO. LRO is also in
NETIF_F_UPPER_DISABLES, so netdev_sync_lower_features() then does this on
each slave that has LRO on:
lower->wanted_features &= ~feature;
__netdev_update_features(lower);
Now suppose the attach fails afterwards, for example in bond_xdp_set() when
the bonding mode doesn't support XDP:
if (!bond_xdp_check(bond, BOND_MODE(bond))) {
BOND_NL_ERR(dev, extack,
"No native XDP support for the current bonding mode");
return -EOPNOTSUPP;
}
The err_clear_pending path calls netdev_update_features() on the bond
only. The bond gets LRO back from its own wanted_features. But
netdev_sync_lower_features() only ever clears bits, so the slaves keep LRO
off.
The attach can also fail at this point if a slave lacks ndo_bpf or
ndo_xdp_xmit. A dev_xdp_install() check can reject it too, for example a
BPF_XDP_DEVMAP or BPF_XDP_CPUMAP program.
Before this patch, a failed native attach never touched LRO. In generic
mode, netif_disable_lro() was only called from generic_xdp_install(), and
that runs after all of the checks in dev_xdp_install().
The commit message explains that slaves stay LRO-off after a detach. It
doesn't say the same happens after a refused attach. Is that intended?
On a single device, a refused attach now also turns LRO off and back on
through ndo_set_features. On ixgbe and vmxnet3 that is a full
reconfiguration, for an attach that simple checks would reject. Could the
checks in dev_xdp_install() run before the aggregation features are
cleared?
[ ... ]
> @@ -11436,9 +11444,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.
> */
[Severity: Low]
This isn't a bug, but this comment still mentions only GRO_HW, while the
code below now clears NETIF_F_XDP_DISABLES, which is GRO_HW and LRO. The
patch updates the other comments and the netdev_dbg() string. Should this
comment be updated as well?
> - 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]
Should Documentation/networking/device_drivers/ethernet/microsoft/netvsc.rst
be updated along with this? It still says:
XDP program cannot run with LRO (RSC) enabled, so you need to disable LRO
before running XDP::
ethtool -K eth0 lro off
With this change the core clears LRO before ndo_bpf is called. So
netvsc_set_features() turns RSC off first, and the "XDP: not support LRO"
refusal in netvsc_xdp_set() can no longer trigger on attach.
Following the doc by hand also clears LRO from wanted_features. LRO then
doesn't come back after the detach, as it would when the core handles it.
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261122010112.1471146-1-kuba%40kernel.org
next prev parent reply other threads:[~2026-11-23 1:33 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-22 1:01 [PATCH net-next v2 0/9] net: make core auto-disable HW-GRO and LRO when XDP gets attached Jakub Kicinski
2026-11-22 1:01 ` [PATCH net-next v2 1/9] net: stop making HW-GRO depend on SW GRO Jakub Kicinski
2026-11-22 1:01 ` [PATCH net-next v2 2/9] selftests: drv-net: gro_stats: use the shared set_ethtool_feat() Jakub Kicinski
2026-11-22 1:01 ` [PATCH net-next v2 3/9] selftests: drv-net: drop the generic XDP hack from the HW GRO setup Jakub Kicinski
2026-11-22 1:01 ` [PATCH net-next v2 4/9] net: state the "XDP excludes HW-GRO" rule in the core Jakub Kicinski
2026-11-23 1:33 ` netdev-bot+sashiko
2026-11-22 1:01 ` [PATCH net-next v2 5/9] net: state the "XDP excludes LRO" " Jakub Kicinski
2026-11-23 1:33 ` netdev-bot+sashiko [this message]
2026-11-22 1:01 ` [PATCH net-next v2 6/9] eth: mlx5e: drop the now-dead HW-GRO and LRO vs XDP handling Jakub Kicinski
2026-11-23 1:33 ` netdev-bot+sashiko
2026-11-22 1:01 ` [PATCH net-next v2 7/9] eth: bnxt_en: don't clear HW-GRO and LRO for XDP in ndo_fix_features Jakub Kicinski
2026-11-22 1:01 ` [PATCH net-next v2 8/9] eth: qede: drop the now-dead HW-GRO vs XDP handling Jakub Kicinski
2026-11-22 1:01 ` [PATCH net-next v2 9/9] eth: gve: drop the now-dead HW-GRO vs XDP interlock Jakub Kicinski
2026-11-23 1:33 ` netdev-bot+sashiko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=179539762917.3135.17061480086535171425@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hawk@kernel.org \
--cc=horms@kernel.org \
--cc=hramamurthy@google.com \
--cc=joshwash@google.com \
--cc=kuba@kernel.org \
--cc=manishc@marvell.com \
--cc=michael.chan@broadcom.com \
--cc=netdev@vger.kernel.org \
--cc=nktgrg@google.com \
--cc=pabeni@redhat.com \
--cc=przemyslaw.kitszel@intel.com \
--cc=saeedm@nvidia.com \
--cc=sdf@fomichev.me \
--cc=tariqt@nvidia.com \
--cc=willemb@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox