Article View: linux.kernel.netdev
Article #12209[PATCH net] net: bcmgenet: cap the Tx queue threshold at the ring size
From: Nicolai Buchwitz
Date: Fri, 06 Nov 2026 14:10
Date: Fri, 06 Nov 2026 14:10
78 lines
11897 bytes
11897 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")
Signed-off-by: Nicolai Buchwitz <nb@tipi-net.de>
---
Found this while fixing the clashiko findings on v6 of my MTU series. After
those fixes this bug would be easier to hit. At the moment it needs a
larger CONFIG_MAX_SKB_FRAGS than the default.
Everything was tested on a Raspberry Pi CM4 (BCM2711, genet v5).
---
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..186d17781b890 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;
+ /* A ring smaller than that would never wake */
+ 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 */
---
base-commit: 19a227903e65c7a9c179156485660a4e017575fe
change-id: 20261106-nb-genet-txq-thld-net-e0864f235d22
Best regards,
--
Nicolai Buchwitz <nb@tipi-net.de>
Technical Details
Message-ID:
<20261106-nb-genet-txq-thld-net-v1-1-53bbac647b71@tipi-net.de>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-358030-linux-kernel-netdev=dewy.ruShow Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-358030-linux-kernel-netdev=dewy.ru From: nb@tipi-net.de (Nicolai Buchwitz) Newsgroups: linux.kernel.netdev Subject: [PATCH net] net: bcmgenet: cap the Tx queue threshold at the ring size Date: Fri, 06 Nov 2026 15:10:18 +0100 Organization: Usenet Network Message-ID: <20261106-nb-genet-txq-thld-net-v1-1-53bbac647b71@tipi-net.de> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Injection-Info: usenet.network; logging-data="3898819"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:FvxCAgK5AYbksNRxDiiVxZU8KNc= sha256:WnvWJQuD05pXZej99yZxguLW0hAkF0tJm4Y1FdswhNU= sha1:1Q2UTxMeMvhgHSvIoFlOzd0S3HA= sha256:/3bLem13lGi+LW6rOh4e7Dv047m/QlO9RO+XIpZ0wSM= 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 079BE11327E; Fri, 6 Nov 2026 17:19:01 +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 UpWNFq2ctHYV; Fri, 6 Nov 2026 17:18:56 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-358030-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 2FBFF113278; Fri, 6 Nov 2026 17:18:48 +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 8093A3A2D4; Fri, 6 Nov 2026 14:11: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=1793974238; b=SeCxMRnLVf7Fsff+cozLZHIvh8TZFF8HoDsrIRq5woiq48LKDjJ7AZGVxOAt89A376HG 7LWkN+eBHADc6v025TuvH4T6RCmkWw/kluIgAcaEAGD5Rb1DYyuJSfR6y6ZRmmPOZlb2Z xQPJyglQTnZbvhLsPZFJjn8wRJVV5haMMFgkBaj5XT/g3JNXtPsZMcXxlmrU7rBLCnKL+ sLt6YeIH2JULg/syFAPxe8mzxwhfRBSpztBIHPIN7h+Y4CRxie26/RHre/Cii+ko4/K92 ePcg3g3wjeqCFGzPeJMexwP+K+PLDhbCykc91a2E9gSH5ZIdERb0+C+yMN89QkongEw== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793974238; 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:X-B4-Tracking: X-Change-ID:To:Cc:X-Mailer:X-Last-TLS-Session-Version; bh=b/cEUCLQXzPxV9G+iZB5C+37LxfrcLwhmYVvdlt5C/Q=; b=YPaUQ+U5xkMa9KzlYPafPmtRjoGdU+fn43ocHEem022NGKxoJ8fbiTltlmbXDDkTMKhK g939rYE1WKDN2uxAAbqhEXP+For2xtafJd1v9xpiBS6ModkYPHsRNuE+Ap4iN9fT4VnDc 9AgQwfndnPknwoDcKzVK5TzUTHhSAqIC9qaVA8ridaFnbxGqM0QNK8wkP2p58G1/8e6C1 aH8gKtEBoywjQYWNjUQHnX7jGHmmPSmSaQZJ6OCEcyP/W6dktZTggkiL93euSqkTDQQgp EBs5l6K2bAHRcyrHfeCkUgPKAo8Xw4siHiTX7VjVSPWHz3L8WIgJzwUa+zyClUzVBsw== 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=nDfjqpBp; 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 535BC606A33B; Fri, 6 Nov 2026 14:10:38 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=tipi-net.de header.i=@tipi-net.de header.a=rsa-sha256 header.s=dkim header.b=nDfjqpBp 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=1793974232; b=LZLVl1P2FqA0YY2orXY2GvCHgQi0rGimZ/lw2RYSQSsLCzDvR8Hk1xp5bgjsyBfydJ3o ABSPhjxs3hjqHW9VFetodTIVsrm4NVQz+Ve1lNijI2hYwUBkHVPDk+e7HdtdqvI3IQWoq 8Lda5tQXGxFuaVd5jhOPVKhTVjSXh7p9xFIWJMFuz7z4YBc2UxxLkgY+0FrI9AzTc/9bX g8ialMnIbvtpPKlKqzKtAoW0sybDXzJhF5NfhQ02hIDnmXICAjnq9PjhMt9C2fQRGdYor xG5RAGJROT3g6yf2mTpIw7mksbrubXXSMcZuSwHzT4ZZL9Dwt6YyJerWOeQBYA+99Tg== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793974232; h=DMARC-Filter:Received:DKIM-Signature:From:Date:Subject:MIME-Version: Content-Type:Content-Transfer-Encoding:Message-Id:X-B4-Tracking: X-Change-ID:To:Cc:X-Mailer:X-Last-TLS-Session-Version; bh=b/cEUCLQXzPxV9G+iZB5C+37LxfrcLwhmYVvdlt5C/Q=; b=y+FOuVTlJqZUeamog4uo0SvJAoashpvQu0Xosc0ap+0683bFgubH+B44DK1erIR+ZtCO WbVDsF+1/SGV4MkbePe7Rc39XG63C2LjnW/g+AX8eB8GoFPdcSGMIF95p0c4WnUJU2zbM sPPNzRyh4yN0qGUXAam3DQBP39v/NhtIov/ODhAs0OT9rlOm7U/5bqubrYbFyAPwhREgm cpxiIMDq7cd7xUE0ivUTA5SDz3ERSOCTgYJLI1lYfBc3ZTsraR50AOB0EHY5rb/NJOgaE h9LV/xWptdBPmLlFEy1O2Suc+t6NzXUb3BL11/9AhwitD4RP+6VK01UN4Ppijzl0Vzg== 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=nDfjqpBp; 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 12771606A333; Fri, 6 Nov 2026 14:10:30 +0000 (UTC) X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 12771606A333 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 B5F1DA05A5; Fri, 06 Nov 2026 15:10:26 +0100 (CET) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tipi-net.de; s=dkim; t=1793974228; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding; bh=b/cEUCLQXzPxV9G+iZB5C+37LxfrcLwhmYVvdlt5C/Q=; b=nDfjqpBpERelMXmqVMyHtKYwd6qPIOENe43ukwRPzEOLFUbOdfr7ar1aCfcQeaQlzCJyxP 2+nhegvKvrNkYkoCPaQZIO2LdHOmHQCPv+kI7Zwf52CHIOrHpKMDif2vAEvQs8bTcDQrLp rakaeGVSz4MzALlMeU10gOSHZIf1uq8FTW0SzgVlF5P7Hn1XgGHapvDfrRd2ocU2ndjnCh hPlg/zQM4Ro3DIZ3ufrEc/OK9jgK3nfo7EnX5dpy+maO4Dma6jRzDHskPGX52geTjmSb+9 QVXLb+paI0KA0pqsJy/UpLj8IeXw/H7bZGVqAWYq+k6uTKYpGBrCBcECRxocjw== 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-B4-Tracking: v=1; b=H4sIAAAAAAAC/yWM0Q6CMBAEf4Xss5e0pzbEXzE+AD3giKnaFkJC+ HeLPs5mZzYkiSoJt2pDlEWTvkIBe6rQjU0YhNQXBht21hpHoaVBgmTK64fy+PR0gJjaXXo+Xz0 zivuO0uv6695RDnj8xzS3k3T5KGLfvxre38F+AAAA X-Change-ID: 20261106-nb-genet-txq-thld-net-e0864f235d22 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