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, pierremarinleclercq88@gmail.com,
dave.stevenson@raspberrypi.com, justin.chen@broadcom.com
Subject: Re: [PATCH net-next v10 5/8] net: bcmgenet: split frames that end just past the transmit threshold
Date: Sat, 28 Nov 2026 11:26:05 +0000 [thread overview]
Message-ID: <179586516579.3135.9485431888259061826@kernel.org> (raw)
In-Reply-To: <20261127-nb-genet-mtu-nn-v2-v10-5-749c7cc45d97@tipi-net.de>
Thank you for your contribution! Sashiko AI review found 4 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 1 · Low: 3
If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).
- [Medium] The transmit stall window is extrapolated, not measured, on
every GENET that programs a DMA burst of 0x10.
- [Low] bcmgenet_xmit() now calls skb_checksum_help() for any
CHECKSUM_PARTIAL frame with skb->len > priv->tx_thld_len, and it does…
- [Low] (Baseline decision: not a functional bug; kept because
requires_validation=true.) bcmgenet_set_mtu_regs() now writes…
- [Low] (Baseline decision: not a bug; kept because
requires_validation=true.) bcmgenet_set_mtu_regs() sets…
--
net: bcmgenet: split frames that end just past the transmit threshold
Transmit frames that end just past the TBUF packet ready threshold are now
split over two descriptors that share one DMA mapping. This avoids a
transmitter stall after which Tx DMA refuses to halt. The patch also
programs TBUF_PKT_RDY_THLD based on the MTU, and frames longer than the
threshold fall back to a software checksum.
Link: https://github.com/raspberrypi/linux/pull/7617#issuecomment-6201096155
> diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
> index 15b7c8a525201..5ad38b4eccd1e 100644
> --- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
> +++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
> @@ -65,6 +65,13 @@
> #define ENET_THLD_DEFAULT 0x80
> #define ENET_THLD_MAX 0xf0
>
> +/* A frame that ends within one DMA transfer past the transmit threshold
> + * stops the transmitter once a shorter frame follows. The burst register
> + * has no documented unit, 8 bytes per count matches the 46 bytes measured
> + * on a bcm2711, which programs 0x08.
> + */
> +#define ENET_BURST_UNIT 8
[Severity: Medium]
bcmgenet_probe() computes the window for every part as:
priv->tx_thld_window = priv->dma_max_burst_length * ENET_BURST_UNIT;
The 8 bytes per count comes from a single bcm2711 measurement at burst
0x08. The commit message says the bcm2711 sends nothing at 0x10, so the
0x10 case (16 * 8 = 128 bytes) was never measured.
The 46 byte result shows the unit is at least about 5.75 bytes per count.
Does it show that the unit is exactly 8, or that the window grows linearly
with the burst count?
v5_plat_data and bcm7712_plat_data both use DMA_MAX_BURST_LENGTH (0x10).
Their real window could be wider than 128 bytes, for example because of a
wider bus. In that case bcmgenet_xmit() would send a frame with
tx_thld_len + tx_thld_window <= skb->len < real window end
without splitting it. If a shorter frame follows, wouldn't that bring back
the Tx DMA stall where every later bcmgenet_init_dma() fails?
Later in the series, "net: bcmgenet: allow the MTU to be changed" raises
max_mtu for every GENET_IS_V5() part, so this becomes reachable on those
0x10 parts. Has the window been verified on any part that programs 0x10?
[ ... ]
> @@ -2185,7 +2207,7 @@ static netdev_tx_t bcmgenet_xmit(struct sk_buff *skb, struct net_device *dev)
> }
>
> spin_lock(&ring->lock);
> - if (ring->free_bds <= (nr_frags + 1)) {
> + if (ring->free_bds <= (nr_frags + 1 + split)) {
> if (!netif_tx_queue_stopped(txq))
> netif_tx_stop_queue(txq);
> ret = NETDEV_TX_BUSY;
[ ... ]
> @@ -2202,6 +2224,20 @@ static netdev_tx_t bcmgenet_xmit(struct sk_buff *skb, struct net_device *dev)
> goto out;
> }
>
> + /* The MAC inserts a checksum only into a frame it holds in full and
> + * silently drops a longer one, so fall back to software.
> + */
> + if (unlikely(skb->len > priv->tx_thld_len) &&
> + skb->ip_summed == CHECKSUM_PARTIAL) {
> + if (skb_checksum_help(skb)) {
[Severity: Low]
This calls skb_checksum_help() with ring->lock held. For a jumbo frame it
checksums the whole payload, and it may also linearize the skb or expand
its head. Meanwhile bcmgenet_tx_poll() and bcmgenet_tx_reclaim() spin on
the same ring->lock.
The checksum depends only on the skb, which xmit already owns. Could it run
outside the critical section? One option is to clear NETIF_F_CSUM_MASK in
an ndo_features_check callback when skb->len > tx_thld_len, so that
validate_xmit_skb() does the fallback before the driver is entered.
At this commit the path is dormant because the MTU is capped at
ETH_DATA_LEN. Once the larger MTU is allowed, it applies to every
CHECKSUM_PARTIAL frame above the threshold.
[ ... ]
> @@ -2691,6 +2772,17 @@ static unsigned int bcmgenet_pkt_rdy_thld(unsigned int mtu)
> ENET_THLD_MAX_LEN / ENET_THLD_UNIT);
> }
>
> +/* The transmit threshold in register units. Keep the reset value while the
> + * MTU has no use for more, the hardware never reaches it below ETH_DATA_LEN.
> + */
> +static unsigned int bcmgenet_tx_pkt_rdy_thld(unsigned int mtu)
> +{
> + if (mtu <= ETH_DATA_LEN)
> + return ENET_THLD_DEFAULT;
> +
> + return ENET_THLD_MAX;
> +}
[Severity: Low]
This isn't a functional bug, but the comment says the reset value is kept.
The function actually returns a fixed ENET_THLD_DEFAULT (0x80), and the
commit message only confirms 0x80 as the reset value on v5.
bcmgenet_set_mtu_regs() now writes this value on v2-v4 too, and their
reset value isn't documented in the tree. At MTU <= ETH_DATA_LEN no frame
reaches 2048 bytes, so behaviour on those parts shouldn't change.
Could the comment say that a fixed value is written?
> @@ -2701,8 +2793,10 @@ static unsigned int bcmgenet_rx_buf_len(unsigned int mtu)
> /* 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 */
> @@ -2710,6 +2804,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 priv->tx_thld_len is set before the GENET_IS_V1()
early return. On v1 the cached value is never written to
TBUF_PKT_RDY_THLD, yet bcmgenet_xmit() still uses it for the split and
software checksum decisions.
v1 never gets an MTU above ETH_DATA_LEN in this series, so tx_thld_len
stays at 2048 and neither path can run.
Would a short comment noting that the value has no effect on v1 help
future readers?
[ ... ]
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261127-nb-genet-mtu-nn-v2-v10-0-749c7cc45d97%40tipi-net.de
next prev parent reply other threads:[~2026-11-28 11:26 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-27 11:25 [PATCH net-next v10 0/8] net: bcmgenet: support larger MTUs Nicolai Buchwitz
2026-11-27 11:25 ` [PATCH net-next v10 1/8] net: bcmgenet: let the caller decide whether to start the PHY Nicolai Buchwitz
2026-11-27 11:25 ` [PATCH net-next v10 2/8] net: bcmgenet: allow a continuation descriptor without the alignment pad Nicolai Buchwitz
2026-11-28 11:26 ` netdev-bot+sashiko
2026-11-27 11:25 ` [PATCH net-next v10 3/8] net: bcmgenet: rename ENET_MAX_MTU_SIZE to ENET_MAX_FRAME_LEN Nicolai Buchwitz
2026-11-28 11:26 ` netdev-bot+sashiko
2026-11-27 11:25 ` [PATCH net-next v10 4/8] net: bcmgenet: derive the receive buffer length from the MTU Nicolai Buchwitz
2026-11-28 11:26 ` netdev-bot+sashiko
2026-11-27 11:25 ` [PATCH net-next v10 5/8] net: bcmgenet: split frames that end just past the transmit threshold Nicolai Buchwitz
2026-11-28 11:26 ` netdev-bot+sashiko [this message]
2026-11-28 13:04 ` Nicolai Buchwitz
2026-11-27 11:25 ` [PATCH net-next v10 6/8] net: bcmgenet: build the DMA rings before giving up the running ones Nicolai Buchwitz
2026-11-27 11:25 ` [PATCH net-next v10 7/8] net: bcmgenet: allow the MTU to be changed Nicolai Buchwitz
2026-11-28 11:26 ` netdev-bot+sashiko
2026-11-28 13:07 ` Nicolai Buchwitz
2026-11-27 11:25 ` [PATCH net-next v10 8/8] net: bcmgenet: reassemble jumbo frames from status block fragments Nicolai Buchwitz
2026-11-28 11:26 ` netdev-bot+sashiko
2026-11-28 13:12 ` Nicolai Buchwitz
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=179586516579.3135.9485431888259061826@kernel.org \
--to=netdev-bot+sashiko@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=dave.stevenson@raspberrypi.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 \
--cc=pierremarinleclercq88@gmail.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