๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #19309

Re: [PATCH net-next v8 6/9] net: bcmgenet: split frames that end just past the transmit threshold

#19309
From: netdev-bot+sashiko
Date: Thu, 19 Nov 2026 18:05
66 lines
10729 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] Baseline decision: false positive.

--

net: bcmgenet: split frames that end just past the transmit threshold

This commit avoids a Tx DMA stall by splitting a transmit frame across two
descriptors that share one mapping when the frame ends within one DMA
burst past the transmit packet ready threshold. Once the MTU exceeds
ETH_DATA_LEN, it also programs TBUF_PKT_RDY_THLD to ENET_THLD_MAX. Frames
longer than the threshold fall back to software checksumming.

> diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
> index e0edfe3fc94a2..2b402c067e63e 100644
> --- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
> +++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c

[ ... ]

> @@ -2704,8 +2794,10 @@ static unsigned int bcmgenet_rx_buf_len(unsigned int mtu)
>  /* Program the MTU dependent registers. Call with the MAC disabled. */
>  static void bcmgenet_set_mtu_regs(struct bcmgenet_priv *priv, unsigned int mtu)
>  {
> +	u32 tx_thld = bcmgenet_tx_pkt_rdy_thld(mtu);
>  	u32 thld = bcmgenet_pkt_rdy_thld(mtu);
>  
> +	priv->tx_thld_len = tx_thld * ENET_THLD_UNIT;
>  	bcmgenet_umac_writel(priv, ENET_MAC_FRAME_LEN(mtu), UMAC_MAX_FRAME_LEN);
>  
>  	/* GENET v1 maps other registers at these offsets */
> @@ -2713,6 +2805,8 @@ static void bcmgenet_set_mtu_regs(struct bcmgenet_priv *priv, unsigned int mtu)
>  		return;
>  
>  	bcmgenet_rbuf_writel(priv, thld, RBUF_PKT_RDY_THLD);
> +	bcmgenet_writel(tx_thld, priv->base + priv->hw_params->tbuf_offset +
> +			TBUF_PKT_RDY_THLD);
>  }

[Severity: Low]
This isn't a bug, but bcmgenet_set_mtu_regs() sets priv->tx_thld_len
before the GENET_IS_V1() early return. The TBUF_PKT_RDY_THLD write that
it tracks only happens after that return.

Suppose a v1 part ran with an MTU above ETH_DATA_LEN. tx_thld_len would
become 0xf0 * 16 = 3840, but the register would never be programmed.
bcmgenet_xmit() would then split frames and fall back to software
checksum based on a threshold the MAC is not using.

As far as I can tell, this can't happen today. Nothing at this commit
changes max_mtu. The later "net: bcmgenet: allow the MTU to be changed"
patch raises max_mtu only under GENET_IS_V5(). So v1 always gets
ENET_THLD_DEFAULT, and tx_thld_len stays at 2048.

Would it be clearer to update tx_thld_len only on parts where
TBUF_PKT_RDY_THLD is actually written? That way the software value
could not drift from the hardware.

-- 
Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261118-nb-genet-mtu-nn-v2-v8-0-68f75eadf3e2%40tipi-net.de
Technical Details
Message-ID: <179511155798.3136.7155955737462813812@kernel.org>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-367238-linux-kernel-netdev=dewy.ru
References: <20261118-nb-genet-mtu-nn-v2-v8-6-68f75eadf3e2@tipi-net.de>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-367238-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next v8 6/9] net: bcmgenet: split frames that end just
 past the transmit threshold
