Index: if_bge.c =================================================================== RCS file: /home/ncvs/src/sys/dev/bge/if_bge.c,v retrieving revision 1.137 diff -u -r1.137 if_bge.c --- if_bge.c 17 Aug 2006 09:53:04 -0000 1.137 +++ if_bge.c 18 Aug 2006 06:41:18 -0000 @@ -3226,17 +3226,19 @@ static int bge_ifmedia_upd(struct ifnet *ifp) { - struct bge_softc *sc; + struct bge_softc *sc = ifp->if_softc; struct mii_data *mii; struct ifmedia *ifm; - sc = ifp->if_softc; + BGE_LOCK(sc); ifm = &sc->bge_ifmedia; /* If this is a 1000baseX NIC, enable the TBI port. */ if (sc->bge_tbi) { - if (IFM_TYPE(ifm->ifm_media) != IFM_ETHER) + if (IFM_TYPE(ifm->ifm_media) != IFM_ETHER) { + BGE_UNLOCK(sc); return (EINVAL); + } switch(IFM_SUBTYPE(ifm->ifm_media)) { case IFM_AUTO: /* @@ -3268,8 +3270,10 @@ } break; default: + BGE_UNLOCK(sc); return (EINVAL); } + BGE_UNLOCK(sc); return (0); } @@ -3283,6 +3287,7 @@ } mii_mediachg(mii); + BGE_UNLOCK(sc); return (0); } @@ -3292,11 +3297,10 @@ static void bge_ifmedia_sts(struct ifnet *ifp, struct ifmediareq *ifmr) { - struct bge_softc *sc; + struct bge_softc *sc = ifp->if_softc; struct mii_data *mii; - sc = ifp->if_softc; - + BGE_LOCK(sc); if (sc->bge_tbi) { ifmr->ifm_status = IFM_AVALID; ifmr->ifm_active = IFM_ETHER; @@ -3305,6 +3309,7 @@ ifmr->ifm_status |= IFM_ACTIVE; else { ifmr->ifm_active |= IFM_NONE; + BGE_UNLOCK(sc); return; } ifmr->ifm_active |= IFM_1000_SX; @@ -3312,6 +3317,7 @@ ifmr->ifm_active |= IFM_HDX; else ifmr->ifm_active |= IFM_FDX; + BGE_UNLOCK(sc); return; } @@ -3319,6 +3325,8 @@ mii_pollstat(mii); ifmr->ifm_active = mii->mii_media_active; ifmr->ifm_status = mii->mii_media_status; + + BGE_UNLOCK(sc); } static int