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

From: Nicolai Buchwitz

Date: Mon Nov 09 2026 - 08:02:06 EST


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@xxxxxxxxxxx>
---
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 1eaf9be483153..422dd167187da 100644
--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
@@ -3156,14 +3156,16 @@ static int macb_close(struct net_device *dev)
unsigned long flags;
unsigned int q;

- netif_tx_stop_all_queues(dev);
-
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(dev, q));
}

+ netif_tx_disable(dev);
+
+ for (q = 0; q < bp->num_queues; ++q)
+ netdev_tx_reset_queue(netdev_get_tx_queue(dev, q));
+
phylink_stop(bp->phylink);
phylink_disconnect_phy(bp->phylink);


---
base-commit: c3f63d70f236bb7685e6d11d1d9b5b351552e600
change-id: 20261109-nb-macb-close-6-18-y-126903425567

Best regards,
--
Nicolai Buchwitz <nb@xxxxxxxxxxx>