๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #16658

Re: [PATCH net-next v7 5/9] net: bcmgenet: derive the receive buffer length from the MTU

#16658
From: netdev-bot+sashiko
Date: Sun, 15 Nov 2026 13:01
82 lines
11284 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] In bcmgenet_init_tx_ring()
  (drivers/net/ethernet/broadcom/genet/bcmgenet.c), the buffer-sizeโ€ฆ

--

net: bcmgenet: derive the receive buffer length from the MTU

This patch replaces the fixed 2048 byte receive buffer length with a value
taken from the MTU. The RBUF packet ready threshold is computed from the
MTU and programmed into RBUF, and the buffer length is that threshold
plus the status block. UMAC_MAX_FRAME_LEN and the TX flow period are
also derived from the MTU, with a floor at ETH_DATA_LEN.

> diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
> index b0b0d9b423482..1bb5fed4a8b4d 100644
> --- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
> +++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c

[ ... ]

> +/* A buffer has to hold everything the threshold lets the hardware deliver */
> +static unsigned int bcmgenet_rx_buf_len(unsigned int mtu)
> +{
> +	return sizeof(struct status_64) +
> +	       bcmgenet_pkt_rdy_thld(mtu) * ENET_THLD_UNIT;
> +}

[ ... ]

> @@ -2792,7 +2845,7 @@ static void bcmgenet_init_tx_ring(struct bcmgenet_priv *priv,
>  				  TDMA_FLOW_PERIOD);
>  	bcmgenet_tdma_ring_writel(priv, index,
>  				  ((size << DMA_RING_SIZE_SHIFT) |
> -				   RX_BUF_LENGTH), DMA_RING_BUF_SIZE);
> +				   priv->rx_buf_len), DMA_RING_BUF_SIZE);

[Severity: Low]
Is this change to the TX ring intended?

In bcmgenet_init_tx_ring(), the buffer size field of the TDMA
DMA_RING_BUF_SIZE register now gets priv->rx_buf_len. That value comes
from bcmgenet_rx_buf_len(), which only uses RX quantities: the RX status
block plus the RBUF packet ready threshold.

At the default MTU this is 64 + 0x80 * 16 = 2112, so the TDMA register
value goes from 0x800 to 0x840 on every interface init.

The commit message only talks about the receive side:

  "The MTU is still fixed at ETH_DATA_LEN, so the threshold comes out at
  the reset default and the buffer only grows by the status block the
  hardware already wrote."

It doesn't mention that a TX DMA register changes as well.

The TX ring already used the RX constant RX_BUF_LENGTH before this patch.
What is new here is the changed value, and the fact that the TX
programming now follows the MTU through the RX threshold and its
page-size clamp.

This line is unchanged in the later patches of the series. So once the MTU
can grow, the TDMA field keeps following bcmgenet_rx_buf_len(mtu) and not
any value picked for TX.

No functional effect has been shown. The per-descriptor TX length is in
length_status. The last patch in the series, "net: bcmgenet: reassemble
jumbo frames from status block fragments", reports 16361 byte frames
sent byte-exact over UMAC loopback while this field stays at rx_buf_len
(about 3.9K at most). That suggests the field does not limit TX.

Would it be clearer to keep a TX-specific value here? If the change is
intentional, could the commit message say so?

-- 
Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261112-nb-genet-mtu-nn-v2-v7-0-43a5d90b3256%40tipi-net.de
Technical Details
Message-ID: <179474771091.2199510.12424783948813016163@kernel.org>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-363706-linux-kernel-netdev=dewy.ru
References: <20261112-nb-genet-mtu-nn-v2-v7-5-43a5d90b3256@tipi-net.de>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-363706-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next v7 5/9] net: bcmgenet: derive the receive buffer
 length from the MTU
