Re: [PATCH net-next v8 6/9] net: bcmgenet: split frames that end just past the transmit threshold
From: netdev-bot+sashiko
Date: Thu Nov 19 2026 - 13:06:12 EST
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