Skip to contentSkip to conversation

r8169: avoid unsolicited interrupts

PATCH Applied Heiner Kallweit 4 participants 4 messages Oct 18, 2024 – Oct 23, 2024

Subsystems (3)
lore
Share & tools
lore

Heiner Kallweit

author maintainer
#0 lore raw

PATCH v2 1/1 r8169: avoid unsolicited interrupts

It was reported that after resume from suspend a PCI error is logged and connectivity is broken. Error message is:
PCI error (cmd = 0x0407, status_errs = 0x0000)
The message seems to be a red herring as none of the error bits is set, and the PCI command register value also is normal. Exception handling for a PCI error includes a chip reset what apparently brakes connectivity here. The interrupt status bit triggering the PCI error handling isn't actually used on PCIe chip versions, so it's not clear why this bit is set by the chip. Fix this by ignoring this bit on PCIe chip versions.

Fixes 0e4851502f84 ("r8169: merge with version 8.001.00 of Realtek's r8168 driver")

---
v2:
- choose alternative approach because v1 brakes connection under heavy load

---
 drivers/net/ethernet/realtek/r8169_main.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/realtek/r8169_main.c +3 -1
index 4166f1ab8..79e7b223b 100644
@@ -4749,7 +4749,9 @@ static irqreturn_t rtl8169_interrupt(int irq, void *dev_instance)
 	if ((status & 0xffff) == 0xffff || !(status & tp->irq_mask))
 		return IRQ_NONE;
 
-	if (unlikely(status & SYSErr)) {
+	/* At least RTL8168fp may unexpectedly set the SYSErr bit */
+	if (unlikely(status & SYSErr &&
+	    tp->mac_version <= RTL_GIGA_MAC_VER_06)) {
 		rtl8169_pcierr_interrupt(tp->dev);
 		goto out;
 	}
Signature · 1 line
2.47.0
reviewer Reviewed-by on v2 1/1
#1 lore raw
Quoted 10 lines · Heiner Kallweit

It was reported that after resume from suspend a PCI error is logged and connectivity is broken. Error message is:
PCI error (cmd = 0x0407, status_errs = 0x0000)
The message seems to be a red herring as none of the error bits is set, and the PCI command register value also is normal. Exception handling for a PCI error includes a chip reset what apparently brakes connectivity here. The interrupt status bit triggering the PCI error handling isn't actually used on PCIe chip versions, so it's not clear why this bit is set by the chip. Fix this by ignoring this bit on PCIe chip versions.

Quoted 4 lines
Fixes 0e4851502f84 ("r8169: merge with version 8.001.00 of Realtek's r8168 driver")
#2 lore raw
In reply to Heiner Kallweit

Heiner Kallweit <[email protected]> :
|...]

Quoted 5 lines
drivers/net/ethernet/realtek/r8169_main.c +0 -0
index 4166f1ab8..79e7b223b 100644

drivers/net/ethernet/realtek/r8169_main.c static irqreturn_t rtl8169_interrupt(int irq, void *dev_instance) · line 4757

Quoted 10 lines
drivers/net/ethernet/realtek/r8169_main.c +3 -1
@@ -4749,7 +4749,9 @@ static irqreturn_t rtl8169_interrupt(int irq, void *dev_instance)
 	if ((status & 0xffff) == 0xffff || !(status & tp->irq_mask))
 		return IRQ_NONE;
 
-	if (unlikely(status & SYSErr)) {
+	/* At least RTL8168fp may unexpectedly set the SYSErr bit */
+	if (unlikely(status & SYSErr &&
+	    tp->mac_version <= RTL_GIGA_MAC_VER_06)) {
 		rtl8169_pcierr_interrupt(tp->dev);
 		goto out;
 	}

Some paleolithic references:
a27993f3d9daca0dffa26577a83822db99c952e2
d03902b8864d7814c938f67befade5a3bba68708

First occurences were related to 32/64 bits PCI systems somewhere around 2004~2006 (IBM PPC, who cares now ?).

It also appeared sometimes when the receive frame length check misbehaved.

It mostly was a plain PCI devices behavior. I am not too sure about 8168b but I don't remember anything above (including) 8168c needing it.

Signature · 1 line
Ueimor
#3 lore raw
In reply to Heiner Kallweit
This patch was applied to netdev/net.git (main) by Paolo Abeni <[email protected]>:

Hello:

This patch was applied to netdev/net.git (main)
by Paolo Abeni <[email protected]>:

Quoted 11 lines · On Fri, 18 Oct 2024 11:08:16 +0200 you wrote:

It was reported that after resume from suspend a PCI error is logged and connectivity is broken. Error message is:
PCI error (cmd = 0x0407, status_errs = 0x0000)
The message seems to be a red herring as none of the error bits is set, and the PCI command register value also is normal. Exception handling for a PCI error includes a chip reset what apparently brakes connectivity here. The interrupt status bit triggering the PCI error handling isn't actually used on PCIe chip versions, so it's not clear why this bit is set by the chip. Fix this by ignoring this bit on PCIe chip versions.

[...]

Here is the summary with links:
- [net,v2] r8169: avoid unsolicited interrupts

    https://git.kernel.org/netdev/net/c/10ce0db78700

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html