Date: Sun, 15 Nov 2026 13:01:50 +0000
Organization: Usenet Network
Message-ID: <179474771091.2199510.12424783948813016163@kernel.org>
References: <20261112-nb-genet-mtu-nn-v2-v7-5-43a5d90b3256@tipi-net.de>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="1804792"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:b5tmkle5hGsX6fC5eopsMCeaKRs= sha256:L1Z7cecup3jGJ50hFfTH76Ypkp1kJTrPMm+3eV22wME=
	sha1:0dq2r7BL+Sp9uGEs7j0u6pYYhW0= sha256:xI1XLZR1GRIMjdl5B0b5er0mI6mly+PveISRHNqHxeE=
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 038441149D3; Sun, 15 Nov 2026 16:02:11 +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 UR4fVSituHip;
	Sun, 15 Nov 2026 16:02:07 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-363706-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 sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id DEFD11149D1; Sun, 15 Nov 2026 16:01:55 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id B93CA38BDD; Sun, 15 Nov 2026 13:01:53 +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=1794747713;
	b=e1PP0CwbJEfAnnjTj0bKNh1Kwuhuu4RZJf6Pru87F1O8gEZivObYDOur5sdkFAIr/3dv
	 0t1lUT31XntQICxJl3jp+jZpJchd8egvpXK0BeKC1XWCvYYFjQ6Hw2xeZNCtLm3HD6ixQ
	 CbLBmqEUUFpGTFaRNuFY1640jS1HfLQmzZ7//ZAsYf/kyqiL4TY1lhv5dXRMRFg/Dez+q
	 c/ToHqKaWNJ4j775akes4OQf87kxyc2Lg1SuYuqVtRCamfq8ABORkz4S2FOoz7MOUaxcG
	 3cVXCdK4LTKRHY6Fhyb8/TJD/ZenvbW5MPmpprBrpD83sbHOJ5Xrv5FEjQ3bsSGRHYg==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794747713;
	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=gkucXmxRsiWMinqiKC7kSNxuxKvG2TjMO2LavFDIAQQ=;
	b=msRVHvnMDhD/qlmc5FT1PE8JuT/sQ1R3vcn/v17f2hHc8OqEnybjb2nA3IAnsybokHUH
	 mfvip8ONgbSwdx8x/inybRmwuI83jioF8av+2ekmG00e0PlPA3ofc2LGq5oUnAK8W2GrC
	 9bQdwipgco9pLz4W3Vz4bhJzLgMyiSkotl/zB03xjT8RzIMmcF07PjWjokp+jKFMxpnrb
	 5vNjA9X2p3vQmrv7EUZKGSTLhj3qJjsf3dXEOb/R1eySHqeZQIGQ4yMgIBmhbuipA2ahA
	 5STdIEyk9VZHT25trTxDq75CsC/PkPNkYDf8YiCl58/TKSv790bZR/4zkLHnslrk2Qg==
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=UvRf9VNZ;
	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 5FF4C606A329;
	Sun, 15 Nov 2026 13:01:53 +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=UvRf9VNZ
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=1794747712;
	b=Y3mj6J83agkSxMpctBTlY24Chys0PlB7GsIdiqYG9uahOLCHtetS6vEkXlW7bhCyR3/w
	 D/Wg8polJ2izFHCKHVsWFy3ue27k6mOytJqzyXFb7hZNjCzywCzm3RR28gGQKtBcfAF7n
	 zfwZt2HOqH2OCPzEZh4Co7BupSofLrSA0UFzgechez/OitijC0BZGqoegHfEmzqQX/gr+
	 Bb1Lecf52H1zZ3U1dJXPNHG/isehQT5zS0Qf7Zcw+14xWdw7adVOeatxkuw+zoVyzqSBx
	 glotwlxNr8HqVEyG4whcsBf2dOGIMK6iQlu5wB/MipogHYtSd3ICKgR5YQdYcyORlRQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794747712;
	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=gkucXmxRsiWMinqiKC7kSNxuxKvG2TjMO2LavFDIAQQ=;
	b=rvXNOA+U8ZvoTyaI/in5RedDADkiGQvQIU/6mvfq1ga50Y1YbfzYrOLU/yl2a0iCcg3D
	 fPJ6k3JgG7J6sJlkSCymb48kEHwC/AFIPg4k6WvPXzl2LXvZ/cU7a+rFTrJ2nMJyXooHR
	 MqyYAd+1vsun0/y1JVMol2L0xUBd1qvvYyOJEjq0psm1TFiYFfZzs5u0/gVgZmGVewI7n
	 ZBMs5POfS1CSdFpCooFyc10ax+jJTHyjBuSHKrMhFkY7PFm0R2ueCNaOby7uZXTH7QHTU
	 M9/lD7Ouca+JVGk5SdWKby5n+5h0qey/HVMEF89lW0LRIVgi/fbtd2jVkCwNQAyk5lQ==
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=UvRf9VNZ;
	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 7F29C606A31A;
	Sun, 15 Nov 2026 13:01:52 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5A8551F000C4;
	Sun, 15 Nov 2026 13:01:51 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1794747712;
	bh=gkucXmxRsiWMinqiKC7kSNxuxKvG2TjMO2LavFDIAQQ=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=UvRf9VNZG4Rh2hZUubqGZyPHK712q0hlS04qrxqK/ouc+kjGXuNpgRe0d/gf+N4pr
	 WbmvzyFb267QKUZk0O1/xsBEbXDzKv7iQXT4UQHoSSg+vZf1dN8BXth0zX1Xq4Ekmf
	 mPLpkolrkjAEh2GQ3W3suLzQYdstcUhNclXq/jiFxXaM/+DbbVexLbFu43n/fHrAc2
	 rf150opQ+15o8wjJs3idFxInYtfXo4VRoyk+pwU9Zf+hio6kZkLFstxMK1VkenRF7r
	 siELBMkgGG6ZKAX4Hr7vDRGleel/WvE01GlXTkiR5OMyiQd6Jn9dnBfJcy9bjX5usb
	 lz9kCeRo+vwLA==
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,
 pierremarinleclercq88@gmail.com, dave.stevenson@raspberrypi.com,
 justin.chen@broadcom.com
X-In-Reply-To: <20261112-nb-genet-mtu-nn-v2-v7-5-43a5d90b3256@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