🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #19308

Re: [PATCH net-next v8 9/9] net: bcmgenet: reassemble jumbo frames from status block fragments

#19308
From: netdev-bot+sashiko
Date: Thu, 19 Nov 2026 18:05
148 lines
13976 bytes
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
Technical Details
Message-ID: <179511155924.3136.1351414693099706913@kernel.org>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-367239-linux-kernel-netdev=dewy.ru
References: <20261118-nb-genet-mtu-nn-v2-v8-9-68f75eadf3e2@tipi-net.de>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-367239-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
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
Organization: Usenet Network
Message-ID: <179511155924.3136.1351414693099706913@kernel.org>
References: <20261118-nb-genet-mtu-nn-v2-v8-9-68f75eadf3e2@tipi-net.de>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="2946817"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:yY7GX7N1TyojKrzP6ZDDRIEOn6E= sha256:ic2byX5heXhSLLpbySLJb2f9xcUBJkvixGEqgYGPtsk=
	sha1:7XbIWTbAHUSSNH/5Q0R9Q6uk5bY= sha256:BE7EHQnRz9o970Wk+rzpYbHBl23ZQ5/6aT4WXi7S0ts=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id 82B11115731; Thu, 19 Nov 2026 21:06:24 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.4
X-Spam-Status: No, score=-3.4 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1,
	DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=kernel.org
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id cTc818K3qhXg;
	Thu, 19 Nov 2026 21:06:20 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-367239-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id 25C8711572D; Thu, 19 Nov 2026 21:06:09 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by tor.lore.kernel.org (Postfix) with ESMTP id B417C3C55D; Thu, 19 Nov 2026 18:06:05 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1795111561;
	b=W/PZWQNALQOvdHPD5Vvjwxw27qZu7flAT8PcIT87a1M7/nCjMxZ0Fyca6pmXi2j5e7ZZ
	 tAkEAPWRkdSrah1Vzp8EWRqDiRIlFkDTcngp2yi3r3Jzepa6FxjSZxKCy5nkSZwOwLf+O
	 zrQyFNukUi3aANROjUWx5DrrOAveOLoJC45TqB83OV0/uh0m+HtAXb3bvoNiV/g9vhgyE
	 CzFpuJbyBi/nhwmI9fp56cR+csyf9mUD6ueGzzalA0BHu4A4hT45m8lljrfgz8VVxDBGh
	 KZSoxWzjvu0t9EWSffDt1JyFiIDTB8oUksODN8eLe8jJITgdm5K8l41oK186GkYRwSQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795111561;
	h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc:
	 Date:Message-ID:In-Reply-To:References:X-sashiko-severity:
	 Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version;
	bh=5RIPsh6KWnZFuhCOH8kI9SZLTT1tVF/htSjtExaR9bs=;
	b=qJFmW81H2N83jCoSTPvjaEfl2TOArdXdN34nMsAXLtTZ8a2+fHi8dTQX9I3PZ+JM6HgC
	 s8wAs9jRw6Ec1aIxPAsJ/mceOZWgMuatibC8HKvwczg6x47nJkUnCgSieJksIPhyNjK3O
	 1TU/5KOzJhw97WqxmOnaqGXr3J1SgiFCxgP275FP98VASsU1nwd6vrt7Gmrwa69HAEfgs
	 rqCMo4YduhrroORzrUnN/DVbMB8R9ODlsYIA2q+tbDc9IRDadlWq2dnhcrdJ+QxQrmaAf
	 v1A5St8AgqTSdt/wbeyh7QhyEDHeXjXcVD6U+0KsUEPTvASUyW/woOmias/VLUipA6A==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=K4huWhg+;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 9014660A2608;
	Thu, 19 Nov 2026 18:06:01 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=K4huWhg+
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1795111560;
	b=VsY1h8QD1X9f2kzMCWpOEK3BzyrQqaJsVUzY6jOZz1R1n46VvkeV7K1I20TFB9ioT58S
	 Y1HEF4+EbE+Wm+KVHmnkFoTdowQxVwSg2Tx4C9rSRHyEyRo1CXp1MFkTFDR+RPkOKf+Fa
	 bXm7eNcLSMsbwBGqi2XcnfT5vBHbK9Z5MsMiB+1t5ljKwHsSdygH+0DV+m9TBEJPQ1tjJ
	 CAieo0rNsZVFzz34a5BwEOaINmJhLwkazs1VRv++Z7DlGTW55MPCdbus9dQxlCsuIjoE9
	 i1j9cssAb7g9i+Ph/cEkfLfkuLB02pDL6PttYca85hSnJAjo7ybNXi0sgqg+jEH/9HA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795111560;
	h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID:
	 In-Reply-To:References:X-sashiko-severity:Content-Type:
	 Content-Transfer-Encoding:MIME-Version;
	bh=5RIPsh6KWnZFuhCOH8kI9SZLTT1tVF/htSjtExaR9bs=;
	b=jn0hauWn/Ep8B/W7DVBClcTIgT5WqnbIiFhPSufPPFowtOaCXfKVUbYLhCZwJMaTMOfy
	 u0tVilfLFqiONgtLsm6hxxKjbAkeCdIfnn2nX2UfS+w+wy9VCjIObAisFuGzQEDwHY9Vt
	 lAHAbffM2gdYCzOa2MrC4fP8l7EJ8lFZfrrmqtMV0bNTgEqhhr3zH9HP6fBniJGprRfba
	 niRJRF5eIqeawiwftIrfe6EjIWnY9dAAqBarqEU4fx4KtOomu0A0woVUjZJfA1NR56/Po
	 tX3PUQRropOCAThimTvvZBLqMBZ5weadWc64i9culpOvOnIASA6oYA1jdBfw5s7QClA==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=K4huWhg+;
	arc=none smtp.remote-ip=100.103.45.18
X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id B0FD0606A33A;
	Thu, 19 Nov 2026 18:06:00 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id A23391F000C5;
	Thu, 19 Nov 2026 18:05:59 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1795111560;
	bh=5RIPsh6KWnZFuhCOH8kI9SZLTT1tVF/htSjtExaR9bs=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=K4huWhg+orYGjCM+QskU54Wx3tgfUOS6QJ8ZF0IVhv/b7dyu9L0sXYOMm7OGX48cM
	 aSYz/5MWb2aICcEdThoNq6KH1iZCGUaWYp/10Tfh2iELR3pc9HLPFAA+fUr1ulZ7sP
	 7y4jmeC1nyn2brmt7jUhlNLwEEGYIEvOcQ06MByvUHTL1CnKgXU3BoSVb99tjrcdfD
	 M4TJYanxcsLN4ucxGiW8pYFncWNnhpWH6e9F+zAqdMUKwn6oTNGxmb+gbnP705mnmI
	 ufTRu+ABiadEFR6n+fRWOCrmszK+i/9IrRNdXqREz7lwyebmMg4nFnk0hUnR604fz0
	 peyjFp5mDVhjg==
X-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
X-In-Reply-To: <20261118-nb-genet-mtu-nn-v2-v8-9-68f75eadf3e2@tipi-net.de>
X-sashiko-severity: Medium
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list