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, pierremarinleclercq88@gmail.com,
	dave.stevenson@raspberrypi.com, justin.chen@broadcom.com
Subject: Re: [PATCH net-next v10 8/8] net: bcmgenet: reassemble jumbo frames from status block fragments
Date: Sat, 28 Nov 2026 11:26:08 +0000	[thread overview]
Message-ID: <179586516852.3135.10254038893964145277@kernel.org> (raw)
In-Reply-To: <20261127-nb-genet-mtu-nn-v2-v10-8-749c7cc45d97@tipi-net.de>

Thank you for your contribution! Sashiko AI review found 2 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 2 · Low: 0

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] In bcmgenet_desc_rx()
  (drivers/net/ethernet/broadcom/genet/bcmgenet.c), the patch raises the…
- [Medium] For a frame reassembled from several descriptors,
  bcmgenet_desc_rx() jumps from the bcmgenet_add_frag() path to…

--

net: bcmgenet: reassemble jumbo frames from status block fragments

GENET splits frames longer than the RX packet ready threshold across
several descriptors, each with its own status block. This patch removes
those status blocks and reassembles the fragments into one skb, which
lifts the MTU cap. The maximum MTU is now 16347, based on the 14-bit
UMAC_MAX_FRAME_LEN.

> diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
> index 1307faf135bd4..ec196a71a7347 100644
> --- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
> +++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c

[ ... ]

> @@ -2527,24 +2572,43 @@ static unsigned int bcmgenet_desc_rx(struct bcmgenet_rx_ring *ring,
>  			  __func__, p_index, ring->c_index,
>  			  ring->read_ptr, dma_length_status);
>  
> -		/* Only the first descriptor carries the alignment pad */
> -		min_len = dma_flag & DMA_SOP ? GENET_RSB_PAD
> -					     : sizeof(struct status_64);
> +		/* Only the first descriptor carries the alignment pad. A head
> +		 * with more to come needs the Ethernet header in it, a
> +		 * continuation needs at least one payload byte.
> +		 */
> +		if (dma_flag & DMA_SOP) {
> +			min_len = GENET_RSB_PAD;
> +			if (!(dma_flag & DMA_EOP))
> +				min_len += ETH_HLEN;
> +		} else {
> +			min_len = sizeof(struct status_64) + 1;
> +		}
>  
>  		/* Reject lengths that would underflow the SKB build path. */
>  		if (unlikely(len > priv->rx_buf_len || len < min_len)) {
>  			netif_err(priv, rx_status, dev,
>  				  "invalid packet length %d\n", len);
>  			BCMGENET_STATS64_INC(stats, length_errors);
> +			if ((dma_flag & DMA_SOP) && ring->frag_head)
> +				BCMGENET_STATS64_INC(stats, fragmented_errors);
> +			bcmgenet_discard_frags(ring, dma_flag & DMA_EOP);

[Severity: Medium]
Can a split frame end with a descriptor that holds only its status
block plus DMA_EOP, with no payload?

The previous patch in this series ("net: bcmgenet: allow a continuation
descriptor without the alignment pad") set the non-SOP minimum to
sizeof(struct status_64). This patch raises it to
sizeof(struct status_64) + 1.

Suppose the hardware posts an EOP descriptor with
len == sizeof(struct status_64). It would then land in this branch.
The branch logs "invalid packet length" and bumps length_errors. Then
bcmgenet_discard_frags() frees ring->frag_head, which at that point
holds every payload byte of a complete, valid frame.

That can only happen when the alignment pad plus the frame length is an
exact multiple of the RX threshold. On 4K pages the threshold is 3584
bytes, so frames of 7166, 10750 and 14334 bytes would hit it (FCS
included when crc_fwd_en is set). MTU 9000 and MTU 16347 can both reach
these sizes.

The 16361 byte loopback test in the commit message doesn't fall on one
of these boundaries.

Would it make sense to accept len == sizeof(struct status_64) with
DMA_EOP as an empty terminator? bcmgenet_add_frag() would add no frag
and deliver frag_head with that descriptor's checksum. Or can Broadcom
confirm that the hardware never emits such a descriptor?

>  			page_pool_put_full_page(ring->page_pool, rx_page,
>  						true);
>  			goto next;
>  		}

[ ... ]

> @@ -2574,17 +2638,27 @@ static unsigned int bcmgenet_desc_rx(struct bcmgenet_rx_ring *ring,
>  						DMA_RX_RXER)) == DMA_RX_RXER)
>  				u64_stats_inc(&stats->errors);
>  			u64_stats_update_end(&stats->syncp);
> +			bcmgenet_discard_frags(ring, dma_flag & DMA_EOP);
>  			page_pool_put_full_page(ring->page_pool, rx_page,
>  						true);
>  			goto next;
>  		} /* error packet */
>  
> +		if (!(dma_flag & DMA_SOP)) {
> +			skb = bcmgenet_add_frag(ring, rx_page, rx_offset,
> +						rx_size, dma_flag, len);
> +			if (!skb)
> +				goto next;
> +			goto deliver;
> +		}

[Severity: Medium]
For a reassembled frame, dma_flag at the deliver label holds the status
word of the final EOP descriptor. The stats code in bcmgenet_desc_rx()
then does:

	if (dma_flag & DMA_RX_MULT)
		u64_stats_inc(&stats->multicast);
	else if (dma_flag & DMA_RX_BRDCAST)
		u64_stats_inc(&stats->broadcast);

The commit message says the status blocks of a split frame differ
("Only the last block holds the checksum of the whole frame"). It
doesn't say which block carries the DMA_RX_MULT and DMA_RX_BRDCAST
classification. The MAC already has that from the destination address
when it writes the SOP block.

If these flags are set only in the SOP status block, would jumbo
multicast and broadcast frames go uncounted in stats->multicast and
stats->broadcast?

Could the SOP descriptor's flags be saved when frag_head is set up and
used here instead?

>  
>  		/* Build SKB from the page - data starts at hard_start,
>  		 * frame begins after RSB(64) + pad(2) = 66 bytes.
>  		 */

[ ... ]

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261127-nb-genet-mtu-nn-v2-v10-0-749c7cc45d97%40tipi-net.de

  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
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 [this message]
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=179586516852.3135.10254038893964145277@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