diff options
author | yongari <yongari@FreeBSD.org> | 2010-08-23 00:31:55 +0000 |
---|---|---|
committer | yongari <yongari@FreeBSD.org> | 2010-08-23 00:31:55 +0000 |
commit | 9e3425687658a20afbc440c47e6f5cf7def2f00d (patch) | |
tree | 62f0ac87d1d4cb1a9491a530721a07c431126d35 /sys/dev/xl/if_xl.c | |
parent | 73721416ee0a328661fd2d5b873fff64bc95695f (diff) | |
download | FreeBSD-src-9e3425687658a20afbc440c47e6f5cf7def2f00d.zip FreeBSD-src-9e3425687658a20afbc440c47e6f5cf7def2f00d.tar.gz |
Remove unnecessary controller reinitialization by checking
IFF_DRV_RUNNING flag.
Diffstat (limited to 'sys/dev/xl/if_xl.c')
-rw-r--r-- | sys/dev/xl/if_xl.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/sys/dev/xl/if_xl.c b/sys/dev/xl/if_xl.c index 2145ec8..6623551 100644 --- a/sys/dev/xl/if_xl.c +++ b/sys/dev/xl/if_xl.c @@ -2247,6 +2247,7 @@ xl_intr(void *arg) if (status & XL_STAT_ADFAIL) { xl_reset(sc); + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; xl_init_locked(sc); } @@ -2318,6 +2319,7 @@ xl_poll_locked(struct ifnet *ifp, enum poll_cmd cmd, int count) if (status & XL_STAT_ADFAIL) { xl_reset(sc); + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; xl_init_locked(sc); } @@ -2745,6 +2747,8 @@ xl_init_locked(struct xl_softc *sc) XL_LOCK_ASSERT(sc); + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) + return; /* * Cancel pending I/O and free all RX/TX buffers. */ @@ -2993,6 +2997,7 @@ xl_ifmedia_upd(struct ifnet *ifp) if (sc->xl_media & XL_MEDIAOPT_MII || sc->xl_media & XL_MEDIAOPT_BTX || sc->xl_media & XL_MEDIAOPT_BT4) { + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; xl_init_locked(sc); } else { xl_setmode(sc, ifm->ifm_media); @@ -3108,10 +3113,8 @@ xl_ioctl(struct ifnet *ifp, u_long command, caddr_t data) CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_RX_SET_FILT|rxfilt); XL_SEL_WIN(7); - } else { - if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) - xl_init_locked(sc); - } + } else + xl_init_locked(sc); } else { if (ifp->if_drv_flags & IFF_DRV_RUNNING) xl_stop(sc); @@ -3234,6 +3237,7 @@ xl_watchdog(struct xl_softc *sc) "no carrier - transceiver cable problem?\n"); xl_reset(sc); + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; xl_init_locked(sc); if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) { @@ -3364,8 +3368,10 @@ xl_resume(device_t dev) XL_LOCK(sc); xl_reset(sc); - if (ifp->if_flags & IFF_UP) + if (ifp->if_flags & IFF_UP) { + ifp->if_drv_flags &= ~IFF_DRV_RUNNING; xl_init_locked(sc); + } XL_UNLOCK(sc); |