Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci Don't use the PHY Auto Poll Mode on many chips. ...



details:   https://anonhg.NetBSD.org/src/rev/ccd9bd043c51
branches:  trunk
changeset: 330288:ccd9bd043c51
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Wed Jul 02 22:25:14 2014 +0000

description:
Don't use the PHY Auto Poll Mode on many chips. This fixes a bug that MII
Fiber NIC drop packet about 50%. Same as {Free,Open}BSD.
Tested on HP Moonshot. Thanks zafer@ for testing.

diffstat:

 sys/dev/pci/if_bge.c |  22 +++++++++++++++-------
 1 files changed, 15 insertions(+), 7 deletions(-)

diffs (50 lines):

diff -r 91353b328103 -r ccd9bd043c51 sys/dev/pci/if_bge.c
--- a/sys/dev/pci/if_bge.c      Wed Jul 02 22:21:50 2014 +0000
+++ b/sys/dev/pci/if_bge.c      Wed Jul 02 22:25:14 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_bge.c,v 1.271 2014/06/23 17:44:31 msaitoh Exp $     */
+/*     $NetBSD: if_bge.c,v 1.272 2014/07/02 22:25:14 msaitoh Exp $     */
 
 /*
  * Copyright (c) 2001 Wind River Systems
@@ -79,7 +79,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.271 2014/06/23 17:44:31 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bge.c,v 1.272 2014/07/02 22:25:14 msaitoh Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -2501,7 +2501,7 @@
        bus_size_t rcb_addr;
        struct ifnet *ifp = &sc->ethercom.ec_if;
        bge_hostaddr taddr;
-       uint32_t        dmactl, val;
+       uint32_t        dmactl, mimode, val;
        int             i, limit;
 
        /*
@@ -3166,10 +3166,18 @@
        if (sc->bge_flags & BGEF_FIBER_TBI) {
                CSR_WRITE_4(sc, BGE_MI_STS, BGE_MISTS_LINK);
        } else {
-               /* 5718 step 68 */
-               BGE_STS_SETBIT(sc, BGE_STS_AUTOPOLL);
-               /* 5718 step 69 (optionally) */
-               BGE_SETBIT(sc, BGE_MI_MODE, BGE_MIMODE_AUTOPOLL | (10 << 16));
+               if ((sc->bge_flags & BGEF_CPMU_PRESENT) != 0)
+                       mimode = BGE_MIMODE_500KHZ_CONST;
+               else
+                       mimode = BGE_MIMODE_BASE;
+               /* 5718 step 68. 5718 step 69 (optionally). */
+               if (BGE_IS_5700_FAMILY(sc) ||
+                   BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5705) {
+                       mimode |= BGE_MIMODE_AUTOPOLL;
+                       BGE_STS_SETBIT(sc, BGE_STS_AUTOPOLL);
+               }
+               mimode |= BGE_MIMODE_PHYADDR(sc->bge_phy_addr);
+               CSR_WRITE_4(sc, BGE_MI_MODE, mimode);
                if (BGE_ASICREV(sc->bge_chipid) == BGE_ASICREV_BCM5700)
                        CSR_WRITE_4(sc, BGE_MAC_EVT_ENB,
                            BGE_EVTENB_MI_INTERRUPT);



Home | Main Index | Thread Index | Old Index