🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #13443

[PATCH net v2 1/2] net: bcmgenet: cap the Tx queue threshold at the ring size

#13443
From: Nicolai Buchwitz
Date: Mon, 09 Nov 2026 21:53
68 lines
11476 bytes
A Tx queue stops when MAX_SKB_FRAGS + 1 or fewer descriptors are free and
wakes once there are more. Queues 1 to 4 hold 32 descriptors, so with
CONFIG_MAX_SKB_FRAGS at 31 they would need 33 to wake. As a result the
first packet stops the queue and it stays stopped:

  eth0: NETDEV WATCHDOG: CPU: 0: transmit queue 3 timed out 2004 ms
  eth0: NETDEV WATCHDOG: CPU: 1: transmit queue 4 timed out 2004 ms

On a Raspberry Pi CM4 only queue 0 carried traffic afterwards. The other
four counted an error on nearly every packet.

Fix this and cap the threshold at what the ring can free.

Fixes: 3948b05950fd ("net: introduce a config option to tweak MAX_SKB_FRAGS")
Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
Signed-off-by: Nicolai Buchwitz <nb@tipi-net.de>
---
 drivers/net/ethernet/broadcom/genet/bcmgenet.c | 6 ++++--
 drivers/net/ethernet/broadcom/genet/bcmgenet.h | 1 +
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
index 4d2be2a21ed1b..9049822012d13 100644
--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
@@ -2030,7 +2030,7 @@ static int bcmgenet_tx_poll(struct napi_struct *napi, int budget)
 
 	spin_lock(&ring->lock);
 	__bcmgenet_tx_reclaim(ring->priv->dev, ring);
