NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

kern/41009: re-driver for recent RealTek 8168B/8111B PCIe GB-eth devices broken



>Number:         41009
>Category:       kern
>Synopsis:       re-driver for recent RealTek 8168B/8111B PCIe GB-eth devices 
>broken
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Mar 13 21:55:01 +0000 2009
>Originator:     Uwe Krüger
>Release:        NetBSD 5.0_RC2 (snapshot 2009/03/11)
>Organization:
>Environment:
NetBSD atom 5.0_RC2 NetBSD 5.0_RC2 (GENERIC) #0: Fri Mar 13 21:34:43 CET 2009  
root@atom:/usr/src/sys/arch/i386/compile/GENERIC i386
>Description:
The re-driver for these wired ethernet devices (used on many Intel-Atom 
mainboards) does not work reliably, i.e. sometimes with luck the device does 
work but in approx. 80% of all boot attempts you get an error message like the 
following:

re0: reset never completed!
re0: PHY write reg 0 <- 8400 failed
re0: PHY write reg 1f <- 1 failed
re0: PHY write reg 9 <- 273a failed
re0: PHY write reg e <- 7bfb failed
re0: PHY write reg 1b <- 841e failed
re0: PHY write reg 1f <- 2 failed
re0: PHY write reg 1 <- 90d0 failed
re0: PHY write reg 1f <- 0 failed
re0: PHY write reg e <- 0 failed
re0: PHY write reg 4 <- 1e1 failed
re0: PHY write reg 9 <- 300 failed
re0: PHY write reg 0 <- 9200 failed
re0: PHY write reg 9 <- 1200 failed
re0: PHY write reg 0 <- 1340 failed

>How-To-Repeat:
Try to use the ethernet device e.g. on an eeepc-box. As said above are rare 
cases when the device works but in most cases the error occurs.
>Fix:
Based on the code of OpenBSD and FreeBSD I've created the following path that 
fixes the problem:

--- nb.orig/usr/src/sys/dev/ic/rtl8169.c        2008-08-23 16:27:45.000000000 
+0200
+++ nb/usr/src/sys/dev/ic/rtl8169.c     2009-03-13 19:55:46.000000000 +0100
@@ -392,7 +392,8 @@
         * NB: Realtek-supplied Linux driver does this only for
         * MCFG_METHOD_2, which corresponds to sc->sc_rev == 3.
         */
-       if (1) /* XXX check softc flag for 8169s version */
+       if (sc->sc_rev && sc->sc_rev <= 5 )
+                /* XXX check softc flag for 8169s version */
                CSR_WRITE_1(sc, RTK_LDPS, 1);
 
 }
@@ -567,9 +568,6 @@
        struct ifnet *ifp;
        int error = 0, i, addr_len;
 
-       /* Reset the adapter. */
-       re_reset(sc);
-
        if ((sc->sc_quirk & RTKQ_8139CPLUS) == 0) {
                uint32_t hwrev;
 
@@ -631,6 +629,9 @@
                sc->re_ldata.re_tx_desc_cnt = RE_TX_DESC_CNT_8139;
        }
 
+       /* Reset the adapter. */
+       re_reset(sc);
+
        if (sc->sc_rev == 24 || sc->sc_rev == 25) {
                /*
                 * Get station address from ID registers.



Home | Main Index | Thread Index | Old Index