Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 14 Aug 2006 17:22:23 +0800
From:      Dinesh Nair <dinesh@alphaque.com>
To:        freebsd-hardware@freebsd.org, freebsd-hackers@freebsd.org
Subject:   Unable to get RealTek 8139C+ to work with re(4) under FreeBSD 6.1
Message-ID:  <44E040CF.9080205@alphaque.com>

next in thread | raw e-mail | index | archive | help

i've got a single board computer with VIA C3 Samuel 2, 256MB RAM and 4 
onboard Realtek 8139C+ NICs. I'm attempting to get FreeBSD 6.1-STABLE 
working on them, but the realtek NICs just don't seem to want to work. 
booting up led to a kernel trap with the following,

rlphy0: <RealTek internal media interface> on miibus0
rlphy0:  10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
re0: Ethernet address: 00:60:e0:e1:21:d7
re0: diagnostic failed, failed to receive packet in loopback mode
re0: attach aborted due to hardware diag failure
kernel trap 12 with interrupts disabled

Fatal trap 12: page fault while in kernel mode
fault virtual address   = 0x74
fault code              = supervisor read, page not present
instruction pointer     = 0x20:0xc0625d45
stack pointer           = 0x28:0xc2420a50
frame pointer           = 0x28:0xc2420a54
code segment            = base 0x0, limit 0xfffff, type 0x1b
                        = DPL 0, pres 1, def32 1, gran 1
processor eflags        = resume, IOPL = 0
current process         = 0 (swapper)
trap number             = 12
panic: page fault
Uptime: 1s

looking through /usr/src/sys/dev/re/if_re.c, and reading this thread, 
http://lists.freebsd.org/pipermail/freebsd-current/2004-June/029373.html, 
i've patched if_re.c to skip the re_diag() routine if the NIC is not a 
Realtek 8169. the patch follows,

----- CUT HERE -----
--- if_re.c.orig	Mon Aug 14 14:43:05 2006
+++ if_re.c	Mon Aug 14 14:42:16 2006
@@ -1235,12 +1235,14 @@
  	ether_ifattach(ifp, eaddr);

  	/* Perform hardware diagnostic. */
-	error = re_diag(sc);
+	if (sc->rl_type == RL_8169) {
+		error = re_diag(sc);

-	if (error) {
-		device_printf(dev, "attach aborted due to hardware diag failure\n");
-		ether_ifdetach(ifp);
-		goto fail;
+		if (error) {
+			device_printf(dev, "attach aborted due to hardware diag failure\n");
+			ether_ifdetach(ifp);
+			goto fail;
+		}
  	}

  	/* Hook interrupt last to avoid having to lock softc */
----- CUT HERE -----

with the patch applied, the kernel trap goes away and the box boots up. 
however, though the link light comes on, the device is effectively 
unuseable for ethernet traffic. nothing seems to go in or out of the device 
with ping and other tcp/udp traffic failing. note the media state and the 
missing status line from the ifconfig output.

any clue as to what's happenning here or to pointers/patches to fix this 
would be much appreciated. i've got the box sitting beside me, so testing 
patches et al would be highly possible.

dmesg, ifconfig and pciconf outputs are as follows:

re0: <RealTek 8139C+ 10/100BaseTX> port 0xe300-0xe3ff mem 
0xed800000-0xed8000ff irq 5 at device 16.0 on pci0
miibus0: <MII bus> on re0
rlphy0: <RealTek internal media interface> on miibus0
rlphy0:  10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
re0: Ethernet address: 00:60:e0:e1:21:d7
re1: <RealTek 8139C+ 10/100BaseTX> port 0xe400-0xe4ff mem 
0xed801000-0xed8010ff irq 12 at device 17.0 on pci0
miibus1: <MII bus> on re1
rlphy1: <RealTek internal media interface> on miibus1
rlphy1:  10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
re1: Ethernet address: 00:60:e0:e1:21:d6
re2: <RealTek 8139C+ 10/100BaseTX> port 0xe500-0xe5ff mem 
0xed802000-0xed8020ff irq 10 at device 18.0 on pci0
miibus2: <MII bus> on re2
rlphy2: <RealTek internal media interface> on miibus2
rlphy2:  10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
re2: Ethernet address: 00:60:e0:e1:21:d5
re3: <RealTek 8139C+ 10/100BaseTX> port 0xe600-0xe6ff mem 
0xed803000-0xed8030ff irq 11 at device 19.0 on pci0
miibus3: <MII bus> on re3
rlphy3: <RealTek internal media interface> on miibus3
rlphy3:  10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
re3: Ethernet address: 00:60:e0:e1:21:d4

# ifconfig -a
re0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
         options=18<VLAN_MTU,VLAN_HWTAGGING>
         inet 192.168.1.141 netmask 0xffffff00 broadcast 192.168.1.255
         ether 00:60:e0:e1:21:d7
         media: Ethernet autoselect (none)
re1: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
         options=18<VLAN_MTU,VLAN_HWTAGGING>
         inet 0.0.0.0 netmask 0xff000000 broadcast 255.255.255.255
         ether 00:60:e0:e1:21:d6
         media: Ethernet autoselect (none)
re2: flags=8802<BROADCAST,SIMPLEX,MULTICAST> mtu 1500
         options=18<VLAN_MTU,VLAN_HWTAGGING>
         ether 00:60:e0:e1:21:d5
         media: Ethernet autoselect (none)
re3: flags=8802<BROADCAST,SIMPLEX,MULTICAST> mtu 1500
         options=18<VLAN_MTU,VLAN_HWTAGGING>
         ether 00:60:e0:e1:21:d4
         media: Ethernet autoselect (none)

# pciconf -l -v
re0@pci0:16:0:  class=0x020000 card=0x813910ec chip=0x813910ec rev=0x20 
hdr=0x00
     class    = network
     subclass = ethernet
re1@pci0:17:0:  class=0x020000 card=0x813910ec chip=0x813910ec rev=0x20 
hdr=0x00
     class    = network
     subclass = ethernet
re2@pci0:18:0:  class=0x020000 card=0x813910ec chip=0x813910ec rev=0x20 
hdr=0x00
     class    = network
     subclass = ethernet
re3@pci0:19:0:  class=0x020000 card=0x813910ec chip=0x813910ec rev=0x20 
hdr=0x00
     class    = network
     subclass = ethernet


-- 
Regards,                           /\_/\   "All dogs go to heaven."
dinesh@alphaque.com                (0 0)   http://www.openmalaysiablog.com/
+==========================----oOO--(_)--OOo----==========================+
| for a in past present future; do                                        |
|   for b in clients employers associates relatives neighbours pets; do   |
|   echo "The opinions here in no way reflect the opinions of my $a $b."  |
| done; done                                                              |
+=========================================================================+



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?44E040CF.9080205>