kern/123123: [re] Realtek RTL8111C detection and failure

Peter C. Lai cowbert at gmail.com
Sun Apr 27 02:10:01 UTC 2008


>Number:         123123
>Category:       kern
>Synopsis:       [re] Realtek RTL8111C detection and failure
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Apr 27 02:10:01 UTC 2008
>Closed-Date:
>Last-Modified:
>Originator:     Peter C. Lai
>Release:        7.0-RELEASE
>Organization:
Hyperfine Informatics Enterprises
>Environment:
FreeBSD chemokine.mcb.uconn.edu 7.0-RELEASE FreeBSD 7.0-RELEASE #2: Sat Apr 26 20:51:10 UTC 2008 root at chemokine.mcb.uconn.edu:/usr/obj/usr/src/sys/COWBERT i386
>Description:
New motherboards (i.e. Gigabyte GA-G31M-S2L) now ship with RealTek RTL8111C PCI-E gigE NICs. These aren't currently picked up by the re(4) driver.

With pciconf -lv:

none0 at pci0:2:0:0: class=0x020000 card=0xe0001458 chip=0x816810ec rev=0x02 hdr=0x00
vendor = 'Realtek Semiconductor'
device = 'RTL8168/8111 PCI-E Gigabit Ethernet NIC'
class = network
subclass = ethernet

After a multihour google hunt, I was able to find the appropriate HWREV string from a netbsd mailing list (see http://archive.netbsd.se/?ml=netbsd-tech-net&a=2008-03&m=6632278). I patched sys/pci/if_rlreg.h to define an 8168 card with HWREV of 0x3c000000 and added this constant to sys/dev/re/if_re.c underneath the other RL_HWREV_8168_* entries.

re(4) now sees the card, and it can detect link level changes (properly detects no carrier vs. link up), but it cannot seem to set media type correctly and will not read the station ID (MAC Address) from the EEPROM properly.

relevant post-patch dmesg segment:
dmesg --snip--

pci2: <ACPI PCI bus> on pcib2
pci2: domain=0, physical bus=2
found->	vendor=0x10ec, dev=0x8168, revid=0x02
	domain=0, bus=2, slot=0, func=0
	class=02-00-00, hdrtype=0x00, mfdev=0
	cmdreg=0x0007, statreg=0x0010, cachelnsz=8 (dwords)
	lattimer=0x00 (0 ns), mingnt=0x00 (0 ns), maxlat=0x00 (0 ns)
	intpin=a, irq=10
	powerspec 3  supports D0 D1 D2 D3  current D0
	MSI supports 2 messages, 64 bit
	MSI-X supports 2 messages in map 0x20
	map[10]: type I/O Port, range 32, base 0xd000, size  8, enabled
pcib2: requested I/O range 0xd000-0xd0ff: in range
	map[18]: type Prefetchable Memory, range 64, base 0xe1110000, size 12, enabled
pcib2: requested memory range 0xe1110000-0xe1110fff: good
	map[20]: type Prefetchable Memory, range 64, base 0xe1100000, size 16, enabled
pcib2: requested memory range 0xe1100000-0xe110ffff: good
pcib2: matched entry for 2.0.INTA
pcib2: slot 0 INTA hardwired to IRQ 17
re0: Reserved 0x100 bytes for rid 0x10 type 4 at 0xd000
pcib2: re0 requested I/O range 0xd000-0xd0ff: in range
pcib2: re0 requested I/O range 0xd000-0xd0ff: in range
pcib2: re0 requested I/O range 0xd000-0xd0ff: in range
pcib2: re0 requested I/O range 0xd000-0xd0ff: in range
pcib2: re0 requested I/O range 0xd000-0xd0ff: in range
pcib2: re0 requested I/O range 0xd000-0xd0ff: in range
pcib2: re0 requested I/O range 0xd000-0xd0ff: in range
re0: <RealTek 8168/8111C PCIe Gigabit Ethernet> port 0xd000-0xd0ff mem 0xe1110000-0xe1110fff,0xe1100000-0xe110ffff irq 17 at device 0.0 on pci2
pcib2: re0 requested I/O range 0xd000-0xd0ff: in range
re0: MSI count : 2
re0: attempting to allocate 2 MSI vectors (2 supported)
msi: routing MSI IRQ 256 to vector 50
msi: routing MSI IRQ 257 to vector 51
re0: using IRQs 256-257 for MSI
re0: Using 2 MSI messages
miibus0: <MII bus> on re0
rgephy0: <RTL8169S/8110S/8211B media interface> PHY 1 on miibus0
rgephy0:  10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseT, 1000baseT-FDX, auto
re0: bpf attached
re0: [MPSAFE]
re0: [FILTER]
re0: [MPSAFE]
re0: [FILTER]

dmesg -- snip --

ifconfig
re0: flags=8802<BROADCAST,SIMPLEX,MULTICAST> metric 0 mtu 1500
	options=9b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM>
	ether 00:00:00:00:00:00
	media: Ethernet 100baseTX (10baseT/UTP <half-duplex>)
	status: active

>How-To-Repeat:

>Fix:


Patch attached with submission follows:

--- sys/pci/if_rlreg.h.dist	2007-12-15 02:57:18.000000000 +0000
+++ sys/pci/if_rlreg.h	2008-04-26 20:34:32.000000000 +0000
@@ -153,6 +153,7 @@
 #define RL_HWREV_8169_8110SB	0x10000000
 #define RL_HWREV_8169_8110SC	0x18000000
 #define RL_HWREV_8168_SPIN1	0x30000000
+#define RL_HWREV_8168_8111C	0x3c000000
 #define RL_HWREV_8100E		0x30800000
 #define RL_HWREV_8101E		0x34000000
 #define RL_HWREV_8168_SPIN2	0x38000000
--- sys/dev/re/if_re.c.dist	2007-12-15 02:57:18.000000000 +0000
+++ sys/dev/re/if_re.c	2008-04-26 13:23:25.000000000 +0000
@@ -184,6 +184,8 @@
 		"RealTek 8168/8111B PCIe Gigabit Ethernet" },
 	{ RT_VENDORID, RT_DEVICEID_8168, RL_HWREV_8168_SPIN3,
 		"RealTek 8168/8111B PCIe Gigabit Ethernet" },
