πŸš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #12910

Re: [PATCH net-next v3 5/9] bnxt_en: set the netmem TX frag size limit to 32KB

#12910
From: netdev-bot+sashiko
Date: Mon, 09 Nov 2026 01:22
108 lines
12733 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] This patch fixes a real bug in released kernels but has no Fixes:
  tag, and it does not say that it depends on the earlier patch in this…

Pre-existing issues:
- [High] bnxt_start_xmit() still writes non-netmem page frag lengths
  straight into the 16-bit TX BD length field (TX_BD_LEN = 0xffff << 16).

--

bnxt_en: set the netmem TX frag size limit to 32KB

This patch sets dev->netmem_tx_max_frag_size to SZ_32K in bnxt_init_one().
That caps netmem TX frags at the largest power of 2 that fits in the 16-bit
TX BD length field. With 64K pages this lowers the PAGE_SIZE default, so
64KB devmem frags no longer wrap the BD length to 0 with BIG TCP.

> diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
> index f20b61180ab2d..4bcf84faf18f1 100644
> --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
> +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
> @@ -17471,6 +17471,7 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
>  	if (BNXT_SUPPORTS_QUEUE_API(bp))
>  		dev->queue_mgmt_ops = &bnxt_queue_mgmt_ops;
>  	dev->netmem_tx = NETMEM_TX_DMA;
> +	dev->netmem_tx_max_frag_size = SZ_32K;

[Severity: Low]
The commit message says:

  With 64K pages it lowers it, 64KB frags would otherwise wrap the BD
  length to 0 with BIG TCP.

Isn't this a bug that already exists on 64K-page kernels, rather than a
side effect of the new limit?

Before this series, net_devmem_get_niov_at() returns size = PAGE_SIZE - off,
and zerocopy_fill_skb_from_devmem() applies no other cap. With BIG TCP, an
aligned devmem send can produce a 65536-byte frag. bnxt_start_xmit() then
does:

    flags = len << TX_BD_LEN_SHIFT;

which leaves 0 in the 16-bit length field.

