🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #20477

Re: [PATCH net-next 4/8] net: state the "XDP excludes LRO" rule in the core

#20477
From: netdev-bot+sashiko
Date: Sun, 22 Nov 2026 17:03
203 lines
15668 bytes
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
Technical Details
Message-ID: <179536698568.3135.6742683441314879200@kernel.org>
Path: mbox-mo1.pugleaf.net!news-lon.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!2.eu.feeder.erje.net!feeder.erje.net!feeder1.feed.ams11.usenet.farm!feed.usenet.farm!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-368762-linux-kernel-netdev=dewy.ru
References: <20261118232315.3593731-5-kuba@kernel.org>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lon.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!2.eu.feeder.erje.net!feeder.erje.net!feeder1.feed.ams11.usenet.farm!feed.usenet.farm!feeder.usenetexpress.com!tr3.eu1.usenetexpress.com!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-368762-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
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
Organization: Usenet Network
Message-ID: <179536698568.3135.6742683441314879200@kernel.org>
References: <20261118232315.3593731-5-kuba@kernel.org>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network; logging-data="3682170"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:YMohfIIFlj52repC4PVnd18qKnI= sha256:N65Mhc+Y0NGhEyuPExoRNBHKziAWFihDK70knX+A6UY= sha1:kE9DBjeA0MaTWS652Tonna4DDC8= sha256:XeLpWJogPuLl+UCi0MHXsqft4jQSypNdRafJ/SgQzDY=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id A5A07125D7F; Sun, 22 Nov 2026 20:03:28 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.4
X-Spam-Status: No, score=-3.4 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org
X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ULhnG2cNRP9x; Sun, 22 Nov 2026 20:03:24 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-368762-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN>
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4]) by mail.dewy.ru (Postfix) with ESMTPS id 5804C125D82; Sun, 22 Nov 2026 20:03:13 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sin.lore.kernel.org (Postfix) with ESMTP id 3D48926CFC; Sun, 22 Nov 2026 17:03:09 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1795366988; b=xg/dkyYCDddSL2FJ2re0rEItCu1EWqgFi6l3x1hMSHaNSK8uq6ujKJs5HMejMeTRrNaV oy8OhomKWk4L5oCQf+5MrLeARrfcBI85fV8M7EWzXIr3gEDz2oC6EwoKSZ4MQkyF2ruK5 yCExM29KUDJfW3gsf3UNuVNSLihVsphREdxl8EpFuUspt7kZPlD7BISF6g19lVFpB9InQ pVZaKnmc0xZVqnW0z7+4whCWZjnfV+r4UcAA0X+sLkLX8PXNsq4Kl1KHjqKgfIm9Ezv95 GPe+lH2FLmAxMmjB/R5Sia0+OAYS63CvWGh4TdwP/HOozFsAdmkENshtvV10EhDPzuQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795366988; h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc: Date:Message-ID:In-Reply-To:References:X-sashiko-severity: Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id: List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner: Precedence:MIME-Version; bh=tKhzkg2IcBGze+CxoAN70ZFX+EAkROqVI34Vr2dBnmk=; b=abEg7E7DzM0wXFJmxYBMG4iX6zBnj3pPoE18ZTByhDQehDGwaNY+Zv0ukakHfu8+fRlU mgA5lKzWXX0brAW7kPVEV0jqklq/tNsrHZr48PUJbt8KUTdCA/kmDqjJCue+c+/5plcID wGqeheE7mvnEzu1Kn/0jz4Lnjfo2pOk/WI9zULFdW4sq+EsPCbwk49vNkPKq0kUQMnjUb MaDBimE/CJYRJEptYoGzN8zwrPM8zjDXk0I4JwTm+xPptOY66nfWzYRcWA9tTd/l1fmHk b9QatPpYHIpFQmnco3dAlpL2WoDoMAjRuJDS3NeD5IwWK9phsT1F7ivL3gWnHOIIx5Q==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b="bry/fTFW"; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CC147606A33C; Sun, 22 Nov 2026 17:03:08 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=bry/fTFW
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795366988; b=Xp5yt23u4YQmSS6zgLgA/Qp8zJdtZuI4gvhNp6M4W5kl4O0nO10mLgb5Uu2goVCAHK6Y tc8PbcoDL8Ox1adCJTowOYofG2EJL27Egm5/jrs6SMjNCBkxO3TERS9LbOXvCqS9VTg68 bshVBgmhMofBidLl7kzCkP8+8hRi+NGeGhv21LkLqzaeDmqHtSD3mx5QJw2BfPdG3O7o5 3cMK9sqSthfjdoJA7c7Ee2pGC1qjrK5ylV3LOWFN/P9ogV1hAgqw72hI/zzaXw5syPgiw tjsC5s4Am+BlT2AMQF9AeXlR2JVqBHbhw39zWlRGU3AzdX11/7NMmYHRQq9YNm6KXwA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795366988; h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID: In-Reply-To:References:X-sashiko-severity:Content-Type: Content-Transfer-Encoding:MIME-Version; bh=tKhzkg2IcBGze+CxoAN70ZFX+EAkROqVI34Vr2dBnmk=; b=q17h2E/BMvlrPqAYZMXEcMC4qDi2hiLKe8hvkz8grnARHAJpdbr/VrmSkw91FJj28nJG tTJVYeldMTRqds5L1e5AaOXz/5Uya9TKoZRgf1COL4nivGbF1wxLaGJtU5nE2M5dNGYjc UAHvRmpZcyOQruIpiaDxVjBmnOMDi2Tw4b7YG8OMuozESqj4RTYZKQi7kpcVVEdTZN9sI XmxgNqW+w8rRBAEcT4aVocnJCVw+lbKRdDjzUZtxaRC1P3GBcUIvdYb//GbkL41J1fHTn f+4QglafFpEaM7fa/iigkF71roG6+Y7zCI0heG3J79y1L2nfjSF+LSjKH+NRzbOnZOg==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b="bry/fTFW"; arc=none smtp.remote-ip=100.103.45.18
X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EB2B9606A320; Sun, 22 Nov 2026 17:03:07 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 232791F000D1; Sun, 22 Nov 2026 17:03:06 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795366987; bh=tKhzkg2IcBGze+CxoAN70ZFX+EAkROqVI34Vr2dBnmk=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=bry/fTFW2Rhimg2R7W5IzW3K3pdl+kgU1/Fe4HuB02G9o+7RzOck+ndo08OHnCynd xYoCKSy95o6fPwXgD7yQDFGVaiLP9X2Wg7s4gIy019PaGvcErHNCTw1sxTDLimCniK pGV7luUH41OYgp4CM+Hs2FaWZthbioDiX51E9ej+TzOP9U6jBks3ii0ptnIO+/uX2A r416FidpBl+VSsuKrpdoxWguuA0I6pEh7HI131qFmWUXGkMtCtXSjsgpK0rkWDBved zMUSMQNp8Mx+nKwtfeAqiAObXzbBT/9i3aHJzFCuoC7P+WGJKtm8dPVWSG4ngjHDUu krWJ5I7d9W0og==
X-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
X-In-Reply-To: <20261118232315.3593731-5-kuba@kernel.org>
X-sashiko-severity: Medium
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list