๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #12911

Re: [PATCH net-next v3 1/9] bnxt_en: let the stack segment GSO skbs with too many frags

#12911
From: netdev-bot+sashiko
Date: Mon, 09 Nov 2026 01:22
113 lines
12686 bytes
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.

Low priority / nit picks for your consideration:

- [Low] The patch fixes real functional bugs in existing bnxt code, but
  it has no Fixes: tag and is not routed to stable.
- [Low] Clearing NETIF_F_GSO_MASK in bnxt_features_check() makes the
  stack segment a GSO skb with nr_frags > TX_MAX_FRAGS.

--

bnxt_en: let the stack segment GSO skbs with too many frags

When MAX_SKB_FRAGS > TX_MAX_FRAGS, this patch clears the GSO features in
bnxt_features_check() for skbs that have more than TX_MAX_FRAGS frags.
The stack then segments those skbs, and bnxt_start_xmit() no longer
linearizes them. Non-GSO skbs with too many frags are still linearized in
the xmit path.

Link: https://lore.kernel.org/all/CANn89i+ps_CozfOyRnKav0_LUmSekJ9ExB5JkDbTAVf_ss_98g@mail.gmail.com/

> diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
> index 33c4cacc8ffe3..f20b61180ab2d 100644
> --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
> +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
> @@ -14320,6 +14320,11 @@ static netdev_features_t bnxt_features_check(struct sk_buff *skb,
>  				skb_shinfo(skb)->gso_size))
>  		features &= ~NETIF_F_GSO_MASK;
>  
> +#if (MAX_SKB_FRAGS > TX_MAX_FRAGS)
> +	if (skb_shinfo(skb)->nr_frags > TX_MAX_FRAGS)
> +		features &= ~NETIF_F_GSO_MASK;
> +#endif

[Severity: Low]
Should this patch have a Fixes: tag?