Should this patch carry a Fixes: tag for commit 4922ca773d9d ("eth: bnxt:
add netmem TX support")?

This change also only works together with "net: devmem: add a per-device
netmem TX frag size limit". That patch adds dev->netmem_tx_max_frag_size and
binding->tx_max_frag_size, and it has no Fixes: tag either.

Without the tags and a note about the dependency, stable kernels on 64K-page
systems (arm64 64K, ppc64) would keep the wrap. Would a separate minimal fix
for the net tree work better?

[Severity: High]
This isn't a bug introduced by this patch, but the same 16-bit wrap still
looks reachable for frags that are not netmem. bnxt_start_xmit() writes
every frag length straight into the TX BD:

    len = skb_frag_size(frag);
    ...
    flags = len << TX_BD_LEN_SHIFT;
    txbd->tx_bd_len_flags_type = cpu_to_le32(flags);

TX_BD_LEN is defined as (0xffff << 16), and the length is not clamped or
split. Meanwhile the DMA mapping and dma_unmap_len cover the full frag.

The new limit is only applied in zerocopy_fill_skb_from_devmem(), through
binding->tx_max_frag_size. bnxt enables BIG TCP via
netif_set_tso_max_size(dev, GSO_MAX_SIZE) in bnxt_init_one(). That means
ordinary page frags can reach 64K or more.

On 64K-PAGE_SIZE kernels, SKB_FRAG_PAGE_ORDER is 0, so
skb_page_frag_refill() hands out 64K pages. tcp_sendmsg_locked() can then
coalesce data into one frag of a full 65536 bytes. Sendfile or splice of a
full 64K page-cache page gives the same result.

On any page size, MSG_ZEROCOPY on a THP or hugetlb buffer goes through
zerocopy_fill_skb_from_iter(). That function merges contiguous subpages of
the same compound head:

    if (head == skb_frag_page(last) &&
        start == skb_frag_off(last) + skb_frag_size(last)) {
        skb_frag_size_add(last, size);

so a single frag can be larger than 64K.

In these cases, can the NIC get a BD whose length (len mod 64K, or 0) does
not match the mapped buffer? That could produce malformed TSO segments or a
TX timeout.

The RX side already handles this limit. bnxt.h has the comment "The RXBD
length is 16-bit so we can only support page sizes < 64K". There doesn't
seem to be an equivalent check on TX, for example in bnxt_features_check()
or bnxt_start_xmit().

BIG TCP has been enabled in bnxt since commit b6488b161ab2.

-- 
Sashiko AI review Β· https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261105222058.944293-1-sdf%40fomichev.me
Technical Details
Message-ID: <179418737922.994134.6838913010792422653@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-358940-linux-kernel-netdev=dewy.ru
References: <20261105222058.944293-6-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-358940-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next v3 5/9] bnxt_en: set the netmem TX frag size
 limit to 32KB
Date: Mon, 09 Nov 2026 01:22:59 +0000
Organization: Usenet Network
Message-ID: <179418737922.994134.6838913010792422653@kernel.org>
References: <20261105222058.944293-6-sdf@fomichev.me>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="245246"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:qsxFE8o/7yUJjZ7Ayc9MxYAvuQE= sha256:igrjLomCemqwKsSf4GnsGVHmRBpXBd8HxAJM2nkMM/k=
	sha1:WA9jBiYZH7Ac7xVaKERlrJcdqG8= sha256:NSu77V1pgX/0Drv1GODh0Ppf827lzQY/lxHgnifEqXg=
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 2B00E11367D; Mon,  9 Nov 2026 04:37:22 +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 70rQWxVfE6DB;
	Mon,  9 Nov 2026 04:37:14 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-358940-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 DFF86113678; Mon,  9 Nov 2026 04:37:03 +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 DA1B86516A; Mon,  9 Nov 2026 01:26:23 +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=1794187388;
	b=eW2PiWRvVCa8qqH8+MQqcwSeX8gjDoACACKb2iTLj7lAFzu+YZ9mi0nUITgpUYAA6Lfs
	 DKEjUtu2SSBz62q2iVRQ9n1nVyENKzKfMWQ3ZvsHUGB1lM3UZhO7W/riA/z7SXXjPBHLi
	 nmce0E48/AUV0gXnbFgmpbwIP/BsgQSCSdcHiV1QtCFP/5jbmaE/991CCYYmsMvppKLGn
	 cGRGcfS8DXFamvpLRTwSiVGIzqHQJd7GR30Zv95fKXanfdSz6Mo6qQPnXNqj2iwgM4Ntx
	 0A5kfsquMD0ZujQtKt/E0bPNlsyLu6ZUBF7tfXxmaNQ/9xjIKf92XUDmR6eNeHuMTrA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794187388;
	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=L7Ie4rh+uYGxiq2YkIEoTSDrjYWbd6DHs/eMTJlEa9Q=;
	b=BxyA1P+efzgwEIcefskNumj/LWX51LRYfrtjQOmSf4PFKPyZLDObZX10KGAox1gF+Yx2
	 aRqwS/khCu/6ngI2q9dLB1kG1BhvXhfIVXP+1XC33dTAn67JXEJVz9zu/55nlx7FTVeFz
	 iUAirviwD4f29YE7Uh7yM4yHbPzv87rOowHcRYEfAIp8Veu75wGK+lMQa8iIglb7e44oC
	 LPlcu7ZN6R0QQuE8MO2afcNp+vTsFCarS3x5E/ZmtQ09ywfaMil7so2OtwddyjDIi/Nne
	 9rF1PmLPgskLamd4GhowMwvFpIur2OGZ+eiuET0ieme297fUj7eS3Q90uO0v1+MQmLw==
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=WtqNDTYG;
	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 08D1460A6F47;
	Mon,  9 Nov 2026 01:23: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=WtqNDTYG
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=1794187382;
	b=d5BVAeQ+X1MffJRJJGKVFYBqpUmkqI3cEafhrwHrtKRs4j2jyOzkVF4l2vXQyC4xNRYf
	 vtg1JdimJ7lMWZd15b6wKWf1JEDygHoX1LHEPkbw1NH6lWrEaB3fpiaWy1+7ghiDaORiy
	 vZkD3W87E9fnGuVoTnu/1NmNHoNyocTNJGZbDTEXa7PJF2xRccZMewZYp34ovRskmQQoP
	 1n4x0opvV5ZZeN/8mEdAsNhKK918NLXHKhVhkxxcSLWUj+piKW6R9ghu+YbpFLoTBQDBi
	 50D/scJ5hQp4c3P2KKt5m2TRka9lMNrKJjyybdENOMr8c01vG1FLn/4iNX6hycQK1wQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794187382;
	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=L7Ie4rh+uYGxiq2YkIEoTSDrjYWbd6DHs/eMTJlEa9Q=;
	b=L4qn7c0ejwwNUhu9T1nQd1jFEZfz9S+rbjOb3cy/gw3IHxWYGQr0pwBueM1Hd49tbxok
	 j60qBwFFKq5Sa4IrMigm/WVyYqDZWxhYvgizxqV+EP9PyXyNCTWOW2Vi3GR2Rm1LCZ1h8
	 hwv8keE00wtS4jQXRTniabSNOWiku+lj5liM+S/c8AsfL2o1QPYe9Iu87Ps56744sjyb6
	 v7Q3mm5L0ZQzKA515Nk0cGbASfOmFa8OBspTRVDB//wjUcYer1sIyD+cUSFyRsVb5IuOs
	 9L0MxTAbk1cHQU+sTSBBaiR86AqQ6FPNj839CAvmcLTWzdIkCnaWjSGlh/DlJyE7BwQ==
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=WtqNDTYG;
	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 D8E89608361C;
	Mon,  9 Nov 2026 01:23:01 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id A7D811F008A3;
	Mon,  9 Nov 2026 01:22:59 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1794187381;
	bh=L7Ie4rh+uYGxiq2YkIEoTSDrjYWbd6DHs/eMTJlEa9Q=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=WtqNDTYGMKb1uwgxb3dvg8Tbu0JhIG5QgTYAcstBRvzVLdAHT6iFj1a14W3RdmqBZ
	 NyHNPWoTXkn8hirfreV9or1CBrFcQqNgboycfQb7tyDEbyb4s+3YJm7/2FFLW902bu
	 ia0uF/sDR1+052W50w95+mg6hNMhjtyijlX4Hr6DCEcAf/8ixUA9hUNe1tllof4n48
	 yFehCNNp39ouaAgwF7/8y7OT22nk5cbHhwVvQhHo8ZLJIuIEAhzit0Y/gR7r4HE3qc
	 sLSyxSfMjslU7mv3aWX2VCxExr3aytLZ2HjJMHhhq6J6ihRwkHChlEYFeS4nhSwRI1
	 POlwnWoM1gtrw==
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-6-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