🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #13187

[PATCH 7.3.y] net: macb: wait for a running xmit before resetting BQL on close

#13187
From: Nicolai Buchwitz
Date: Mon, 09 Nov 2026 12:58
57 lines
10756 bytes
macb_close() stops the queues without waiting for an xmit still
running on another CPU. That frame charges BQL after the reset and
never completes, so after the reopen the queue stays stopped with an
empty ring and the watchdog fires until the next close.

Seen on a Raspberry Pi CM5 with ethtool -G under load.

Upstream fixed this as part of the context swap rework in commit
dcc3288b9433a ("net: macb: use context swapping in .set_ringparam()"),
which is too large for stable.

Fixes: e6a532185daa ("net: cadence: macb: Implement BQL")
Signed-off-by: Nicolai Buchwitz <nb@tipi-net.de>
---
Fixes a close race in 6.18.y and 7.3.y. Older LTS kernels have no BQL
in macb and 7.4 has the fix through Théo's context swap series, so let's
keep the fix small instead of pulling that whole series in.

The stall was observed on a Raspberry Pi CM5 (2/30 close/open cycles under
load stalled), so it is worth fixing.
---
 drivers/net/ethernet/cadence/macb_main.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
index 261a7e87520a4..9b3008b888bc4 100644
--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
@@ -3236,14 +3236,16 @@ static int macb_close(struct net_device *netdev)
 	unsigned long flags;
 	unsigned int q;
 
-	netif_tx_stop_all_queues(netdev);
-
 	for (q = 0, queue = bp->queues; q < bp->num_queues; ++q, ++queue) {
 		napi_disable(&queue->napi_rx);
 		napi_disable(&queue->napi_tx);
-		netdev_tx_reset_queue(netdev_get_tx_queue(netdev, q));
 	}
 
+	netif_tx_disable(netdev);
+
+	for (q = 0; q < bp->num_queues; ++q)
+		netdev_tx_reset_queue(netdev_get_tx_queue(netdev, q));
+
 	cancel_delayed_work_sync(&bp->tx_lpi_work);
 
 	phylink_stop(bp->phylink);

---
base-commit: d50d994bffa3c7c6db2d8bc4c5f0c55e3f46b0cd
change-id: 20261109-nb-macb-close-7-3-y-1a0d2f031b56

Best regards,
--  
Nicolai Buchwitz <nb@tipi-net.de>
Technical Details
Message-ID: <20261109-nb-macb-close-7-3-y-v1-1-5c506e2077fd@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-359302-linux-kernel-netdev=dewy.ru

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-359302-linux-kernel-netdev=dewy.ru
From: nb@tipi-net.de (Nicolai Buchwitz)
Newsgroups: linux.kernel.netdev
Subject: [PATCH 7.3.y] net: macb: wait for a running xmit before resetting
 BQL on close
