🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #15068

[PATCH net-next v7 3/9] net: bcmgenet: allow a continuation descriptor without the alignment pad

#15068
From: Nicolai Buchwitz
Date: Thu, 12 Nov 2026 10:45
58 lines
10647 bytes
A frame longer than the packet ready threshold arrives in several
descriptors, each with its own status block. Only the first one also
carries the two alignment bytes. The length check assumes the pad is always
there, so a continuation holding a single byte looks a byte too short and
the whole frame is dropped.

Account for the pad on the first descriptor only.

The MTU cannot produce a frame past the threshold yet, so nothing hits this
today. It is preparation for the larger MTU.

Tested-by: Pierre-Marin Leclercq <pierremarinleclercq88@gmail.com>
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
Signed-off-by: Nicolai Buchwitz <nb@tipi-net.de>
---
 drivers/net/ethernet/broadcom/genet/bcmgenet.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
index 4c2a38eaab108..d4eac993368fe 100644
--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
@@ -53,7 +53,8 @@
 
 /* Page pool RX buffer layout:
  * RSB(64) + pad(2) | frame data | skb_shared_info
- * The HW writes the 64B RSB + 2B alignment padding before the frame.
+ * The HW writes the 64B RSB before every descriptor of a frame. Only the
+ * first one also gets the 2B alignment padding.
  */
 #define GENET_RSB_PAD		(sizeof(struct status_64) + 2)
 
@@ -2363,6 +2364,7 @@ static unsigned int bcmgenet_desc_rx(struct bcmgenet_rx_ring *ring,
 		unsigned int rx_offset, rx_size;
 		struct status_64 *status;
 		struct page *rx_page;
+		unsigned int min_len;
 		void *hard_start;
 		__be16 rx_csum;
 
@@ -2399,8 +2401,12 @@ 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);
+
 		/* Reject lengths that would underflow the SKB build path. */
-		if (unlikely(len > RX_BUF_LENGTH || len < GENET_RSB_PAD)) {
+		if (unlikely(len > RX_BUF_LENGTH || len < min_len)) {
 			netif_err(priv, rx_status, dev,
 				  "invalid packet length %d\n", len);
 			BCMGENET_STATS64_INC(stats, length_errors);

-- 
2.53.0
Technical Details
Message-ID: <20261112-nb-genet-mtu-nn-v2-v7-3-43a5d90b3256@tipi-net.de>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!nntp.comgw.net!eternal-september.org!feeder.eternal-september.org!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-361725-linux-kernel-netdev=dewy.ru
References: <20261112-nb-genet-mtu-nn-v2-v7-0-43a5d90b3256@tipi-net.de>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!nntp.comgw.net!eternal-september.org!feeder.eternal-september.org!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-361725-linux-kernel-netdev=dewy.ru
From: nb@tipi-net.de (Nicolai Buchwitz)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net-next v7 3/9] net: bcmgenet: allow a continuation
 descriptor without the alignment pad
Date: Thu, 12 Nov 2026 11:45:17 +0100
Organization: Usenet Network
Message-ID: <20261112-nb-genet-mtu-nn-v2-v7-3-43a5d90b3256@tipi-net.de>
References: <20261112-nb-genet-mtu-nn-v2-v7-0-43a5d90b3256@tipi-net.de>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit
Injection-Info: usenet.network;
	logging-data="1066329"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:vcxXHog+gEnWBBzfCIDeDvx4g5c= sha256:31T1mTMdGQks7KoOx7pMO9uiEgD3FCato7lw7iaKYpQ=
	sha1:lfuy1uX1M9K/G0tJMlHzg0oWsj0= sha256:Kt5ebuQ7vGrubGYLC1zzPPem+Wc7dKHUroOWgfbLhU8=
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 CD1B51141D4; Thu, 12 Nov 2026 13:55:30 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.151
X-Spam-Status: No, score=-3.151 tagged_above=-9999 required=6.31
	tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
	HEADER_FROM_DIFFERENT_DOMAINS=0.249, MAILING_LIST_MULTI=-1,
	RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001]
	autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=tipi-net.de
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 DXQeT5nXwrTR;
	Thu, 12 Nov 2026 13:55:28 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-361725-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=none (p=none dis=none) header.from=tipi-net.de