+	{ RT_VENDORID, RT_DEVICEID_8168, RL_HWREV_8168_8111C,
+		"RealTek 8168/8111C PCIe Gigabit Ethernet"},
 	{ RT_VENDORID, RT_DEVICEID_8169, RL_HWREV_8169,
 		"RealTek 8169 Gigabit Ethernet" },
 	{ RT_VENDORID, RT_DEVICEID_8169, RL_HWREV_8169S,
@@ -226,6 +228,7 @@
 	{ RL_HWREV_8101E, RL_8169, "8101E"},
 	{ RL_HWREV_8168_SPIN2, RL_8169, "8168"},
 	{ RL_HWREV_8168_SPIN3, RL_8169, "8168"},
+	{ RL_HWREV_8168_8111C, RL_8169, "8168"},
 	{ 0, 0, NULL }
 };
 
@@ -692,6 +695,7 @@
 	case RL_HWREV_8168_SPIN1:
 	case RL_HWREV_8168_SPIN2:
 	case RL_HWREV_8168_SPIN3:
+	case RL_HWREV_8168_8111C:
 		CSR_WRITE_4(sc, RL_MAR0, bswap32(hashes[1]));
 		CSR_WRITE_4(sc, RL_MAR4, bswap32(hashes[0]));
 		break;
@@ -1330,6 +1334,7 @@
 			case RL_HWREV_8169_8110SC:
 			case RL_HWREV_8168_SPIN2:
 			case RL_HWREV_8168_SPIN3:
+			case RL_HWREV_8168_8111C:
 				re_gmii_writereg(dev, 1, 0x1f, 0);
 				re_gmii_writereg(dev, 1, 0x0e, 0);
 				break;


>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list