*** if_bge.c.orig Wed Sep 15 09:44:12 2004 --- if_bge.c Wed Sep 15 10:04:31 2004 *************** *** 2802,2808 **** struct bge_softc *sc; struct ifnet *ifp; u_int32_t statusword; ! u_int32_t status; sc = xsc; ifp = &sc->arpcom.ac_if; --- 2802,2808 ---- struct bge_softc *sc; struct ifnet *ifp; u_int32_t statusword; ! u_int32_t status, mimode; sc = xsc; ifp = &sc->arpcom.ac_if; *************** *** 2863,2872 **** * that sometimes appear on fiber NICs during * periods of heavy traffic. (There should be no * effect on copper NICs.) */ status = CSR_READ_4(sc, BGE_MAC_STS); if (!(status & (BGE_MACSTAT_PORT_DECODE_ERROR| ! BGE_MACSTAT_MI_COMPLETE))) { sc->bge_link = 0; callout_stop(&sc->bge_stat_ch); bge_tick_locked(sc); --- 2863,2881 ---- * that sometimes appear on fiber NICs during * periods of heavy traffic. (There should be no * effect on copper NICs.) + * + * If we do have a copper NIC (bge_tbi == 0) then + * check that the AUTOPOLL bit is set before + * processing the event as a real link change. + * Turning AUTOPOLL on and off in the MII read/write + * functions will often trigger a link status + * interrupt for no reason. */ status = CSR_READ_4(sc, BGE_MAC_STS); + mimode = CSR_READ_4(sc, BGE_MI_MODE); if (!(status & (BGE_MACSTAT_PORT_DECODE_ERROR| ! BGE_MACSTAT_MI_COMPLETE)) && (!sc->bge_tbi && ! (mimode & BGE_MIMODE_AUTOPOLL))) { sc->bge_link = 0; callout_stop(&sc->bge_stat_ch); bge_tick_locked(sc);