🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #17614

[PATCH net-next] net: stmmac: dwmac4: schedule RX NAPI on Receive Buffer Unavailable

#17614
From: David Wu
Date: Tue, 17 Nov 2026 03:43
57 lines
10782 bytes
Once the RX ring is exhausted, the RX DMA enters the suspend state and
no more Receive Interrupts can be generated: incoming frames are kept
in the MTL RX FIFO and are dropped once it overflows. The RX DMA only
resumes after software refills the ring and updates the RX tail
pointer, which is done by the RX NAPI poll (stmmac_rx_refill()).

Commit 1b9707e6f1a9 ("net: stmmac: enable RPS and RBU interrupts")
enabled the RBU interrupt for dwmac4, but the interrupt handler only
updates the statistics counter without scheduling the RX NAPI. The RX
NAPI is therefore never invoked, stmmac_rx_refill() never runs, and
the RX path hangs forever once the ring has been exhausted.

Schedule the RX NAPI when the RBU interrupt is received, aligning the
dwmac4 behaviour with XGMAC (commit 6338488356d2 ("net: stmmac: xgmac:
Add RBU handling in DMA interrupt")).

This can be observed on a GMAC4 based platform with Split Header (SPH)
enabled under high TCP RX pressure, where the slower RX refill path
lets the RX ring run dry.

Tested with Split Header (SPH) enabled, running a large file download
over TCP:

- Without this change, the RX path hangs permanently once the RX ring
  is exhausted: the RX tail pointer is never updated again and the
  DMA channel status register latches the RBU bit, while the TX path
  keeps running.

- With this change, each RBU interrupt is handled and the RX path
  recovers by itself. e.g. 3 RBU events within 6 ms during a download
  peak, each one self-recovered (the RX tail pointer resumes advancing
  right after), with no further RBU events afterwards.

Signed-off-by: David Wu <david.wu@rock-chips.com>
---
 drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c
index a0249715fafa..929aa77ce247 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c
@@ -153,8 +153,10 @@ int dwmac4_dma_interrupt(struct stmmac_priv *priv, void __iomem *ioaddr,
 
 	/* ABNORMAL interrupts */
 	if (unlikely(intr_status & DMA_CHAN_STATUS_AIS)) {
-		if (unlikely(intr_status & DMA_CHAN_STATUS_RBU))
+		if (unlikely(intr_status & DMA_CHAN_STATUS_RBU)) {
 			x->rx_buf_unav_irq++;
+			ret |= handle_rx;
+		}
 		if (unlikely(intr_status & DMA_CHAN_STATUS_RPS))
 			x->rx_process_stopped_irq++;
 		if (unlikely(intr_status & DMA_CHAN_STATUS_ETI))
-- 
2.25.1
Technical Details
Message-ID: <20261117034332.88443-1-david.wu@rock-chips.com>
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-364937-linux-kernel-netdev=dewy.ru

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-364937-linux-kernel-netdev=dewy.ru
From: david.wu@rock-chips.com (David Wu)
Newsgroups: linux.kernel.netdev
Subject: [PATCH net-next] net: stmmac: dwmac4: schedule RX NAPI on Receive Buffer Unavailable
Date: Tue, 17 Nov 2026 11:43:32 +0800
Organization: Usenet Network
Message-ID: <20261117034332.88443-1-david.wu@rock-chips.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="2232075"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:uUPoICnDYb74yCsboTWGSNb3hww= sha256:aj1qb+sNEk5A9KG9vlst4ybO7iiIo7mbpkg2EvUtfsM=
	sha1:y9TqJEHpVcgGcgTZun4D6vS+TvA= sha256:D4WZjN7QOedQ5xvokixY9BLrv+A93NRBgX3HWgR5eyM=
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 09AAF114E3E; Tue, 17 Nov 2026 06:44: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 (1024-bit key)
	header.d=rock-chips.com
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 qyeQppnKS3eP;
	Tue, 17 Nov 2026 06:43:57 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-364937-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=rock-chips.com
X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id 272D3114E20; Tue, 17 Nov 2026 06:43:48 +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 C1CD129122; Tue, 17 Nov 2026 03:43: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=1794887026;
	b=HJuXo4WjlSyVZAnX+AkBw4V4yCfaVf3XyFSml2EON6qQOB5igqfM7kT6MS1QPgmVDSVR
	 oc7A4HsIuaDLpI1T3vf/Mf/3USX82BuXDBt2VS8QdYvPnZkzRVnVgPHrhGDIVY4NJHGMO
	 v332x5PdRlUZmBmMdVM9WG7E8fN6FKIcQhr8DVNw2ZX/APks83xZYBnaX7RMQULqdFhL4
	 FdGcR7Yorik+H+vWdRjJL+T3kbmyP4Zl7ycvWqcxu6kzdNFsW667++YHl/xedgC4bYuwx
	 OE6bsLChKF8U97Fk4p7aK7b/QgTjJx9le2aqP75reCKbZwGlGS662E8rCHImipisPzw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794887026;
	h=X-Original-To:Received:DMARC-Filter:Received:From:To:Cc:Subject:Date:
	 Message-Id:X-Mailer:X-Mailing-List:List-Id:List-Post:List-Help:
	 List-Subscribe:List-Unsubscribe:List-Owner:Precedence:MIME-Version:
	 Content-Transfer-Encoding:X-HM-Tid:X-HM-MType:X-HM-Spam-Status:
	 DKIM-Signature;
	bh=8z5exWLOsArB3n8YhVSSxwP7PGSyUO5muX6NLLxT+tM=;
	b=45aCjfRBL1BfQ9PGxg91jnP8S9986codu6EguHZOy0K/eGwk0UTWJsphAHkAPg6T7JEX
	 rZ4pBRmh7lSiHnz5/vTlpQ+JZZwMftst6MTlCiKf88OcOTano6ocx+jArgPMqdp7ZDKob
	 GIDaNG+BEZkbQa1N6dTXEDe2uj6QAEx76mqlMIrCqgwH1ztH+uOZBSXBSO45XME33ZfWt
	 3fgBzD3J/xzrYpVTXQhwh6Mw6BUvmKAAFiqNp7+0jwA8UiZ+iRQPDq+mOyTNRhZGivTrY
	 rQpCsZxX4ZuYMJrySazso2m7xzfrVQ41Xdi2OtLPkFNCNr4h0VsB3cdJsGfJLo/PCrA==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=rock-chips.com header.i=@rock-chips.com header.a=rsa-sha256 header.s=default header.b=FOdr7igg;
	dmarc=pass header.from=rock-chips.com;
	spf=pass smtp.mailfrom=rock-chips.com;
	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 E998B606A336;
	Tue, 17 Nov 2026 03:43:45 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (1024-bit key) header.d=rock-chips.com header.i=@rock-chips.com header.a=rsa-sha256 header.s=default header.b=FOdr7igg
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=103.209.128.47
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1794887025;
	b=bZI6S0r5vTrD7EdcLsYCdbaR+hmsGFCKmf6/9B3PQQwGCf7dTkwG404yu69G/cM9cW2H
	 krU0pMXDF9cYb6dsRx08U+xG4Bl6OWSS5lTFZtpRqlLORcJshfAgRGydIGlwmTdZXuDpZ
	 OkAZszg8R9czKXaN8XmpI8LxclFkW1cpK4DS/6I7waES4H8y/BkqpM9TNF3eeFrIUih76
	 4NY8nnGjAJ1X0utE1fBEKJbfESKfs50Veu2kKRk0/m9nl+uKdPTGSy0gd5eODJVzXhVlS
	 gN/Q6qOtryPWqXHg/V1usp4O10Nn3aLOedbrJZIaT0k6wAe8iESuYXx8nXzT9hvM4dw==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1794887025;
	h=DMARC-Filter:Received:From:To:Cc:Subject:Date:Message-Id:X-Mailer:
	 MIME-Version:Content-Transfer-Encoding:X-HM-Tid:X-HM-MType:
	 X-HM-Spam-Status:DKIM-Signature;
	bh=8z5exWLOsArB3n8YhVSSxwP7PGSyUO5muX6NLLxT+tM=;
	b=ozWaLtAiUEjKrD8KPxobnLGbvsaV5Dl+4XSCGn/BoO41e4eBtf/izHIi0hgTbb8uceLY
	 7OkosgiEGy+cg4fSd86anHTq1zgyxlebz4Vv/XvFhj6DSqvYMD3ORD2xfqiddbBO1WG/c
	 khlOoTSKrxDoicawZFZzXi0AHZKng/JmsvEQiNPO0LYOAaERdfV8OrV254WV0ME6xe1T7
	 U0cM7er8Ad75NR8n0snH4H6hjYUp7d/w3akxTrEsccvvpnp+aHakz6bWPkGTGSsAAq1Td
	 HGcb6jX+PbFXz5pr8sLBWOrlcDKRmpdKGCiTtsKWg5w+YVRkD3PuKrWineMT1yKWpzw==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=pass header.from=rock-chips.com;
	spf=pass smtp.mailfrom=rock-chips.com;
	dkim=pass header.d=rock-chips.com header.i=@rock-chips.com header.a=rsa-sha256 header.s=default header.b=FOdr7igg;
	arc=none smtp.remote-ip=103.209.128.47
X-Received: from mail-m12847.netease.com (mail-m12847.netease.com [103.209.128.47])
	(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 8E4CA606A31C;
	Tue, 17 Nov 2026 03:43:41 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 8E4CA606A31C
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=rock-chips.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=rock-chips.com
X-Received: from localhost.localdomain (unknown [61.154.14.86])
	by smtp.qiye.163.com (Hmail) with ESMTP id 54eddf876;
	Tue, 17 Nov 2026 11:43:32 +0800 (GMT+08:00)
X-Cc: rmk+kernel@armlinux.org.uk,
	maxime.chevallier@bootlin.com,
	lorenzo.bianconi@oss.qualcomm.com,
	luis.la@mail.de,
	netdev@vger.kernel.org,
	linux-stm32@st-md-mailman.stormreply.com,
	linux-kernel@vger.kernel.org
X-Mailer: git-send-email 2.25.1
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-HM-Tid: 0aa1e79a4feb09cckunm6f20b5ba25f9a0
X-HM-MType: 1
X-HM-Spam-Status: e1kfGhgUHx5ZQUpXWQgPGg8OCBgUHx5ZQUlOS1dZFg8aDwILHllBWSg2Ly
	tZV1koWUFITzdXWRgWCB1ZQUpXWS1ZQUlXWQ8JGhUIEh9ZQVkZSENCVhhNGEIfTh9CHUpCHVYVFA
	kWGhdVEwETFhoSFyQUDg9ZV1kYEgtZQVlNSlVKTk9VSk9VQ01ZV1kWGg8SFR0UWUFZT0tIVUpLSU
	9PT0hVSktLVUpCS0tZBg++
X-DKIM-Signature: a=rsa-sha256;
	b=FOdr7iggoJFupP9V0ZsdiSwag9vjLW4IEkRAB9z+H+WN4TcR3UfAx5Fo25vciX4J0eXH8d+EAkzXH9KstFUhMyu6iPm61CQG0ESqPRux48rwEtKH5BTSGWjc4qmCJT/AThr9Xvzim6sbdxxcGGMlKPqSR9mmKkSFV/XZtB13uqY=; s=default; c=relaxed/relaxed; d=rock-chips.com; v=1;
	bh=8z5exWLOsArB3n8YhVSSxwP7PGSyUO5muX6NLLxT+tM=;
	h=date:mime-version:subject:message-id:from;