Driver Realtek RTL8111B-GR* di FreeBSD

By : mqueue
DUA hari belakangan ini saya direpotkan dengan belum tersedianya module driver Gigabit (10/100/1000 Mbits/sec) LAN Realtek RTL8111B-GR* device di FreeBSD. Pasalnya, sewaktu membeli mainboard Intel D945GCNL saya tidak berpikiran kalau NIC card onboard-nya sudah support gigabit ethernet seperti di atas. 
Setelah upgrade kernel ke versi terbaru, FreeBSD 6.3-PRERELEASE, ternyata module untuk NIC card tersebut belum juga tersedia, alamaaakk... bikin pusing juga, mana sudah didesak sama empunya server harus selesai secepatnya (untung dengan kata "secepatnya" yang berarti belum dilimit kapan batas waktunya, hehehehe).
Beruntung setelah obrak-abrik google, akhirnya ketemu patch versi agak lawas daripada versi module kernel 6.3-PRERELEASE.
Ada dua file yang harus dipatch yaitu if_re.c dan if_rlreg.h. Untuk patchnya sendiri, silakan diubah untuk menyesuaikan dengan source module versi terbaru (karena patch ini dirilis sebelum kernel 6.3-PRERELEASE).
Index: dev/re/if_re.c
===================================================================
RCS file: sys/dev/re/if_re.c,v
retrieving revision 1.95
diff -u -r1.95 if_re.c
--- dev/re/if_re.c      14 Aug 2007 02:00:04 -0000      1.95
+++ dev/re/if_re.c      30 Oct 2007 01:05:06 -0000
@@ -180,6 +180,8 @@
                "RealTek 8168/8111B PCIe Gigabit Ethernet" },
        { RT_VENDORID, RT_DEVICEID_8168, RL_HWREV_8168_SPIN2,
                "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_8169, RL_HWREV_8169,
                "RealTek 8169 Gigabit Ethernet" },
        { RT_VENDORID, RT_DEVICEID_8169, RL_HWREV_8169S,
@@ -221,6 +223,7 @@
        { RL_HWREV_8100E, RL_8169, "8100E"},
        { RL_HWREV_8101E, RL_8169, "8101E"},
        { RL_HWREV_8168_SPIN2, RL_8169, "8168"},
+       { RL_HWREV_8168_SPIN3, RL_8169, "8168"},
        { 0, 0, NULL }
 };

@@ -676,14 +679,18 @@
         */

        hwrev = CSR_READ_4(sc, RL_TXCFG) & RL_TXCFG_HWREV;
-
-       if (hwrev == RL_HWREV_8100E || hwrev == RL_HWREV_8101E ||
-           hwrev == RL_HWREV_8168_SPIN1 || hwrev == RL_HWREV_8168_SPIN2) {
+       switch (hwrev) {
+       case RL_HWREV_8100E:
+       case RL_HWREV_8101E:
+       case RL_HWREV_8168_SPIN1:
+       case RL_HWREV_8168_SPIN2:
                CSR_WRITE_4(sc, RL_MAR0, bswap32(hashes[1]));
                CSR_WRITE_4(sc, RL_MAR4, bswap32(hashes[0]));
-       } else {
+               break;
+       default:
                CSR_WRITE_4(sc, RL_MAR0, hashes[0]);
                CSR_WRITE_4(sc, RL_MAR4, hashes[1]);
+               break;
        }
 }

@@ -1314,6 +1321,7 @@
                        case RL_HWREV_8169_8110SB:
                        case RL_HWREV_8169_8110SC:
                        case RL_HWREV_8168_SPIN2:
+                       case RL_HWREV_8168_SPIN3:
                                re_gmii_writereg(dev, 1, 0x1f, 0);
                                re_gmii_writereg(dev, 1, 0x0e, 0);
                                break;
Index: pci/if_rlreg.h
===================================================================
RCS file: sys/pci/if_rlreg.h,v
retrieving revision 1.67
diff -u -r1.67 if_rlreg.h
--- pci/if_rlreg.h      24 Jul 2007 01:24:03 -0000      1.67
+++ pci/if_rlreg.h      30 Oct 2007 01:05:07 -0000
@@ -156,6 +156,7 @@
 #define RL_HWREV_8100E         0x30800000
 #define RL_HWREV_8101E         0x34000000
 #define RL_HWREV_8168_SPIN2    0x38000000
+#define RL_HWREV_8168_SPIN3    0x38400000
 #define RL_HWREV_8139          0x60000000
 #define RL_HWREV_8139A         0x70000000
 #define RL_HWREV_8139AG        0x70800000
Setelah recompile kernel, akhirnya module driver tersebut dapat mendeteksi NIC Card dan mengenali NIC tersebut sebagai re.
re0: <RealTek 8168/8111B PCIe Gigabit Ethernet> port 0x2000-0x20ff mem 0xe0100000-0xe0100fff irq 17 at device 0.0 on pci2
miibus0: <MII bus> on re0
re0: Ethernet address: 00:1c:c0:0d:a0:4d
re0: [FAST]
proxy# ifconfig
re0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
        options=1b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING>
        inet6 fe80::21c:c0ff:fe0d:a04d%re0 prefixlen 64 scopeid 0x1
        inet 192.168.1.99 netmask 0xfffffff8 broadcast 192.168.1.255
        ether 00:1c:c0:0d:a0:4d
        media: Ethernet autoselect (100baseTX <full-duplex>)
        status: active
proxy# ping yahoo.com
PING yahoo.com (66.94.234.13): 56 data bytes
64 bytes from 66.94.234.13: icmp_seq=0 ttl=49 time=268.663 ms
64 bytes from 66.94.234.13: icmp_seq=1 ttl=48 time=244.545 ms
64 bytes from 66.94.234.13: icmp_seq=2 ttl=48 time=272.899 ms

Related

Kernel 4290154472469302488

Posting Komentar

emo-but-icon

Follow Us

Hot in week

Recent

Comments

Side Ads

Text Widget

Connect Us

item