Commit b91e82129400 ("bnxt_en: Linearize TX SKB if the fragments exceed
the max") added the unconditional linearize in bnxt_start_xmit():

bnxt_start_xmit() {
    ...
#if (MAX_SKB_FRAGS > TX_MAX_FRAGS)
	if (skb_shinfo(skb)->nr_frags > TX_MAX_FRAGS) {
		...
		if (skb_linearize(skb))
			goto tx_free;
	}
#endif
    ...
}

bnxt calls netif_set_tso_max_size(dev, GSO_MAX_SIZE), so a BIG TCP skb
can be linearized into a head larger than 64KB. That length is then
encoded here:

	flags = (len << TX_BD_LEN_SHIFT) | TX_BD_TYPE_LONG_TX_BD |
		TX_BD_CNT(last_frag + 2);

TX_BD_LEN_SHIFT is 16 and flags is a u32. The upper bits of the length
are lost, so the BD length no longer matches the DMA mapping.

bnxt also sets dev->netmem_tx = NETMEM_TX_DMA. For devmem GSO skbs,
skb_linearize() always fails, because __pskb_pull_tail() returns NULL
when !skb_frags_readable(). Those skbs are dropped at tx_free.

The commit message describes both problems. Without a Fixes: tag, stable
kernels that carry b91e82129400 won't pick up this fix.

[Severity: Low]
Can the segments that the stack produces here still have more than
TX_MAX_FRAGS unreadable frags?

Only the GSO features are cleared, and nothing limits the frag count of
each resulting segment. zerocopy_fill_skb_from_devmem() adds one frag per
iovec entry and does not merge adjacent ranges:

net/core/datagram.c:zerocopy_fill_skb_from_devmem() {
    ...
		size = min_t(size_t, size, iter_iov_len(from));
		netmem_inc_ref(net_iov_to_netmem(niov));
		skb_add_rx_frag_netmem(skb, i, net_iov_to_netmem(niov), off,
				       size, PAGE_SIZE);
    ...
}

Suppose a devmem sender uses small iovecs: frags averaging under about
47 bytes at a 1500 MTU, or under about 290 bytes at a 9K MTU. Then a
single MSS-sized segment from skb_segment() can span more than 30 frags.
__copy_skb_header() also carries over skb->unreadable to that segment.

Such a non-GSO segment then reaches skb_linearize() in bnxt_start_xmit(),
which fails for net_iov frags, and the segment is dropped at tx_free.
TCP retransmissions rebuild the same layout, so the flow may stall.

This is not worse than before the patch, when the whole GSO skb was
dropped in the same way. However, the commit message gives "always fails
for unreadable skbs" as a reason for the change, and for these flows that
failure can still happen after segmentation.

Could the commit message mention this limitation? Fully closing the gap
would need a fallback that handles unreadable frags, or a frag limit per
MSS window at sendmsg time, rather than skb_linearize().

>  	switch (vlan_get_protocol(skb)) {
>  	case htons(ETH_P_IP):
>  		if (!skb->encapsulation)

-- 
Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261105222058.944293-1-sdf%40fomichev.me
Technical Details
Message-ID: <179418737248.994134.10509157155829463489@kernel.org>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-358937-linux-kernel-netdev=dewy.ru
References: <20261105222058.944293-2-sdf@fomichev.me>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-358937-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next v3 1/9] bnxt_en: let the stack segment GSO skbs
 with too many frags
Date: Mon, 09 Nov 2026 01:22:52 +0000
Organization: Usenet Network
Message-ID: <179418737248.994134.10509157155829463489@kernel.org>
References: <20261105222058.944293-2-sdf@fomichev.me>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="245466"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:i68RAoUgZ+glLYgI6y1/tHCbxWo= sha256:OFO+iEkhNFKL7+7QzOtHwWOk6Q27Tw3xx99zbGg5jFU=
	sha1:pMph5pcrxcR0dS2iG7nEF0fDOT0= sha256:DX7JBvQL6WdYr/w1GCHEqYb8+Km2cbdCl68uigvP72w=
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 5183111367E; Mon,  9 Nov 2026 04:39:00 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.401
X-Spam-Status: No, score=-3.401 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] 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 esMt8ifKcvAZ;
	Mon,  9 Nov 2026 04:38:54 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=netdev+bounces-358937-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 63C4E113646; Mon,  9 Nov 2026 04:38:42 +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 4E5D646A58; Mon,  9 Nov 2026 01:26: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=1794187386;
	b=HBqYmRHGfAN8w40tfqh7dKLm8r2O/uJhFjXLQrsgyYntn/GYE9OjS1g0NGYWDykmTtPl
	 vPgF8FFxF+C1LUSYb/RvfqCkjN6Pgg/zdzioye1HkD4X+yG4pXAs3I/zGgxUyjjqcmFQs
	 ledy8hnIVMJgQPoP0tUo8tb+wqayrw97Z9D1mGsX5U6bWVjtH3ILTmjBZqVBrpADGt7Xm
	 wxkSpYJUO/Cq2A1AfRV0rhLLvliyvkCZlZf12zYKrfgn6MH6qIS60LcKNSYlMQLErHQf/
	 vfak343OjyosuR3j9g/Km5fnFwiJ7Y3BT90Ff00xCH5qDWa+i6kalFqx0mTwsju9Mgg==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794187386;
	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=uu4b4q9g+ZAPloji05p+CCMtBgpxRHYFQ7AS0/TwBHc=;
	b=vdCTf6iJkelm998FdU0Rvu78kn4TY+viKz6G0tMcRpq9orst3ruv4e9sTTc7RRjFVv86
	 Tkv/JzjBqMecC2uKxZOEo5rD+hnuhfLIJH+6gBW4UMoA9VTDLA5mvuPHM/ojHdH/slcjK
	 YGsxgttGZX/cnxCZ6slOpAeibAkP3PJ48XZvg3d2cVpqoVq52z2mk7+6T6wMHsRkXEZus
	 86//VwbI6gqAcJsdn93JlL22E2u1xXwrUH20DjjrAb2b7soerHX2cynffnfhlvznvKouZ
	 Z9viscHgoUT+huXLf+trAQEQqyoMf6F02MVfwf7L75Z+xugifbRK0/YISXofGZXSSPQ==
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=Ci25x92W;
	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 5203560A5BC2;
	Mon,  9 Nov 2026 01:23:06 +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=Ci25x92W
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=1794187375;
	b=BraBxLLaY3l+/5HE9JhZPyI/Ed5KW8LRrxWByM++ss0X78PE7MqNFACaPZ8pFstkCBZW
	 B1OauzV9xMJ49Z/QAMNmMniiNSugsDctLFjj9SNrhkKR1pScRQt4HU+FDznhFWDTYTBKh
	 G95XLNL6PW1CRc5K2ejTpSFWxx9q2CwjIXQxYpjHI4lmuu0vBXBrDB95ZcrTPqWZN8t2s
	 BnviR8A1T4yqcv/gtRst9xpuUnCmG2AtEHt97bDFZUaFy55Morhdi2voZ3GEZvj41Mx6y
	 Ml0kS4s6AVnnJqz80UWiTGrXk6AgS3X1t17PPRZmASTf93eubbt+fjTTqLeP8PpOd2A==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794187375;
	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=uu4b4q9g+ZAPloji05p+CCMtBgpxRHYFQ7AS0/TwBHc=;
	b=bpzXhPP/V6qas6ZYsSF+cECshihInCxV6ro3LzxCVAfLrk8GCNfLW/j7Ew0FrDZHNtpp
	 7QmCeCw/pqPBHq7MPFZbkKpk4Ss4/KahxOvRi/xMprtCat65jz+O2kfpGjdKEKrdW6FMq
	 +yd/ZleC4sZZaK61DdyipVq/Qx5lLBcww4e+GOCCNwEHGjE2dWPgkcy+5zVh+i4rEYFxk
	 TWdAobibxSl3LOsEvZ9cd1VFdM+cfyHBwfdgrQI2uApB6vxRS4NzyrpQ5g95bPwb6tCUO
	 Qw1qg0wyrvn2p/98SVW3i35IRAfnVyagTDVGncJwJ6aq9zsaCpucuraDCXPysipI0Fg==
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=Ci25x92W;
	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 183E6606A322;
	Mon,  9 Nov 2026 01:22:54 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id E65011F008A2;
	Mon,  9 Nov 2026 01:22:52 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1794187374;
	bh=uu4b4q9g+ZAPloji05p+CCMtBgpxRHYFQ7AS0/TwBHc=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=Ci25x92We9LQDp/BzLsL3hLWF7dXU8H8VmIjEskiWc94CTiila4wXQqE6HAowUH1B
	 Qga+SpdoDITwuPEILfgjqKjSSAifvxY7GGA5UBFlZhlo8dOcK1G9LZ4DN8LJZqGxXE
	 2iIkQLAXUA7CaH0jNAnO36t43eFI50nYnmE82YARF3g/+9I2cs2CqIO/pbOX2iZFtT
	 jPSKiX1g5SunKcVF5nwb1pAkHZb1TRltiyGEouZoHtWWAzZdYJjZ/rgm0uxYeiqJv7
	 NrvGiYw+bDKNmfwwSq+/Dfu8lSwId7uSxfj/Y24x7ShuNTCwMAtM2QTx03Uu5kD22G
	 XsVAZguAlr1Wg==
X-Cc: netdev@vger.kernel.org, davem@davemloft.net, edumazet@google.com,
 kuba@kernel.org, pabeni@redhat.com, andrew+netdev@lunn.ch,
 edumazet@kernel.org, horms@kernel.org, corbet@lwn.net,
 skhan@linuxfoundation.org, rdunlap@infradead.org, michael.chan@broadcom.com,
 pavan.chebbi@broadcom.com, saeedm@nvidia.com, tariqt@nvidia.com,
 mbloch@nvidia.com, alexanderduyck@fb.com, kernel-team@meta.com,
 sdf@fomichev.me, dimitri.daskalakis1@gmail.com, almasrymina@google.com,
 dtatulea@nvidia.com, bobbyeshleman@meta.com, asml.silence@gmail.com,
 daniel@iogearbox.net, razor@blackwall.org, leitao@debian.org,
 linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
 linux-rdma@vger.kernel.org, linux-kselftest@vger.kernel.org, leon@kernel.org
X-In-Reply-To: <20261105222058.944293-2-sdf@fomichev.me>
X-sashiko-severity: Low
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