X-Received: from sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74])
	by mail.dewy.ru (Postfix) with ESMTPS id EF6AE1141AE; Thu, 12 Nov 2026 13:55:19 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sto.lore.kernel.org (Postfix) with ESMTP id C506264260F; Thu, 12 Nov 2026 10:46:33 +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=1794480334;
	b=xw6iiee+UQV+92YSLFwg97ZWRRRiMY0/zmYgYsCiGmEe0Nnv83oPydKPC1RxAz9WrrpE
	 2n4A6LIjSG4Hs8FqsXWnWtp33vWdu0eU3VPgILyDlCM8YbUQrUq/66M+lmpWo9iwh1+ue
	 ke8LDMCU7c5qum4pKHlPSHjmyxuDsl9Vm6VYkXye6uhAGkYacmAprcss9iAuJlZLoQHHg
	 KDt7i61LZyYBY/lJV3g0Uj4wy1+S89uaul1WlWlnhefVDUy8RaAHwCXpD2KA6gWTSTLri
	 TDsUtQuBUexX4i/RUxNiI0/D4A1+qF6ibFGXz/uA4WXuW9l8ucIQQde/dr0wl+ISIeQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794480334;
	h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:From:
	 Date:Subject:X-Mailing-List:List-Id:List-Post:List-Help:
	 List-Subscribe:List-Unsubscribe:List-Owner:Precedence:MIME-Version:
	 Content-Type:Content-Transfer-Encoding:Message-Id:References:
	 In-Reply-To:To:Cc:X-Mailer:X-Last-TLS-Session-Version;
	bh=IFMeZbLIaegiXj/zfONdiWfOWMlEVj7LkVrGQYZjHPg=;
	b=x+oq0J4av0fhTzT8agG/LB2lTV4zzkC4CFFB+edis/t+462bOb2C9c5fb+E+vhEG/Shu
	 /uQ+2oPJDSwo6e5/TXFLsSjgTNTMJqC5HjagLGVsRADf9PxYRyUB9kQbiMCuH8qkQd1UX
	 y+2HHQ/bnRa77ZkSjKadx2NmIRX6DBNF4DBWQzwIkaYa5O4VnCGT+vGJ7O2IfJUy0uCzj
	 byZGb0pYKIzJ/ZXKH9cspu6hFhjRIwAJeFc/eXO0mkNpwAxac1O+Xm3pf/tNnazIQ2eVc
	 /Z5tIdCoSNoZufbWstP41fW8+lkEsardj1PSdCg3Y05w6xYYbxZJFne5TzR4MHxj+/g==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=tipi-net.de header.i=@tipi-net.de header.a=rsa-sha256 header.s=dkim header.b=yQtAWMRm;
	dmarc=none header.from=tipi-net.de;
	spf=pass smtp.mailfrom=tipi-net.de;
	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 CA30760A3829;
	Thu, 12 Nov 2026 10:45:34 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=tipi-net.de header.i=@tipi-net.de header.a=rsa-sha256 header.s=dkim header.b=yQtAWMRm
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=194.13.80.246
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1794480329;
	b=yDRAzsQXO6RDSkAaqXPwKR7t8xB6RoGGpUY0KAkgd9pIybRr4NPCayhq6CIsjjQoNS30
	 T8AjmLutkwfdPfJe4e6b0jotS+ggYonf2lTwU0XXhOdU9C9YDDgA9UdC1KvgbxLSJTDv8
	 lCeg671aFC1qFGx3yuLh3qmw0KecfA4wK/MyaaqX3Xl/ikVYoCfSx9Gg2YfVDAREnJdhw
	 nDJypfSvlJO/mpRuFzlrvZgDR9Ne2tBSMcA1VT86sRJY9SSJ4i/Lzxi/V2JDeRZjiHshD
	 FqQFoz7/63/YHk62brOx/HldHl41EZJ+ZUnPOSo+9SvLW2mwVySE0Ddr6OjR6gGn6qQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794480329;
	h=DMARC-Filter:Received:DKIM-Signature:From:Date:Subject:MIME-Version:
	 Content-Type:Content-Transfer-Encoding:Message-Id:References:
	 In-Reply-To:To:Cc:X-Mailer:X-Last-TLS-Session-Version;
	bh=IFMeZbLIaegiXj/zfONdiWfOWMlEVj7LkVrGQYZjHPg=;
	b=aMJgZhlxA8v3fOVN9ZexEpFBcZNEZDK21QZ1+63aKwaUQwOPx0YtNbrU5mDwECT7gpgh
	 AdGUwHngCUdQOI/UwMIIy3y623UJ3gqVnhoQcIWqWnweZSbBPJXNXBvLp5ecfnpyswboH
	 wKuc6NmNJ6S6g3fH+WKfN8V6yx937HkkuyR1OwFv+x1qFW2KENJFcR7ZvxDa+q/QMqjsJ
	 q2xEWyv31tkERBnolFv6lNOORu/CpW7BSYrJfiNbzVg8SWXYpRPNO/dqkLqSNxV5RCqcd
	 LBudiVvICFprPuLsKQvlXCfFD/gpPcqaR8OErTztmF/lmEEP9O9w1fduTqUMQw8J81w==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=none header.from=tipi-net.de;
	spf=pass smtp.mailfrom=tipi-net.de;
	dkim=pass header.d=tipi-net.de header.i=@tipi-net.de header.a=rsa-sha256 header.s=dkim header.b=yQtAWMRm;
	arc=none smtp.remote-ip=194.13.80.246
