🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #19858

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

#19858
From: David Wu
Date: Fri, 20 Nov 2026 15:08
58 lines
11164 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>
Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.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 02aa1a3dd1e2..de6bd6f8a7d5 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c
@@ -155,8 +155,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: <20261120150805.763415-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-367992-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-367992-linux-kernel-netdev=dewy.ru
From: david.wu@rock-chips.com (David Wu)
Newsgroups: linux.kernel.netdev
Subject: [RESEND PATCH net] net: stmmac: dwmac4: schedule RX NAPI on Receive Buffer Unavailable
Date: Fri, 20 Nov 2026 23:08:05 +0800
Organization: Usenet Network
Message-ID: <20261120150805.763415-1-david.wu@rock-chips.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="3189343"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:tRY42lwE8MWKGsODyjJqZQe3It8= sha256:EGmPPBOaaA2AYjLcStB8a8aTdqTSSpovalCO9jvPo2s=
	sha1:iyp1ymGWWqUg4nHS3nf+yPY97fw= sha256:azb3Iz2qncis0xKUsbNRkgJwmLHP5ycCFXeomWFVKKQ=
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 88EC61159DE; Fri, 20 Nov 2026 18:10:38 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.141
X-Spam-Status: No, score=-3.141 tagged_above=-9999 required=6.31
	tests=[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_PASS=-0.001, T_SPF_HELO_TEMPERROR=0.01,
	URIBL_BLOCKED=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 bdzND9OGswCq;
	Fri, 20 Nov 2026 18:10:26 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.232.135.74; helo=sto.lore.kernel.org; envelope-from=netdev+bounces-367992-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 sto.lore.kernel.org (sto.lore.kernel.org [172.232.135.74])
	by mail.dewy.ru (Postfix) with ESMTPS id 9988C1159CA; Fri, 20 Nov 2026 18:10:18 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sto.lore.kernel.org (Postfix) with ESMTP id 4461B62732E; Fri, 20 Nov 2026 15:10:16 +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=1795187415;
	b=ob7ZbFDYUN7Uc94e96ADeyBHT5MZN4hakFU67eaIz9arkaVwwKQDKtRF9ry1JeEluyRM
	 oLuKn5WRVIf+vGH5JuqW7R3OX/aWNvkyi4CE1+9uxprTDCh0WZfrXGtMggAoxmVUmcYI/
	 nwSscBK54Y+wZZrs+BPa5iShzO8me4qsRRYS7VLNNVMUla+V1wfGPwxyvYI9/JrnZFCuk
	 psM2zzKgnipP8iskZnQWnd4Vo5zItfZKOzV0yrE4qrYozuoWSTQir+iGo3+dyS9t4rEvH
	 JizDhRyeRCugc6OgVKeAw96a7qoLAyoPFCxwv2fVCv42h9MII4dxzr9wu0YT6SH9CaA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795187415;
	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=us7mbpzByrc6IYYiZEo/0XS2sJm4gcQN7+6PoaPd6bI=;
	b=sYUCjFyyIvhjUISpbNdAinBZnZ2xGBop7CGrbLTLW7L1Zyqthzt7zvJM3CFYXoz05yq5
	 YMd4weuo5ks/LTSRjO9JYAJVS+bCi05U+PhnEKYPAR6GdO6gwL8QbxsqJpyhDl+JLkKjU
	 hly515GhhRLZpnkNPXDrGBTtkJRLt1emeyuuiK0tM6Y+6AqeROnKiBu8jZTm1gB9JOTYU
	 t8vTd2d3qz5BKkVnPKM3SzPRRAz+MXmGjRQNkVNm8F/XYCZseCQqd5J9fqEq2uIXfAAoY
	 g3h8ustLs38QD39GveKykHbq5j0eVXozLXrjb8WAdZtMEhPs2wK72vemHWoLGJJw9fA==
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="fDE1ROF/";
	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 9B13C606A32C;
	Fri, 20 Nov 2026 15:10:15 +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=fDE1ROF/
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=154.81.10.146
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1795187414;
	b=wONSmUeweobfEFC/Ouqsoz1fvcd0P/kJnRfjFc39XPAr0Bh7O8brPBZcxVcE2bzZ7Ipv
	 CrsO6LHUD4O4kpfZOAuglpBGgrYAMAVQKa9qsveNNRiibWZiOjaXn1SG4WgKC+phieFYR
	 ui5k/gdzUIqGPw39TR+OglQxRAkNrK/FUsZzrUrFJiHUZKmT78trNBGhW20jHp5KWt9LH
	 /Y+jC7w3W9ylgJi2NPaO3cfjaYrXanvrG0A+p8XCXxkcyCaGPYaPHKLSDsx5w4xQDyySu
	 eHguhVqpwN+MTjnwy9IaKry//Sh33MQJEp8pyv3IT6OG65k3BWRSgPXXBHrsfXMLpNw==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795187414;
	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=us7mbpzByrc6IYYiZEo/0XS2sJm4gcQN7+6PoaPd6bI=;
	b=WRZa5dfVDLckyLFyJ64d/9GaOiDxm59pxktFqp3RijJJgd3IEdFLeZfR47d2mXRwyG92
	 ygxPx0g+vlXhIExkLZ8BaZOxjRDIabPwMC/ctcK5LQ5X8UdnDxxGhcC0kBLeWCb7eLkV2
	 ANV9+8wmPHywizNaKmokm5q5SpgEozkoiDqdYa/saesAC1qxuqTCAxnA21zYHqYUtLBoK
	 OWDwJu5OY7OWbYrzdtp62/1hhUYA2SuMNyeTlT/5/UkMqEz5nZAl8iRb1zqGsKQ5BIJ4P
	 2zztssiZ9qgFYPXbEXi94R3DumrJdgcjtgwUWc74oi6iPBDlIBXuQ5aq50vY7GhrELQ==
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="fDE1ROF/";
	arc=none smtp.remote-ip=154.81.10.146
X-Received: from mail-m10146.netease.com (mail-m10146.netease.com [154.81.10.146])
	(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 D77E1606A320;
	Fri, 20 Nov 2026 15:10:11 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org D77E1606A320
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 5571b3b0d;
	Fri, 20 Nov 2026 23:10:00 +0800 (GMT+08:00)
X-Cc: andrew+netdev@lunn.ch,
	davem@davemloft.net,
	edumazet@kernel.org,
	kuba@kernel.org,
	pabeni@redhat.com,
	maxime.chevallier@bootlin.com,
	joabreu@synopsys.com,
	peppe.cavallaro@st.com,
	luis.la@mail.de,
	lorenzo.bianconi@oss.qualcomm.com,
	mcoquelin.stm32@gmail.com,
	alexandre.torgue@foss.st.com,
	rmk+kernel@armlinux.org.uk,
	Anandu.Padinhare@electrifex.com,
	linux-stm32@st-md-mailman.stormreply.com,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org,
	David Wu <david.wu@rock-chips.com>
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: 0aa1f981df5809cckunm25b76740482ac3
X-HM-MType: 1
X-HM-Spam-Status: e1kfGhgUHx5ZQUpXWQgPGg8OCBgUHx5ZQUlOS1dZFg8aDwILHllBWSg2Ly
	tZV1koWUFITzdXWRgWCB1ZQUpXWS1ZQUlXWQ8JGhUIEh9ZQVkZHx5DVh1JS0xLGUJLHU5JSlYVFA
	kWGhdVEwETFhoSFyQUDg9ZV1kYEgtZQVlNSlVKTk9VSk9VQ01ZV1kWGg8SFR0UWUFZT0tIVUpLSU
	9PT0hVSktLVUpCS0tZBg++
X-DKIM-Signature: a=rsa-sha256;
	b=fDE1ROF/HErXOzZTrk28RcFqanGnvxfppXJn0ml7GTDlqAr7HYyapRj46zeBq4jyjXe4IAoEghzTvvstOo7oUVtomK8Qg5sIfvvuImaDoKdwMd6FbmRgm4+yaBJfwLMQQ7TEgR4Mkhl0CRPnrPYWaCvA80JoLh1TWGQBbXXwNrk=; s=default; c=relaxed/relaxed; d=rock-chips.com; v=1;
	bh=us7mbpzByrc6IYYiZEo/0XS2sJm4gcQN7+6PoaPd6bI=;
	h=date:mime-version:subject:message-id:from;