svn commit: r211716 - head/sys/dev/xl

Pyun YongHyeon yongari at FreeBSD.org
Mon Aug 23 18:51:31 UTC 2010


Author: yongari
Date: Mon Aug 23 18:51:31 2010
New Revision: 211716
URL: http://svn.freebsd.org/changeset/base/211716

Log:
  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.

Modified:
  head/sys/dev/xl/if_xl.c

Modified: head/sys/dev/xl/if_xl.c
==============================================================================
--- head/sys/dev/xl/if_xl.c	Mon Aug 23 18:21:40 2010	(r211715)
+++ head/sys/dev/xl/if_xl.c	Mon Aug 23 18:51:31 2010	(r211716)
@@ -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 p
 			}
 
 			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);


More information about the svn-src-head mailing list