Skip to contentSkip to conversation

r8169: Use napi_schedule_irqoff()

PATCH In review Matt Vollrath 2 participants 2 messages Apr 12 – Apr 13

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 r8169: Use napi_schedule_irqoff()

napi_schedule() masks hard interrupts while doing its work, which is redundant when called from an interrupt handler where hard interrupts are already masked. Use napi_schedule_irqoff() instead to bypass this redundant masking. This is an optimization.

This is a partial reversion of a previous fix:
Commit 2734a24e6e5d ("r8169: fix issue with forced threading in combination with shared interrupts") was applied in 2020 to work around an issue with forced threading.
IRQ handlers were run without interrupts masked, and RX interrupts could
be missed in the race, causing delays.

This was fixed in 2021 by masking interrupts in forced thread context:
Commit 81e2073c175b ("genirq: Disable interrupts for force threaded handlers")

Compatibility with PREEMPT_RT also came in 2021:
Commit 8380c81d5c4f ("net: Treat __napi_schedule_irqoff() as __napi_schedule() on PREEMPT_RT")

Tested on a Lenovo RTL8168h/8111h.

---
 drivers/net/ethernet/realtek/r8169_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/realtek/r8169_main.c +1 -1
index 791277e750ba..4c0ad0de3410 100644
@@ -4873,7 +4873,7 @@ static irqreturn_t rtl8169_interrupt(int irq, void *dev_instance)
 		phy_mac_interrupt(tp->phydev);
 
 	rtl_irq_disable(tp);
-	napi_schedule(&tp->napi);
+	napi_schedule_irqoff(&tp->napi);
 out:
 	rtl_ack_events(tp, status);
 
Signature · 7 lines
2.43.0

Changes:
v3:
* Describe the history of this schedule call
v2:
* CC the maintainers, make the CI board green
maintainer
#1 lore raw
Quoted 4 lines · On Sun, 12 Apr 2026 19:29:14 -0400 Matt Vollrath wrote:

napi_schedule() masks hard interrupts while doing its work, which is redundant when called from an interrupt handler where hard interrupts are already masked. Use napi_schedule_irqoff() instead to bypass this redundant masking. This is an optimization.

Linus tagged final v7.0, net-next is closed. See for more information:
https://www.kernel.org/doc/html/next/process/maintainer-netdev.html