🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #13444

[PATCH net v2 2/2] net: bcmgenet: flatten frames that cannot fit the ring

#13444
From: Nicolai Buchwitz
Date: Mon, 09 Nov 2026 21:53
50 lines
10102 bytes
bcmgenet_xmit() wants one descriptor more than the frame needs. A 31
fragment frame needs 32 descriptors, so it is refused on a 32 descriptor
ring, even if the ring is empty.

As a result nothing is in flight which could wake the queue again. The
watchdog can only hand the same frame back, therefore the queue stays
stopped.

This needs CONFIG_MAX_SKB_FRAGS >= 31 and a sender which fragments that
finely, for example MSG_ZEROCOPY.

Linearize those frames instead.

Fixes: 3948b05950fd ("net: introduce a config option to tweak MAX_SKB_FRAGS")
Signed-off-by: Nicolai Buchwitz <nb@tipi-net.de>
---
 drivers/net/ethernet/broadcom/genet/bcmgenet.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
index 9049822012d13..61f5a4c2f0cd9 100644
--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
@@ -2143,6 +2143,22 @@ static netdev_tx_t bcmgenet_xmit(struct sk_buff *skb, struct net_device *dev)
 
 	nr_frags = skb_shinfo(skb)->nr_frags;
 
+	/* The check below would always refuse this frame */
+	if (unlikely(nr_frags + 1 >= ring->size)) {
+		skb = skb_share_check(skb, GFP_ATOMIC);
+		if (skb && skb_linearize(skb)) {
+			dev_kfree_skb_any(skb);
+			skb = NULL;
+		}
+		if (!skb) {
+			spin_lock(&ring->lock);
+			BCMGENET_STATS64_INC((&ring->stats64), dropped);
+			ret = NETDEV_TX_OK;
+			goto out;
+		}
+		nr_frags = 0;
+	}
+
 	spin_lock(&ring->lock);
 	if (ring->free_bds <= (nr_frags + 1)) {
 		if (!netif_tx_queue_stopped(txq))

-- 
2.53.0
Technical Details
Message-ID: <20261109-nb-genet-txq-thld-net-v2-2-efd8f4be96f2@tipi-net.de>
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-359631-linux-kernel-netdev=dewy.ru
References: <20261109-nb-genet-txq-thld-net-v2-0-efd8f4be96f2@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-359631-linux-kernel-netdev=dewy.ru
From: nb@tipi-net.de (Nicolai Buchwitz)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net v2 2/2] net: bcmgenet: flatten frames that cannot fit
 the ring
