🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #12588

[PATCH net 1/2] net: macb: credit unsent frames to BQL in macb_tx_error_task()

#12588
From: Nicolai Buchwitz
Date: Sat, 07 Nov 2026 20:58
45 lines
9813 bytes
The frames dropped on a TX error are never returned to BQL. Each error
shrinks the BQL budget for good until the queue stops with an empty
ring.

netdev_tx_reset_queue() is not safe here as the task runs without
tx_ptr_lock, so macb_start_xmit() may still be queueing.

Fixes: e6a532185daa ("net: cadence: macb: Implement BQL")
Signed-off-by: Nicolai Buchwitz <nb@tipi-net.de>
---
 drivers/net/ethernet/cadence/macb_main.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
index f087f278f9e56..b6105f915fe35 100644
--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
@@ -1412,10 +1412,8 @@ static void macb_tx_error_task(struct work_struct *work)
 					    skb->data);
 				bp->netdev->stats.tx_packets++;
 				queue->stats.tx_packets++;
-				packets++;
 				bp->netdev->stats.tx_bytes += skb->len - tx_skb->fcs_len;
 				queue->stats.tx_bytes += skb->len - tx_skb->fcs_len;
-				bytes += skb->len;
 			}
 		} else {
 			/* "Buffers exhausted mid-frame" errors may only happen
@@ -1428,6 +1426,12 @@ static void macb_tx_error_task(struct work_struct *work)
 			desc->ctrl = ctrl | MACB_BIT(TX_USED);
 		}
 
+		/* BQL has to see every frame leaving the ring, sent or not */
+		if (skb) {
+			packets++;
+			bytes += skb->len;
+		}
+
 		macb_tx_unmap(&bp->info, tx_skb, 0);
 	}
 

-- 
2.53.0
Technical Details
Message-ID: <20261107-nb-macb-tx-error-task-net-v1-1-a2aac5d64d52@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-358527-linux-kernel-netdev=dewy.ru
References: <20261107-nb-macb-tx-error-task-net-v1-0-a2aac5d64d52@tipi-net.de>

Show 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-358527-linux-kernel-netdev=dewy.ru
From: nb@tipi-net.de (Nicolai Buchwitz)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net 1/2] net: macb: credit unsent frames to BQL in
 macb_tx_error_task()
