Module Name: src
Committed By: msaitoh
Date: Wed Jul 2 22:25:14 UTC 2014
Modified Files:
src/sys/dev/pci: if_bge.c
Log Message:
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.
To generate a diff of this commit:
cvs rdiff -u -r1.271 -r1.272 src/sys/dev/pci/if_bge.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/pci/if_bge.c
diff -u src/sys/dev/pci/if_bge.c:1.271 src/sys/dev/pci/if_bge.c:1.272
--- src/sys/dev/pci/if_bge.c:1.271 Mon Jun 23 17:44:31 2014
+++ src/sys/dev/pci/if_bge.c Wed Jul 2 22:25:14 2014
@@ -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 @@ bge_blockinit(struct bge_softc *sc)
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 @@ bge_blockinit(struct bge_softc *sc)
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);