Date: Mon, 09 Nov 2026 22:53:02 +0100
Organization: Usenet Network
Message-ID: <20261109-nb-genet-txq-thld-net-v2-2-efd8f4be96f2@tipi-net.de>
References: <20261109-nb-genet-txq-thld-net-v2-0-efd8f4be96f2@tipi-net.de>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit
Injection-Info: usenet.network;
	logging-data="458551"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:wf9aggN3QcYYqhZyy0O0B0ls1wE= sha256:zQtk9m4t5VB9pXAzGgEaIzsZULC61fpICnAcP3jZ1YQ=
	sha1:rICV5mCaz15B0Ep35C4WdwqTgTg= sha256:VojeGDQT2XDiUQEa2AvF247Ljpg4TpxTDxioxnoW08M=
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 47AA811394C; Tue, 10 Nov 2026 00:54:20 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.051
X-Spam-Status: No, score=-3.051 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, 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 Ru9-575orqor;
	Tue, 10 Nov 2026 00:54:17 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-359631-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 sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 3B56B113949; Tue, 10 Nov 2026 00:54:08 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id 7DF838897D; Mon,  9 Nov 2026 21:53:21 +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=1794261200;
	b=tIEkE7p28ohzD4SwaWJPwncux68BEczk/112U/DDkCapuJLpGaWq5YpTWN0LLBAw7719
	 4myOjytzAMJrtbcRdvUDubQNHjHU/HCC/iMCivlhKdDgovGqNNbixkmBIdKMvr10Y8Pgr
	 O35tm93aZbvc9+eRQTt+O9TtJCQUoszZQWsLf0asFW7bdF4ynoz7nT7OQDGQVEE+ucwn0
	 xdQ2xlc8FB39Rm2p1jQ39yS5jqKv8YR96mplwRRnbb8GST9B2gHiXSRN9vZvwzLGHtFtZ
	 jVJCVN88jqIxqVV2z4XSm4ZszodLkX9sGxCi6172VpWmhvzxUhMjD+WL9/zGurD63iQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794261200;
	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=0Ke7eQAZpCZdUlSdEyb4HjoREhDwF5L3xJDmT+ObenI=;
	b=GqNnn0x5dgUKSinau1oVuyB7Uu+N3JyXdiUqmSa3aMUr7oE1kVIMM4ok8MQRGBKNuqeH
	 /j/2QZ9GsLXqdOy3RcS0dInNpsrnNKbhLSyVOjSyAz5IGiPLUmy1hsk/YOyBQQSWxwEsX
	 n5dTKVfggUm2nINH141dZqxhaTdzppjJYoTE0cztPrS2CWOU8AlM+tMYmFx0RvFsjRmHf
	 n0YOI9rOjXqXzdugmKkrC2zqhTbOibMPwSv3eXEJ60n6X/UHju5dg8OX+YoD9UW0ql0XG
	 mOLjJdASpARZGV/ifRmko7lDyvvGhEg9oaCcseCxkDePS7FHysq/yOjLyGvVpeXWcxg==
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=lmJAwbTU;
	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 8C28660A260B;
	Mon,  9 Nov 2026 21:53:20 +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=lmJAwbTU
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=1794261194;
	b=LJ7kFpQrUwd5NRPoseP/FLys5ta5BqP7s8LAmLWgAlbk4JRne6E7KxAZ73akOmXY94Fh
	 4GzqWmhCDOAgZnI+oS19Lo0R/keZBCLzHjaOLqt25qt68SMkUco42lPujwTdRkxCrnaMc
	 s7S+rRAKGMVN735WH+FyebQlQZr/XmBR1+9SzGWInpGYyBvkok4eTQs7nydsS0uTrwYH+
	 ujDbfekER53+Z+uy07xhlU3i5ZfClKfTgNF/obivTp0uYrSvOU81RlQKCsynlT+4DhUm5
	 MwG6S8Nbb+U2MTxpB8gpEoeZLHzR80Bnx61dU9H8zDGtLrB5mjYq9SYGdwQLPEaSyaA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794261194;
	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=0Ke7eQAZpCZdUlSdEyb4HjoREhDwF5L3xJDmT+ObenI=;
	b=CwVRFzx10Wp3nmNS8F6LCcl91825erCyRfvrkH9M6YwAJNjPnTcQfhzKmFb2bxfErvz4
	 GMjVo6shkPVGe+QKrCSiKEjxFYJytv+E64iDKFfx8Sy2eQ8SjYJSQC1MhB4A5HcKL+ibA
	 79Od6xNE/Ikpv3ovwGkZeJSTm2wFSwwsWI3wdON6MqDhOelNHHUwGNqVoKLSAvpsLjNYw
	 1K5oLKlabvv3R/GMEaxAOibO4Dqgj11eBqy5Vsi6dCuXpuX1eLPmoL/Dl5W2DJP1XEX0n
	 e0EUpwNmhCSF3q8kKTfBfmYPNr/8Njh8+aarTvCX/50luzWx3HJtMnhtLIypzPcKQsw==
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=lmJAwbTU;
	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 74DB0606A326;
	Mon,  9 Nov 2026 21:53:13 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 74DB0606A326
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 58E63A160B;
	Mon, 09 Nov 2026 22:53:11 +0100 (CET)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tipi-net.de; s=dkim;
	t=1794261191; h=from:subject:date:message-id:to:cc:mime-version:content-type:
	 content-transfer-encoding:in-reply-to:references;
	bh=0Ke7eQAZpCZdUlSdEyb4HjoREhDwF5L3xJDmT+ObenI=;
	b=lmJAwbTUPa39OyTW+/JxZL7ICCV6c+9LFj6VZTwXaBknf+N7laGJn49T9bbkJReO89pB87
	DvoZ9bBUu1DzWw/F5DHXBSzw3jUX1WHMiKnma3pqn8m3BPGQb5LJesqERkBKyoAm+fGA2s
	0Gr5atnQ6wgKA/8VmZbVh/3TP4PLxDBWix1OcQLoMJmx684CNrpx87K1qOHWyxzt9Gt7mI
	YKOhMjAvdxUIfJVoJTy1sxJvARGfOxEFpT4GyncH/ZtPk/MBRCf4yGZGeZRZ0s998u+LZ1
	FceTIquVwq3H9tE48H3EawkVAJPvGmSHZDe/ihCYcRITvlHtQ4rUO7a6bVtEtQ==
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: <20261109-nb-genet-txq-thld-net-v2-0-efd8f4be96f2@tipi-net.de>
X-Cc: Justin Chen <justin.chen@broadcom.com>, 
 Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com>, 
 Nikolay Aleksandrov <razor@blackwall.org>, 
 Jason Xing <kerneljasonxing@gmail.com>, netdev@vger.kernel.org, 
 linux-kernel@vger.kernel.org, Nicolai Buchwitz <nb@tipi-net.de>
X-Mailer: b4 0.16.0
X-Last-TLS-Session-Version: TLSv1.3