Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 6 May 2011 22:55:54 +0000 (UTC)
From:      Pyun YongHyeon <yongari@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r221563 - head/sys/dev/xl
Message-ID:  <201105062255.p46MtsCR070222@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201105062255.p46MtsCR070222>