svn commit: r222384 - stable/8/sys/dev/xl

Pyun YongHyeon yongari at FreeBSD.org
Fri May 27 20:33:27 UTC 2011


Author: yongari
Date: Fri May 27 20:33:26 2011
New Revision: 222384
URL: http://svn.freebsd.org/changeset/base/222384

Log:
  MFC r221563-221564:
  r221563:
    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.
  
  r221564:
    Change xl_rxeof() a bit to return the number of processed frames in
    RX descriptor ring. Previously it returned the number of frames
    that were successfully passed to upper stack which in turn means it
    ignored frames that were discarded due to errors. The number of
    processed frames in RX descriptor ring is used to detect whether
    driver is out of sync with controller's current descriptor pointer.
    Returning number of processed frames reduces unnecessary (probably
    wrong) re-synchronization.
  
    While here, remove unnecessary local variable initialization.

Modified:
  stable/8/sys/dev/xl/if_xl.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)

Modified: stable/8/sys/dev/xl/if_xl.c
==============================================================================
--- stable/8/sys/dev/xl/if_xl.c	Fri May 27 20:22:19 2011	(r222383)
+++ stable/8/sys/dev/xl/if_xl.c	Fri May 27 20:33:26 2011	(r222384)
@@ -1944,7 +1944,7 @@ xl_rxeof(struct xl_softc *sc)
 	struct mbuf		*m;
 	struct ifnet		*ifp = sc->xl_ifp;
 	struct xl_chain_onefrag	*cur_rx;
-	int			total_len = 0;
+	int			total_len;
 	int			rx_npkts = 0;
 	u_int32_t		rxstat;
 
@@ -1963,6 +1963,7 @@ again:
 		cur_rx = sc->xl_cdata.xl_rx_head;
 		sc->xl_cdata.xl_rx_head = cur_rx->xl_next;
 		total_len = rxstat & XL_RXSTAT_LENMASK;
+		rx_npkts++;
 
 		/*
 		 * Since we have told the chip to allow large frames,
@@ -2047,7 +2048,6 @@ again:
 		XL_UNLOCK(sc);
 		(*ifp->if_input)(ifp, m);
 		XL_LOCK(sc);
-		rx_npkts++;
 
 		/*
 		 * If we are running from the taskqueue, the interface
@@ -2273,17 +2273,17 @@ 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;
-
-			curpkts = ifp->if_ipackets;
-			xl_rxeof(sc);
-			if (curpkts == ifp->if_ipackets) {
+			if (xl_rxeof(sc) == 0) {
 				while (xl_rx_resync(sc))
 					xl_rxeof(sc);
 			}
@@ -2304,6 +2304,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 +2314,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-all mailing list