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
Subject: Re: [PATCH net-next 4/8] net: state the "XDP excludes LRO" rule in the core
Date: Sun, 22 Nov 2026 17:03:05 +0000 [thread overview]
Message-ID: <179536698568.3135.6742683441314879200@kernel.org> (raw)
In-Reply-To: <20261118232315.3593731-5-kuba@kernel.org>
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
next prev parent reply other threads:[~2026-11-22 17:03 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-18 23:23 [PATCH net-next 0/8] net: adjust HW GRO and LRO feature handling Jakub Kicinski
2026-11-18 23:23 ` [PATCH net-next 1/8] net: stop making HW-GRO depend on SW GRO Jakub Kicinski
2026-11-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
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
2026-11-19 22:59 ` Willem de Bruijn
2026-11-20 22:13 ` Jakub Kicinski
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
2026-11-19 23:02 ` Willem de Bruijn
2026-11-19 23:24 ` sashiko-bot
2026-11-22 17:03 ` netdev-bot+sashiko [this message]
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
2026-11-18 23:23 ` [PATCH net-next 6/8] eth: bnxt_en: don't clear HW-GRO and LRO for XDP in ndo_fix_features Jakub Kicinski
2026-11-18 23:23 ` [PATCH net-next 7/8] eth: qede: drop the now-dead HW-GRO vs XDP handling Jakub Kicinski
2026-11-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
2026-11-18 23:44 ` Ankit Garg
2026-11-19 22:14 ` Harshitha Ramamurthy
2026-11-22 17:03 ` 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=179536698568.3135.6742683441314879200@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=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