diff mbox

Realtek 8169 problems with net booting

Message ID 20081129204416.GA6401@electric-eye.fr.zoreil.com
State RFC, archived
Delegated to: David Miller
Headers show

Commit Message

Francois Romieu Nov. 29, 2008, 8:44 p.m. UTC
Alan Cox <alan@lxorguk.ukuu.org.uk> :
> On one box here it has always been the case that now and then the boot
> with crash just after r8169 is loaded iff the BIOS network rom (ie the
> dhcp stuff) is enabled. Its erratic, hard to reproduce but I finally got
> around to looking at the driver and have a question that seems to apply
> to several network drivers
[...]
> The master bit is off when the driver is loaded it appears but surely the
> driver should do
>
> 	twiddle a few bits
> 	soft reset chip
> 	pci_set_master

You are right.

Can you try the attached patch against 2.6.28-rc6 and tell if it makes a
difference or not ?

While I did not test it in a BIOS network boot configuration it did not
crash trivially with these devices:
RTL8168b/8111b / XID 38000000
RTL8110s       / XID 04000000

Note to others: this patch needs testing with different chipsets (XID)
before being included upstream.

--
Ueimor
From 67a7da6ddf8d2f8ca7f0be04a8d70e77e2dc7285 Mon Sep 17 00:00:00 2001
From: Francois Romieu <romieu@fr.zoreil.com>
Date: Sat, 29 Nov 2008 20:54:18 +0100
Subject: [PATCH] r8169: enable bus mastering after the chipset is reset

Based on a suggestion by Alan Cox.

Signed-off-by: Francois Romieu <romieu@fr.zoreil.com>
---
 drivers/net/r8169.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

Comments

Al Viro Nov. 29, 2008, 9:06 p.m. UTC | #1
On Sat, Nov 29, 2008 at 09:44:17PM +0100, Francois Romieu wrote:
> Alan Cox <alan@lxorguk.ukuu.org.uk> :
> > On one box here it has always been the case that now and then the boot
> > with crash just after r8169 is loaded iff the BIOS network rom (ie the
> > dhcp stuff) is enabled. Its erratic, hard to reproduce but I finally got
> > around to looking at the driver and have a question that seems to apply
> > to several network drivers
> [...]
> > The master bit is off when the driver is loaded it appears but surely the
> > driver should do
> >
> > 	twiddle a few bits
> > 	soft reset chip
> > 	pci_set_master
> 
> You are right.
> 
> Can you try the attached patch against 2.6.28-rc6 and tell if it makes a
> difference or not ?
> 
> While I did not test it in a BIOS network boot configuration it did not
> crash trivially with these devices:
> RTL8168b/8111b / XID 38000000
> RTL8110s       / XID 04000000
> 
> Note to others: this patch needs testing with different chipsets (XID)
> before being included upstream.

FWIW, on one of two very similar motherboards I'm seeing the hard hangs
from 8169 with netboot enabled, but that smells like a hardware problem;
that crap got more and more frequent until I had to disconnect the
interface.  Other symptoms: it kept trying to renegotiate the link every
few seconds.  Hang used to happen on the first incoming packet after
boot, _but_ that didn't happen on each boot.  IIRC, what finally got me
to call it quits was near 100% frequency of buggered boots *and* a hang
during downloading the kernel.  I'm not entirely sure about the last
part, though - will retest once I get that box free for experiments.

Motherboards might be actually identical; r8169 *are*, according to lspci.
Device in question is
00:0d.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL-8169 Gigabit Ethernet (rev 10)
        Subsystem: AOPEN Inc. AK86-L motherboard
        Flags: bus master, 66MHz, medium devsel, latency 32, IRQ 23
        I/O ports at b000 [size=256]
        Memory at ed000000 (32-bit, non-prefetchable) [size=256]
        [virtual] Expansion ROM at 70100000 [disabled] [size=128K]
        Capabilities: [dc] Power Management version 2
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Francois Romieu Nov. 29, 2008, 9:28 p.m. UTC | #2
Al Viro <viro@ZenIV.linux.org.uk> :
[...]
> Other symptoms: it kept trying to renegotiate the link every few seconds.

[...]
> Hang used to happen on the first incoming packet after boot, _but_ that
> didn't happen on each boot.

Ok, it is consistent with a dma at (more or less) random location.

Thanks for the report Al.

Can you send the "XID" line printed by the driver on recent kernels so
that I can figure the specific version of the chipset / PHY ?

Do not hurry, I am out for saturday's night.
Al Viro Nov. 29, 2008, 10:47 p.m. UTC | #3
On Sat, Nov 29, 2008 at 10:28:30PM +0100, Francois Romieu wrote:
> Al Viro <viro@ZenIV.linux.org.uk> :
> [...]
> > Other symptoms: it kept trying to renegotiate the link every few seconds.
> 
> [...]
> > Hang used to happen on the first incoming packet after boot, _but_ that
> > didn't happen on each boot.
> 
> Ok, it is consistent with a dma at (more or less) random location.
> 
> Thanks for the report Al.
> 
> Can you send the "XID" line printed by the driver on recent kernels so
> that I can figure the specific version of the chipset / PHY ?

Interesting...

Working one -
eth0: RTL8110s at 0xffffc200008b6000, 00:01:80:50:a2:f1, XID 04000000 IRQ 23
B0rken -
eth0: RTL8169s at 0xffffc2000017c000, 00:01:80:4d:0b:3b, XID 00800000 IRQ 23

Note: that's from the logs - I won't get around to testing that stuff until
tomorrow afternoon.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index 4b7cb38..b5a7358 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -2011,8 +2011,6 @@  rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 		}
 	}
 
-	pci_set_master(pdev);
-
 	/* ioremap MMIO region */
 	ioaddr = ioremap(pci_resource_start(pdev, region), R8169_REGS_SIZE);
 	if (!ioaddr) {
@@ -2039,6 +2037,8 @@  rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 		msleep_interruptible(1);
 	}
 
+	pci_set_master(pdev);
+
 	/* Identify chip attached to board */
 	rtl8169_get_mac_version(tp, ioaddr);