Netdev List
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: nb@tipi-net.de
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
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	[thread overview]
Message-ID: <179511155798.3136.7155955737462813812@kernel.org> (raw)
In-Reply-To: <20261118-nb-genet-mtu-nn-v2-v8-6-68f75eadf3e2@tipi-net.de>

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

  reply	other threads:[~2026-11-19 18:05 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-18 15:03 [PATCH net-next v8 0/9] net: bcmgenet: support larger MTUs Nicolai Buchwitz
2026-11-18 15:03 ` [PATCH net-next v8 1/9] net: bcmgenet: ring the doorbell when the last frame of a batch is dropped Nicolai Buchwitz
2026-11-18 15:03 ` [PATCH net-next v8 2/9] net: bcmgenet: let the caller decide whether to start the PHY Nicolai Buchwitz
2026-11-18 15:03 ` [PATCH net-next v8 3/9] net: bcmgenet: allow a continuation descriptor without the alignment pad Nicolai Buchwitz
2026-11-18 15:03 ` [PATCH net-next v8 4/9] net: bcmgenet: rename ENET_MAX_MTU_SIZE to ENET_MAX_FRAME_LEN Nicolai Buchwitz
2026-11-18 15:03 ` [PATCH net-next v8 5/9] net: bcmgenet: derive the receive buffer length from the MTU Nicolai Buchwitz
2026-11-18 15:03 ` [PATCH net-next v8 6/9] net: bcmgenet: split frames that end just past the transmit threshold Nicolai Buchwitz
2026-11-19 18:05   ` netdev-bot+sashiko [this message]
2026-11-18 15:03 ` [PATCH net-next v8 7/9] net: bcmgenet: build the DMA rings before giving up the running ones Nicolai Buchwitz
2026-11-18 15:03 ` [PATCH net-next v8 8/9] net: bcmgenet: allow the MTU to be changed Nicolai Buchwitz
2026-11-18 15:03 ` [PATCH net-next v8 9/9] net: bcmgenet: reassemble jumbo frames from status block fragments Nicolai Buchwitz
2026-11-19 18:05   ` netdev-bot+sashiko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=179511155798.3136.7155955737462813812@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=f.fainelli@gmail.com \
    --cc=florian.fainelli@broadcom.com \
    --cc=justin.chen@broadcom.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nb@tipi-net.de \
    --cc=netdev@vger.kernel.org \
    --cc=opendmb@gmail.com \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox