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 9/9] net: bcmgenet: reassemble jumbo frames from status block fragments
Date: Thu, 19 Nov 2026 18:05:59 +0000	[thread overview]
Message-ID: <179511155924.3136.1351414693099706913@kernel.org> (raw)
In-Reply-To: <20261118-nb-genet-mtu-nn-v2-v8-9-68f75eadf3e2@tipi-net.de>

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

Critical: 0 · High: 0 · Medium: 1 · Low: 1

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] bcmgenet_desc_rx() requires every continuation (non-SOP)
  descriptor to carry at least one payload byte after its 64-byte status…
- [Low] In bcmgenet.h the patch marks DMA_BUFLENGTH_MASK (0x0fff) as "RX
  status word only", and the commit message says "that mask only…

--

net: bcmgenet: reassemble jumbo frames from status block fragments

This commit reassembles RX frames that the hardware splits across several
descriptors, each starting with its own status block, instead of dropping
them as fragmented. It raises ENET_MAX_MTU to the 14-bit
UMAC_MAX_FRAME_LEN limit. It also annotates DMA_BUFLENGTH_MASK as
applying to the RX status word only.

> diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
> index 54b65edd6843e..e935beee3989a 100644
> --- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
> +++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c

[ ... ]

> @@ -2530,24 +2575,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 continuation descriptor that holds only its status block ever end
a frame?

In bcmgenet_desc_rx(), a non-SOP descriptor now needs len of at least
sizeof(struct status_64) + 1. Suppose the RBUF writes an EOP descriptor
with len == 64, i.e. only the status block carrying the final flags and
the whole-frame checksum. That descriptor fails the len < min_len check,
length_errors is incremented, and bcmgenet_discard_frags() frees the
partly reassembled ring->frag_head. The whole frame is lost.

The case at risk is a frame whose data ends exactly on a descriptor
boundary. With 4K pages, ENET_THLD_PAGE_LEN works out to 3584 on a
typical 64-bit build. The SOP descriptor then holds 3582 frame bytes
after the pad, and each continuation holds 3584. Frames of
3582 + k * 3584 bytes (7166, 10750, 14334, FCS included when crc_fwd_en
is set) fill their last data descriptor exactly.

If the hardware hands that descriptor off without EOP, the EOP can only
come in a status-only descriptor. At MTU 7152 or 10736 (untagged, FCS
stripped), every full-size frame would land on such a boundary.

The 16361 byte loopback test in the commit message works out to
3582 + 3 * 3584 + 2027, so it does not reach this boundary. The TX side
of this IP already needs a threshold-boundary workaround
(priv->tx_thld_window).

Is it known that the RBUF never produces a status-only EOP descriptor?
If it can, bcmgenet_add_frag() would need a way to take dma_flag and
rx_csum from that status block without calling skb_add_rx_frag() with a
zero length.

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

[ ... ]

> diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.h b/drivers/net/ethernet/broadcom/genet/bcmgenet.h
> index 1f48a67c5c01f..8f432a830a5a5 100644
> --- a/drivers/net/ethernet/broadcom/genet/bcmgenet.h
> +++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.h
> @@ -446,7 +446,7 @@ struct bcmgenet_rx_stats64 {
>  #define DMA_RATE_ADJ_MASK		0xFF
>  
>  /* Tx/Rx Dma Descriptor common bits*/
> -#define DMA_BUFLENGTH_MASK		0x0fff
> +#define DMA_BUFLENGTH_MASK		0x0fff	/* RX status word only */

[Severity: Low]
This isn't a bug, but is this annotation accurate? Nothing in
drivers/net/ethernet/broadcom/genet/ uses DMA_BUFLENGTH_MASK.
bcmgenet_desc_rx() gets the RX length with a bare shift:

    len = dma_length_status >> DMA_BUFLENGTH_SHIFT;

The TX path builds the length with a bare shift too:

    len_stat = (size << DMA_BUFLENGTH_SHIFT) |

The commit message says:

    The TX descriptor length field is wider than DMA_BUFLENGTH_MASK suggests,
    that mask only extracts the length from the RX status word.

Under the "Tx/Rx Dma Descriptor common bits" heading, this reads as if
the TX length field is wider on every GENET revision. The comment in
bcmgenet_probe() says otherwise:

    /* Only v5 is known to size the TBUF for a long frame and to carry the
     * full length in a transmit descriptor, the older parts stay at the
     * default MTU
     */

Could the header comment and the commit message be reworded to match
the probe comment and how the mask is actually used?

>  #define DMA_BUFLENGTH_SHIFT		16
>  #define DMA_OWN				0x8000
>  #define DMA_EOP				0x4000

[ ... ]

-- 
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:06 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
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 [this message]

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=179511155924.3136.1351414693099706913@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