X-Received: from mail.tipi-net.de (mail.tipi-net.de [194.13.80.246])
	(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 7C950606A891;
	Thu, 12 Nov 2026 10:45:28 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 7C950606A891
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tipi-net.de
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=tipi-net.de
X-Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 63431A50BD;
	Thu, 12 Nov 2026 11:45:26 +0100 (CET)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tipi-net.de; s=dkim;
	t=1794480326; h=from:subject:date:message-id:to:cc:mime-version:content-type:
	 content-transfer-encoding:in-reply-to:references;
	bh=IFMeZbLIaegiXj/zfONdiWfOWMlEVj7LkVrGQYZjHPg=;
	b=yQtAWMRmUD2W7RApt6ZOHZ8lNuZFaU+6mSI/rbv4R8Rt51MDKGZHgLi06+B8yWDqJ+2LI/
	A7xBR0Uafj0dAAWykU9jP5GHOVin/aZnmlH/SPHqKJTUUzWwAMaBy5bBeaTFQcZC3rlWQF
	HtPg6mpOcxKQVF+NafHkNFiXKCWa6r36kSxGXKYF3kJomMHt0JtHe0aIbH6Xz8Gh76M7xZ
	Amm5DgpgBpGFa/gosoz03syIyQ/Nz0nOr00apv7V/tyIz3LmlmFMHSe9atGzCioNnj1DPI
	ZSXlbLKVugH/nKi2Zbx/Fny2HwWsAzkDeSm1TCw5q6iUgX1nNPtoi37Knaaw8Q==
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
X-In-Reply-To: <20261112-nb-genet-mtu-nn-v2-v7-0-43a5d90b3256@tipi-net.de>
X-Cc: Florian Fainelli <f.fainelli@gmail.com>, netdev@vger.kernel.org, 
 linux-kernel@vger.kernel.org, 
 Pierre-Marin Leclercq <pierremarinleclercq88@gmail.com>
X-Mailer: b4 0.16.0
X-Last-TLS-Session-Version: TLSv1.3