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

Pyun YongHyeon yongari at FreeBSD.org
Fri May 6 22:55:54 UTC 2011


Author: yongari
Date: Fri May  6 22:55:53 2011
New Revision: 221563
URL: http://svn.freebsd.org/changeset/base/221563

Log:
  Terminate interrupt handler if driver detect it's not running.
  Also add check for driver running state before trying to send
  frames. While I'm here, use for loop.

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

Modified: head/sys/dev/xl/if_xl.c
==============================================================================
--- head/sys/dev/xl/if_xl.c	Fri May  6 22:45:33 2011	(r221562)
+++ head/sys/dev/xl/if_xl.c	Fri May  6 22:55:53 2011	(r221563)
@@ -2273,10 +2273,14 @@ xl_intr(void *arg)
 	}
 #endif
 
-	while ((status = CSR_READ_2(sc, XL_STATUS)) & XL_INTRS &&
-	    status != 0xFFFF) {
+	for (;;) {
+		status = CSR_READ_2(sc, XL_STATUS);
+		if ((status & XL_INTRS) == 0 || status == 0xFFFF)
+			break;
 		CSR_WRITE_2(sc, XL_COMMAND,
 		    XL_CMD_INTR_ACK|(status & XL_INTRS));
+		if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0)
+			break;
 
 		if (status & XL_STAT_UP_COMPLETE) {
 			int	curpkts;
@@ -2304,6 +2308,7 @@ xl_intr(void *arg)
 		if (status & XL_STAT_ADFAIL) {
 			ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
 			xl_init_locked(sc);
+			break;
 		}
 
 		if (status & XL_STAT_STATSOFLOW) {
@@ -2313,7 +2318,8 @@ xl_intr(void *arg)
 		}
 	}
 
-	if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) {
+	if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd) &&
+	    ifp->if_drv_flags & IFF_DRV_RUNNING) {
 		if (sc->xl_type == XL_TYPE_905B)
 			xl_start_90xB_locked(ifp);
 		else


More information about the svn-src-head mailing list