-	if (ring->free_bds > (MAX_SKB_FRAGS + 1)) {
+	if (ring->free_bds > ring->stop_thld) {
 		txq = netdev_get_tx_queue(ring->priv->dev, ring->index);
 		netif_tx_wake_queue(txq);
 	}
@@ -2235,7 +2235,7 @@ static netdev_tx_t bcmgenet_xmit(struct sk_buff *skb, struct net_device *dev)
 
 	netdev_tx_sent_queue(txq, GENET_CB(skb)->bytes_sent);
 
-	if (ring->free_bds <= (MAX_SKB_FRAGS + 1))
+	if (ring->free_bds <= ring->stop_thld)
 		netif_tx_stop_queue(txq);
 
 	if (!netdev_xmit_more() || netif_xmit_stopped(txq))
@@ -2742,6 +2742,8 @@ static void bcmgenet_init_tx_ring(struct bcmgenet_priv *priv,
 	ring->index = index;
 	ring->cbs = priv->tx_cbs + start_ptr;
 	ring->size = size;
+	/* An empty ring must be able to wake the queue */
+	ring->stop_thld = min_t(unsigned int, MAX_SKB_FRAGS + 1, size - 1);
 	ring->clean_ptr = start_ptr;
 	ring->c_index = 0;
 	ring->free_bds = size;
diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.h b/drivers/net/ethernet/broadcom/genet/bcmgenet.h
index e48ce39d3e7c8..6ab3f73475550 100644
--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.h
+++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.h
@@ -546,6 +546,7 @@ struct bcmgenet_tx_ring {
 	unsigned int	index;		/* ring index */
 	struct enet_cb	*cbs;		/* tx ring buffer control block*/
 	unsigned int	size;		/* size of each tx ring */
+	unsigned int	stop_thld;	/* queue stops at this many free bds or fewer */
 	unsigned int    clean_ptr;      /* Tx ring clean pointer */
 	unsigned int	c_index;	/* last consumer index of each ring*/
 	unsigned int	free_bds;	/* # of free bds for each ring */

-- 
2.53.0
Technical Details
Message-ID: <20261109-nb-genet-txq-thld-net-v2-1-efd8f4be96f2@tipi-net.de>
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-359632-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!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-359632-linux-kernel-netdev=dewy.ru
From: nb@tipi-net.de (Nicolai Buchwitz)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net v2 1/2] net: bcmgenet: cap the Tx queue threshold at
 the ring size
Date: Mon, 09 Nov 2026 22:53:01 +0100
Organization: Usenet Network
Message-ID: <20261109-nb-genet-txq-thld-net-v2-1-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="458378"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:aU+DQmRi3eiJy67byGD3mSI7+Xs= sha256:sqZ2pMXDuvOY0HhIKTK8cenEJBQzgBxEx75WkCzYDZ8=
	sha1:f4j8zZKfh/nwmx8uBuzaybqg3qA= sha256:+p08qOKxDHq8EM3maalHR2KTjEtrZXkfnQXOYlw9+fw=
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 537F8113949; Tue, 10 Nov 2026 00:53:56 +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 eWCV9XtaGmQF;
	Tue, 10 Nov 2026 00:53:52 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-359632-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 tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id 5B431113937; Tue, 10 Nov 2026 00:53:43 +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 1242A3DACD; Mon,  9 Nov 2026 21:53:26 +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=1794261205;
	b=09Atb6qcP/758MpqUL/LbVCCcgaLiHixrt/TrPoQ9tRhoa6kHgJFjeah7NAX8ESY2D+Z
	 DXNBIwNyufUntxAFVZ127ANXgg41A+yX0wbBTQfBESzFYXfoqfbeifCYc1WShSUK0pT91
	 vzrEJAE4fOyMWZ1896DdQ9nbYrn1S5+nEOX8lAi8ro0ZN9VDpiotwpf9B9iPWucN9VEi3
	 2VVtQJuHuNpaEpQqoIWA0/PCh2QzIbvKKmeeS4CmBXzfYs9t7ffD6jNLHjkl+WsSMGMxO
	 a/d0+qVaQ0m4fUTJ/4pyhF7lypjEEBIC6dsAcswW1a+YBqtcfN6TuVeuHA7nfBs0O0A==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794261205;
	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=+OjU5cpDd0WZsZbOTFKQfY0byW87CeplqtKe+Oidk0k=;
	b=LyfjuCKZR++jbvZbQtcytMrrFnCgMF3GkN+JbRC5vYTX+PF5yo6dsgMaNhi60RZs/h8q
	 PUxoJJhs5Fe+IDgSFNwszP8ExT4JBhr3vgjvm1bDBv/pL10UMo/f22xtBYhZnPkPHr+Dt
	 t/SZECUlUWKSeAjSy36aPIFL1dA01G+gLO0pAXJ2oXYnljWVJcLWqp2YSVGhPyOEnRGWA
	 soDUEUoJvW2sPeFT00iXiQkjSf9NCvFyKAF++hCtormOUPyf8Sl5cluhzNXnYvYMBAjtv
	 fvzVUls9eqxIUs+tflJcSHONRO+Lm8ts/hEZu34fdBL/xXFrTw8GQvgzHqZvnIP/6HQ==
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=SZ0JMSJF;
	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 6A712606A337;
	Mon,  9 Nov 2026 21:53:25 +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=SZ0JMSJF
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=1Nbhg6krWU3VvPo1CSC30q1ByIym8WF4fd6f8DSSfRLBo2GA6yzkEf2d61ij5rN3yd77
	 orcsz6+u+hMZnfLCKgCpyrdEBQR1DrtG2OCASS5+HkYzneDZ1zjlxbq5Jfl+VE78KTJn9
	 BKJhXCnSy8wTapa4MpsLthIIubEUZ8HiJRlOCnaaZcMmGR+2kfUimOQ3tKM6OoVP8MfKT
	 HXkyijo+dVaYLIKHJRzxivwbJ4AVX7IBnkcZVUK0e06si0ZzFcXTO6SDg2x3J3meqo0Vn
	 6RKyrM7gXVOudwK7ba7olBiqKO/zVvIoE3SA7BxekSWxEaP5l4dXbSEOAUfLCQABl8w==
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=+OjU5cpDd0WZsZbOTFKQfY0byW87CeplqtKe+Oidk0k=;
	b=0c1iNpgWDww/Vmdorb/jsR3Jlu5eTkxRwWylZGQf5ZKVrflM4GTf2oi5k8GLP1L/7H//
	 5nEfe240YS1oSe2mp4wBZBpxR5YwqEgXnfZz44/ejmvtyqq0/6NO+5XD9OVRm2ZaZN9Od
	 VIhqAe8hy+TjWhnTBYoz8GX4BD2PYcvdoUxK9nPDekFQpYk/5l2TVgddrFM6l7qngsvbI
	 tSn01ILUWYECfjqpEXT1htUi3aAe65DfPSkTXfVZ3kRVbpDnI2iajmEX9J2bC/metGL8a
	 Yi5D1zOc8/BdygUhzwAAjFP8MLOJV/e3k4kJ9Med/irRRIRdYAe55/pIiV1+6zcjBfQ==
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=SZ0JMSJF;
	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) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id D837D606A325;
	Mon,  9 Nov 2026 21:53:12 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org D837D606A325
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 AC7C8A1609;
	Mon, 09 Nov 2026 22:53:10 +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=+OjU5cpDd0WZsZbOTFKQfY0byW87CeplqtKe+Oidk0k=;
	b=SZ0JMSJFDut+1am+/Kvra7d4mFjStNGpw1Q26lIMP6XSF8NbjUmUlTqr0DFiR7d7udcD68
	E2LG8O8tKSBr2ORsRXzOPUBRENykRPfzkYIWZgahWyh60OE6aExA5TYJN2UfWNZQ33VYRL
	Kwsr2VW3SDUEO15KPY5PdFNDIQQxZ1/v4g9wHf7m0Od3AwD3+LCSUEduFN4lVtai5VoGwD
	n13mgWvIidlqxF16wRvl0ocX93gaAgg1b3yhTNIX4ymj3thHdDbcsmsspVSRYrXiTy+Fl+
	NKnzg9MeCoBbFbxcM5DBcTHD/n9vZ7Uem6q8ErDjJs9bfjqN85Lcm1kxj4VX6g==
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