Date: Thu, 19 Nov 2026 18:05:57 +0000
Organization: Usenet Network
Message-ID: <179511155798.3136.7155955737462813812@kernel.org>
References: <20261118-nb-genet-mtu-nn-v2-v8-6-68f75eadf3e2@tipi-net.de>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="2946860"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:DLg6/C3HhWKJPWtXP8+79yVJIy8= sha256:PiSfNMB6h+JUYmNiSqGVfHnfy5Nm5MM6b/QRbz4T1VI=
	sha1:lyS4nNmQBF3cRwR+cYaJPjrdasw= sha256:/fog7hpiuQXhYua/umoAd+C8qhg6XHx+x8gI8yn3P1U=
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 9BA0011572D; Thu, 19 Nov 2026 21:06:24 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.5
X-Spam-Status: No, score=-3.5 tagged_above=-9999 required=6.31
	tests=[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 G3Xhvw_qjWJp;
	Thu, 19 Nov 2026 21:06:20 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-367238-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 sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74])
	by mail.dewy.ru (Postfix) with ESMTPS id A062311572E; Thu, 19 Nov 2026 21:06:02 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sto.lore.kernel.org (Postfix) with ESMTP id 28A1866573B; Thu, 19 Nov 2026 18:06:02 +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=1795111560;
	b=K9LB5H3+XncNIr83yF3laK7wiakqKxxbAoa672DMFnqOIitdkytqOdSyvTuBqV7HC318
	 x/69MOnkebY9yoRDP7WGfvPbTfX04vtIMlV52RjnEHRo4k+CSdtzzYguJjjEOwY0ykeCy
	 ewInMEcERiNDouV+IJxQCPrYl/1Vn/ppYrMTPnEAhWlr5tbk/wCT6Q5ZybM/wWjY79r2D
	 cxb29hq7UHTU9R4G94SeBe6g+ziF9NjvWQWsnboCSgzpMBV4qcOZhd5tJRfDsuoLHEj6y
	 S8okxN2JQCpX095BdjK6s5WbVpp/wpZmUCqewWv/5wxgPGOMHwtzARWJM5fyl6+LvZw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795111560;
	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=q4x5gqZjFY/LWvZQ28+D944n8xPpX4jYSxIYgcSXumc=;
	b=xHH9yGQaY9IYm9QrAUUk13Wf0180wOdmZyqkVfj2SoHxx0wHwMYMC0ZMQkcmy87PnTFR
	 tLv8X+PYz/JBrOZKtwWYrgvN4qqNoCix0K8Q8f6nSAZ0R5srkZDAHXljDvGaVhjDEUeoJ
	 56Nyrz/krDPOTxqcol9EfrgEltmhmbNGr72kGCVkp10Dlnsj0JvhS98aadcDVXoC49wEe
	 /l5xOX35Z+9S05Yqi0ZVtEy9YBTzMShU+3xROcmMltKV03Xi24dpd2TrCzNYOiVhACbm2
	 g8eNfApcLMSkLY8CycER3xiorSKUlFn9S5AT8OBuL9IxLvcqTnzBjNJt+kKR45+tmDw==
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=du7ZAZKl;
	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 6271E606A32A;
	Thu, 19 Nov 2026 18:06:00 +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=du7ZAZKl
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=1795111559;
	b=zXDapubck/8hVn2MLISFajeFR9IAWpXmt4motr+QvmeaG+0Oggj6Ys3NC4VPmEGUryHN
	 kl3e3zMQWMqYXXcKTDgXnpXnCT4P/ofgPyZgUrX52HltNjyQx9jBv0bt3gTwdlU9GyALX
	 3z5Iuv3y0rDeJMxV4TqzI9T3LrA1YOAZsn9P1bEk/AAZxygc9PqFph0Fgp45rhYxce3mO
	 WC6rrDy+2q5k1fGOq+mn6s48tYLCWHEo7WNLKQYWiodiHdZX0XIwmcmPixqf95yHbhduw
	 XOr8dwrw15v70GUma3FS96E9BNPKUBgwix8om/TmA8JFPRhd9+5tfGet8+6c96KA7Ww==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795111559;
	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=q4x5gqZjFY/LWvZQ28+D944n8xPpX4jYSxIYgcSXumc=;
	b=yo7yLhJY6r5d8hYUo+Dc22L2gN+Gn84HFjCof/5W4DIO2sdKcDrrTzqpO6iSLJqT+Kzn
	 FcIQY0H0Z5doHFQ/c08mIyiKfWEccA+K3DqoC9toO2078e2W1gd5WGwJGueXODWZ1J/aJ
	 1r/Jt36fJ8JZR2MH6ZeanD4LcBYy5cewLZgEidsBU9m/dtmMsPxTssCl3GrLvAomrdegu
	 vh0khKROE+jUkMg+zThn2MAl2wwWJ3jwJW760SKMGukIQKUk7o7ESqOyHw6imxH12FsX7
	 d4a1L5vm+srG0JZqF7y+i6QNSDN8cQWt7jSM4I1WRtyL40/53c6I2/hIlZEWXIooqjQ==
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=du7ZAZKl;
	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 8103E606A325;
	Thu, 19 Nov 2026 18:05:59 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6C9AF1F000C6;
	Thu, 19 Nov 2026 18:05:58 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1795111559;
	bh=q4x5gqZjFY/LWvZQ28+D944n8xPpX4jYSxIYgcSXumc=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=du7ZAZKlQ4VHYLljQe6Ihb9bmuIZcDum3bxHXvU16x4+NmnaqPqDa9hH7zStCE0Qs
	 seRAUAHCXJHIf/JpaaZBlVgdmtcnScXBv+uFyGYfESH1Q8+M1zKnyKgmLq5bm6Wl/s
	 vqGqiVD19pWSB4oVPzHp4pA/c86/E7kBmxyWGvlmr4TkuhsaIfY6PfSnlEtGVJAW/L
	 lBnTx+TMV5It9CIiXLvs33VKENwUHUSsjGRZ/j5Dmye4oJcrTdzt4CJ8kTR2BnUuAY
	 Xin509C5MEQqiv1OM1+e0vtWEObPDK/VBd8VABaxvXH/gHh+Bc8VEZ+jFR2xOUEuxx
	 mfFz/jOHoHrBg==
X-Cc: opendmb@gmail.com, florian.fainelli@broadcom.com,
 bcm-kernel-feedback-list@broadcom.com, andrew+netdev@lunn.ch,
 davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com,
 f.fainelli@gmail.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
 justin.chen@broadcom.com
X-In-Reply-To: <20261118-nb-genet-mtu-nn-v2-v8-6-68f75eadf3e2@tipi-net.de>
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