From f76184d2bf5b1a3c4d5c2a7e475a3e0217a1c52d Mon Sep 17 00:00:00 2001 From: yongari Date: Mon, 23 Aug 2010 18:51:31 +0000 Subject: Move xl_reset() to xl_init_locked(). This will make driver initialize controller from a known good state. Previously driver used to issue controller reset while TX/RX DMA are in progress. I guess resetting controller in active TX/RX DMA cycle is to ensure stopping I/Os in xl_shutdown(). I remember some buggy controllers didn't respond with stop command if controller is under high network load at the time of shutdown so resetting controller was the only safe way to stop the I/Os. However, from my experiments, controller always responded with stop command under high network load so I think it's okay to remove the xl_reset() in device_shutdown handler. Resetting controller also will clear configured RX filter which in turn will make WOL support hard because driver have to reprogram RX filter in WOL handler as well as setting station address. --- sys/dev/xl/if_xl.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/sys/dev/xl/if_xl.c b/sys/dev/xl/if_xl.c index 6623551..d8ea2c4 100644 --- a/sys/dev/xl/if_xl.c +++ b/sys/dev/xl/if_xl.c @@ -1635,7 +1635,6 @@ xl_detach(device_t dev) /* These should only be active if attach succeeded */ if (device_is_attached(dev)) { XL_LOCK(sc); - xl_reset(sc); xl_stop(sc); XL_UNLOCK(sc); taskqueue_drain(taskqueue_swi, &sc->xl_task); @@ -2246,7 +2245,6 @@ xl_intr(void *arg) } if (status & XL_STAT_ADFAIL) { - xl_reset(sc); ifp->if_drv_flags &= ~IFF_DRV_RUNNING; xl_init_locked(sc); } @@ -2318,7 +2316,6 @@ 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); } @@ -2754,6 +2751,9 @@ xl_init_locked(struct xl_softc *sc) */ xl_stop(sc); + /* Reset the chip to a known state. */ + xl_reset(sc); + if (sc->xl_miibus == NULL) { CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_RX_RESET); xl_wait(sc); @@ -3236,7 +3236,6 @@ xl_watchdog(struct xl_softc *sc) device_printf(sc->xl_dev, "no carrier - transceiver cable problem?\n"); - xl_reset(sc); ifp->if_drv_flags &= ~IFF_DRV_RUNNING; xl_init_locked(sc); @@ -3335,7 +3334,6 @@ xl_shutdown(device_t dev) sc = device_get_softc(dev); XL_LOCK(sc); - xl_reset(sc); xl_stop(sc); XL_UNLOCK(sc); @@ -3367,7 +3365,6 @@ xl_resume(device_t dev) XL_LOCK(sc); - xl_reset(sc); if (ifp->if_flags & IFF_UP) { ifp->if_drv_flags &= ~IFF_DRV_RUNNING; xl_init_locked(sc); -- cgit v1.1