🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #20637

Re: [PATCH net-next v2 5/9] net: state the "XDP excludes LRO" rule in the core

#20637
From: netdev-bot+sashiko
Date: Mon, 23 Nov 2026 01:33
161 lines
13828 bytes
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
Technical Details
Message-ID: <179539762917.3135.17061480086535171425@kernel.org>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news-can.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-368939-linux-kernel-netdev=dewy.ru
References: <20261122010112.1471146-6-kuba@kernel.org>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news-can.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-368939-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
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
Organization: Usenet Network
Message-ID: <179539762917.3135.17061480086535171425@kernel.org>
References: <20261122010112.1471146-6-kuba@kernel.org>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="3763870"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:MspYtYlFqLWrEX2bNOVG5B+n8aI= sha256:T2W17F3fA144lGcY8Jv+pvi5rgjadrc+kOazDiEjd3o=
	sha1:CMGbvV7x2L605BIoRsjDSd7r8dI= sha256:lIub06qQuHbky82vNciTt7UE8c3YZmzdC1z1HoRAfd0=
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 EB009125D8B; Mon, 23 Nov 2026 04:34:16 +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 dv35CkyTgmUC;
	Mon, 23 Nov 2026 04:34:07 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-368939-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 tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id 8EB2A125D8C; Mon, 23 Nov 2026 04:33:59 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by tor.lore.kernel.org (Postfix) with ESMTP id 8F9E2283FD; Mon, 23 Nov 2026 01:33:55 +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=1795397632;
	b=q9mb91uxu6KFRVWavJkp3GBOgHQSH3QQyXssO4YeYVgYUoqJZsrUSRGGFIilfj+yf3Zb
	 9hsKy/jYc7i+u9x+Qko5bPZJp2bNelbFUFDWoK0hdkKB/gUAUra2RXoTfZuAcAULEMqlq
	 h1/pDzXjZVQR5x60w25l5Ktx3z0c+K4kR9rnePw5UUNUOacUJG8TBA7IqyhNSiXVk8ydS
	 3eMLDutS8kv2+xiZlRlTCKvFbqEnmIJ798jYRS1vitT4dtoD4XhxIbsrLDN3057KCLunq
	 nQmDcLlgvM5Z+BivMhsf7MkMTxlqFVaAQGtl+hvQ8vqAYSsBYTkW+zCxX9cuHSVrXjw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795397632;
	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=mt8mJUZhq4KTZ3utexyMaCQYzKL+gpqFc3XekMPH/vs=;
	b=qHMFojy6YMI3ebogLz2kaC9fUvR5VkgivIccEVnVW5BKZagT/Dsqwhv5vMuTgCN56w9i
	 OTKJske9RPaMtLLaQgLrp/s15pTLk1+zSe74aTQLZ+w1zEevVdj2hSoKRfBEgmKa5UUVg
	 kJcaGgyubUnkkVGtj/hkipklUg7cW8AF4lEZnjJ5BoAPg0lvcytRafL69/eSfQb1nrOJF
	 kkQ38me242a77ONtV1w/vHJtTb4Tm+j6XOF7r4BZO4L4wiHgDR50IM4LO+OEJpknfZOfF
	 xxvcVKK620TX0fvwhqNjMvHmJA6HpC+SUTvTjJxRBzKO4TRcJPjDuheGCOb+RViYXfw==
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=Tfv53e5C;
	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 3F335606A33E;
	Mon, 23 Nov 2026 01:33:52 +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=Tfv53e5C
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=1795397631;
	b=Y8RU824p4DRK4KHVK3M8wW7LCXldwflxxmao6IZGW3wQDwcuSNURNNsTYP0X4FHSK42u
	 j9nlrts0bvaWtgYKbUAewaK/XEFbiLNy3671ElrZxetdRC7yYbMrTLOd4RyyB537SyVkY
	 YqUmmpokZrRkH3yLJ4lLU2oysyFCPo6RmCt16nvDxdZ1hfHyLUslFIOn6mRZK2wTpHpvW
	 GTpBzq/CkQ4G61fmlRLCJw6goRWbQuz6doKq5stIhNArhe/qQYcgNGh48A+DBuX/ASRiq
	 G18QBMBBPLNlMn/sUbJJL4rkSDThRJxk0Y5jF1szyx2JNZPLJnXN3aRT/mZsvpc+vfQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795397631;
	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=mt8mJUZhq4KTZ3utexyMaCQYzKL+gpqFc3XekMPH/vs=;
	b=tOnXXq6D4p0JcW2z0baHcxVSjWbA7+LpCGAqMJ28+N/MKrOxsAVEJwMbPylvgqoUXYJS
	 aFua33wkrUmRNl10sxFT1J8Iq22W1z9Lfc7dFqW81SixlS55BWpICNBL7pL6w43ZGig2S
	 rxkmj9nPJnTohepnrX5UDROU0BqdhvJ2/4SYD9dnOj9RpNbNU6QHB6HQ7nbs7aBt428wj
	 EcT2dZIeFZGt2BLDht23vlIG2VmqNjfSsgVgcXXCqisWkX8Pn9Y5yC5aQi7QvYsiYhRVC
	 ggs4AozoYn3MWqWJ7woVcrLyt/B72Q1c3fuwOsJLWxtGu+81rHCSjgva7NgS9oH0TbA==
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=Tfv53e5C;
	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 5D404606A31A;
	Mon, 23 Nov 2026 01:33:51 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 902601F000C4;
	Mon, 23 Nov 2026 01:33:49 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1795397630;
	bh=mt8mJUZhq4KTZ3utexyMaCQYzKL+gpqFc3XekMPH/vs=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=Tfv53e5CQYha7nbvfhAnyzZTn6wsYR/I5Ua2iD3gdMsysxiJ05SUrj5HboAXMDdtQ
	 pY4dO6GcbmUO1zAggkALjC1TyH1FSzqsWZ34yejXQ7K2hAV4VZAjTBWDZf56vBRJPM
	 p6X89wss2xsCCNdvju/VzLmP7DW2BCfxXxZwLtkfoIKSqEDZL5U6UA7/FtS6HG2Um1
	 o/MS2soDde27BNYFQRCQHtB9MHe6zx5/q8DEeCoBIv1SpVpGyISORgUe9nEPR5/JnV
	 x0i58uHAxfmNX7rMCOD7eVdCTjIf3qKXTNb7FM8MHKiFwViek7MrWiEeG/CYMcTXGU
	 iV0aibwmKiVsA==
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, nktgrg@google.com
X-In-Reply-To: <20261122010112.1471146-6-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