Date: Sat, 07 Nov 2026 21:58:47 +0100
Organization: Usenet Network
Message-ID: <20261107-nb-macb-tx-error-task-net-v1-1-a2aac5d64d52@tipi-net.de>
References: <20261107-nb-macb-tx-error-task-net-v1-0-a2aac5d64d52@tipi-net.de>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 7bit
Injection-Info: usenet.network;
	logging-data="4192405"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:8SM1qjLnJtrNffI3TBv5UP0kShA= sha256:TNw2urokNtsjKOaymTQc3IWjuw1A5QDG4PNy9Vx4/iQ=
	sha1:ycseWvbLBeqpMGdlphfw+Ro5eKM= sha256:1RUJgFh+mJNp5aX5oitdqYf6HcOmEuSEHvYzeReOnKg=
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 673AF1134B2; Sun,  8 Nov 2026 00:03:30 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.05
X-Spam-Status: No, score=-3.05 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, URIBL_BLOCKED=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 zGCxDbmUQb7F;
	Sun,  8 Nov 2026 00:03:27 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-358527-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 1A2B4DD121; Sun,  8 Nov 2026 00:03:19 +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 7BF7160F9B; Sat,  7 Nov 2026 20:59:46 +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=1794085185;
	b=29LMzRUvoE0JJIwzv5yZZ3yErbOUZEpT8fDgnVqf8cXyUDOKmqxzC2YWGaYfBgc+4WXN
	 QoAprvjvrZF9c/S//2toPpMRw9KurruvKYNUbTsU4kt7dttSf/lPyCEb4j3LaD1iCJbg1
	 9vtXuWLZEHKjd5dbfg3fYyQxdHFc+vz3iwg8M/l66BeRdvO+kgo/jOPxbfkQOaMtG+DVn
	 ZJRIM01TipvrBbXaJ8Ex0OuGAc4KBQbOQOy7vdddz0P/lDaCNqIux5x3T21FDaO+Tn4m+
	 O+Gt78etsXIAc6dLD1FBRnRyS9NaDH0gunl8/2NRIBwa8+wLW2in9PFrQ+OQR1HqW7Q==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794085185;
	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=DdANYzbV0Lro+OPxxD4bgUweqNMIXZ8k/JJD4bBO6rI=;
	b=rAsSmcN2XZg1BHcLXWuZrokofCm/xl/qXY2A78myULtAXC1M9ycLYoOg7Kr96/RP3lOe
	 1ObhUCpR/w1JU1nQLvGE1G93iwtZbhkKyM4LtPrhSP3t0pyg4isKlfDyEFNIWNQK/C5ly
	 fZPU08TfwSZgaM4fXtulYAL2NGLAuK5IJ5p6eanqlWS3OWrX1aP40ADN12HaoC+XnI6W3
	 V+xqhIt83lQZFZDCxRTODXHITVoaTclIkvg4xqfPtT1Zg1HJRQgzOYW/Cy0YSdS2MdFGe
	 QuQVU0sBMdGwLnqN+pQQsl7XeUR0u4XcfinQZ1BgTFKAE7d+vPn5jIYocFCBOHq/V/w==
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=Edus5YeA;
	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 24A95606A339;
	Sat,  7 Nov 2026 20:59:45 +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=Edus5YeA
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=1794085184;
	b=y2Dh/H7+Qz1da5nxWwp6IuY+PLCNcMgEn73s78pfbWqDo8MFLJ8V7U8rFGCLUsd42QgJ
	 Km1sg/9BhACVxoOgOumokLY6A4n+FJOK0lHJ/tB40LMmKE+0OrQsxbZx6zAS/GwPcJGet
	 93DMS+iiVKc+1RjTYoh46OguWrzeHsDTYj8vi1ha890fw6xoRkssrvUVL96G6JkDU6TlL
	 Qk1UK0ZQpMFEc2Fv7I0zC3lM+TmMUaStPSau04u5wwSEAAq0FUj0Kkfy63OhHNKiSftlS
	 aiAmiLGMj+8zbFimbHftaLycb1YIs4O9PajbEgfldO4ISQmi0EgxFA4Vm2iyDGy3eRw==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794085184;
	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=DdANYzbV0Lro+OPxxD4bgUweqNMIXZ8k/JJD4bBO6rI=;
	b=CAYxMOHaMzuEtjjV/+OQn6zaQEWSBvh7uYPcUuzEHSRq1bly0b9Psk70G+5VAOrj+iE1
	 Lngk5fkBVdkj77NBTjO9w5oulzsqnKvEiOPc9AJ39eoUQ4bPtEzXErU05+5ymDKte5Uq6
	 hIVu3dgCl5aZyBlt01EApeuaMezhV250EMAUsEPdegdG26mvOO9+RvQMXtZEdiEBE3KJX
	 hlnKEhG5fjesP8BhM7puxnYfHRjFENDlUomy2dCEzFJeURB+DGwEjRNVDovaxeFlWCEKY
	 6SEEBif2N+seeTzBm4YIu5E3fouuwXg5dZ3+hptF8VmBs6SqZdhRGx2E113VwGXrn7w==
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=Edus5YeA;
	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 3D19E606D805;
	Sat,  7 Nov 2026 20:59:37 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 3D19E606D805
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 D29B1A0034;
	Sat, 07 Nov 2026 21:59:35 +0100 (CET)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tipi-net.de; s=dkim;
	t=1794085176; h=from:subject:date:message-id:to:cc:mime-version:content-type:
	 content-transfer-encoding:in-reply-to:references;
	bh=DdANYzbV0Lro+OPxxD4bgUweqNMIXZ8k/JJD4bBO6rI=;
	b=Edus5YeAcb7ZtvU1NRFfbiHlNXNRD8a4VytQ74PxTYmtcjZJSITS/xz3/djqBNZOLS3+LN
	qd6r0NO3OYD5NGPkDn/9NDMt6xFnOHDzM80nWq+0lgH/QFkAVAhsdU6/f+NDaL8gMBPJHh
	b/YRXkTxg8nZnE3E240Hgral19jubWkcUYZ5FwkiCgNsbs4FB35yeM4Nu6gXHcVhjYBNtf
	pzpTdZ2AgNih12pLCFHFZLVLkLEjdq1ON+ZTAlxvjgk2mYOKw2W80Fadjv0NhgFPMjXKkQ
	T8QZfGzdfQuwC4+S/nbu9owuGO9DMCxrWebOoJgVfD1cAplUj8ktcMZesrVGrg==
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: <20261107-nb-macb-tx-error-task-net-v1-0-a2aac5d64d52@tipi-net.de>
X-Cc: Sean Anderson <sean.anderson@linux.dev>, 
 Robert Hancock <robert.hancock@calian.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