Date: Mon, 09 Nov 2026 13:58:22 +0100
Organization: Usenet Network
Message-ID: <20261109-nb-macb-close-7-3-y-v1-1-5c506e2077fd@tipi-net.de>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="359039"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:zE53146i+mDnQ9GSbOtwOWzzgQo= sha256:ZjRhgN8De3CeDpQrEMKesloH1571Q+vzbzDzkPhkjEg=
	sha1:6wdEJqrcrkBdT7qpnbASL8u8zb4= sha256:YfR3NcW0wvFjbLo1VClach2ltCYAHyI8A/l/XawZbyk=
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 399FC1137E4; Mon,  9 Nov 2026 16:01:23 +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 BCdqfILX0qy4;
	Mon,  9 Nov 2026 16:01:20 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-359302-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 149061137E0; Mon,  9 Nov 2026 16:01:11 +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 E47F583EB5; Mon,  9 Nov 2026 12:58:49 +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=1794229120;
	b=cQoVImUR7BBUZB/Lk8C1rLCCKR+z2ZT7+Ser934gktb6vuIndmcsXueb5iAKqzya77nR
	 uiR8s/f2lEdQuqaKJVaD9ilnXOn0znx5nLMFF/UrkacTVf0fwJPndIUCWsKXfi/3/Tj22
	 I+FkEYq9ZU+dpYAZn6sWZ0RBH/kPdJPH2RpIa8eZpS99AdzeGk+XCkGoYJS1tIgom5lWB
	 fKA4Oi63WkEvPuZkA6OylKu9OHnw8Mozwzswl5CrvWhwsWaELOXUAGpUH8rfB1+bWmID6
	 eVEKljRlQJJcPrl2xHloPjnHfQUCXOF3SoKWiqSpl6x6zra+JGTf5oi48PVezpND8Tg==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794229120;
	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=n3PkCkDPnKV8p/iqmyGp7B/JsDJVTkvtOgECOHF++nY=;
	b=Y5C/ykn+ay4sUoqOj/0Oa+kxNVakvXg7+7w6+etGRDGt2MTtvfPUfZ+uUfmgZ+T2T2eB
	 S42yARCqKA1HpfL7OZhv07viw6XJn/np9y6AzxfdNwh6QEGtid9n4yUw1UsdBHvUCqcSb
	 Bhz/FzjH8revKQ+PlrGl1nSyGSBWRjq02WBUU2/JSQHX6uQ1D0OMHKKmmBaivIU4wm6rD
	 Cf3hza+0czAAIrrG9O6DK+4QwWOReu3EhAEUIRatFN9RBuF7pneq1F9KR2k4Ys0UeoWUs
	 El6rUQC7IDpWlierWXVsFIBDCPAnWiAGKYHfGsa/6vjBEtgPzYchLf3jIFEJrQF49yQ==
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=UL6hyKPi;
	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 62E58606D810;
	Mon,  9 Nov 2026 12:58:40 +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=UL6hyKPi
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=1794229109;
	b=KGK3Dt11xGu99aEo2tCMmZnJwdrKr+lT2MlfcEYfFNuCp3gYIcS9B7mfaYJN+Cxpg7Ai
	 +WCX6P9JOBycc3/okd+JhQU+SlRsdCbMVZ4sHnIOyBy97D5qwj0gQci84WxsELS6+85tY
	 NslBekTh61ipALzUTKy/XuV9lpHh+DzM7Kp5N1+5lV+Vn7n79v9CfneR9J6oYJe5+MPaA
	 Pl+VCJd/C5j8QPY854MWM8cxJHkmfAJmT2LvqWK+pbo6q3Co/2hprmRtRw10C1CQ/OvGP
	 KEmI5+0YWWOQNnryHoUQ9re7crXu14Y+JsjuAUCFM6JZrD4zI+LZRW2zXcbIoPVQMdQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794229109;
	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=n3PkCkDPnKV8p/iqmyGp7B/JsDJVTkvtOgECOHF++nY=;
	b=B2BzQW+lYFUinCX4n4rKQrOEAQpBqdD/tQx8PXukxA4IuSGtxP9Wc7IfIxsNteYTZv/B
	 e+i5EtdU4rXXu7XQ2AgKoM7xdRXhJIeLbR8qF2GHIeouGuMVqrEPKQFpdKu3yTbrY+QrN
	 uMO4xokxLWpi7Z0ZSFob48xMsdoZ5uN0pfOIg3we0aa4a0Y9wFQRxR9U7H50iQ3fQU96/
	 gzypxtmMYyvSsZjCns4yZW2clFY4sz0R1i3sa7BYRiDNFEAsGDpbofas6X4DB0fLT0ARu
	 m2lQmhoyaT2q8GFyCpkaUxjT9sQa8RhYhWs6BNEtGr20R2pI/5VIkHQ/LsLwg8kD39g==
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=UL6hyKPi;
	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 69B56606A325;
	Mon,  9 Nov 2026 12:58:28 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 69B56606A325
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 7EA97A12EB;
	Mon, 09 Nov 2026 13:58:24 +0100 (CET)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tipi-net.de; s=dkim;
	t=1794229105; h=from:subject:date:message-id:to:cc:mime-version:content-type:
	 content-transfer-encoding; bh=n3PkCkDPnKV8p/iqmyGp7B/JsDJVTkvtOgECOHF++nY=;
	b=UL6hyKPiXBLAdPxwsOTZLOI6bcNx5FnnF/GkvaOIBEn9Gx77MlqBJ2FMguorUAFwzSdPHJ
	7YCKZ2GAPnl7efJJ7CNEH4rEwfu20aqdI126Pb7ljO5FNnoa17hoT9RR14sF90BF1K2xq/
	1h/XR0U9ZySB3aNkOnF0+7DlLucTT7EzlZn6ul974/UwiZniGMIukXns4O/TlraGvczqGJ
	dwW2z0zKcADfJkKB7Xws9mcu3nyKpfiskvH2YWYhkuBfvLbdvp8RVeXB0RJTskuidQfLy/
	s4AJQsKTfagt+XlNzcVnI7+Jt3awC714Kf5jF0+XInmTa2TFFKhqUOahZKhc/A==
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/yWMQQ6CMBAAv0L27JJuGyH4FeOhLQuskWK6aiSEv
 1v1OJPMbKCchRVO1QaZX6KypAJ0qCBOPo2M0hcGa2xDZDpMAWcfA8bboowtOlyRvOntYByFYwO
 lvGce5P27nqGtXb3C5a/1Ga4cH98j7PsHFIwA9X4AAAA=
X-Change-ID: 20261109-nb-macb-close-7-3-y-1a0d2f031b56
X-Cc: Théo Lebrun <theo.lebrun@bootlin.com>, 
 Conor Dooley <conor.dooley@microchip.com>, 
 Nicolas Ferre <nicolas.ferre@microchip.com>, 
 Claudiu Beznea <claudiu.beznea@tuxon.dev>, 
 Andrew Lunn <andrew+netdev@lunn.ch>, 
 "David S. Miller" <davem@davemloft.net>, Eric Dumazet <edumazet@kernel.org>, 
 Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, 
 Sean Anderson <sean.anderson@linux.dev>, 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