Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 21 Sep 2010 17:42:19 +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: r212971 - head/sys/dev/sf
Message-ID:  <201009211742.o8LHgJCA001555@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: yongari
Date: Tue Sep 21 17:42:19 2010
New Revision: 212971
URL: http://svn.freebsd.org/changeset/base/212971

Log:
  Remove unnecessary controller reinitialization.
  StarFire controller does not require controller reinitialization to
  program perfect filters. While here, make driver immediately exit
  from interrupt/polling handler if driver reinitialized controller.
  
  PR:	kern/87506

Modified:
  head/sys/dev/sf/if_sf.c

Modified: head/sys/dev/sf/if_sf.c
==============================================================================
--- head/sys/dev/sf/if_sf.c	Tue Sep 21 17:37:28 2010	(r212970)
+++ head/sys/dev/sf/if_sf.c	Tue Sep 21 17:42:19 2010	(r212971)
@@ -1826,7 +1826,10 @@ sf_poll(struct ifnet *ifp, enum poll_cmd
 			else if ((status & SF_ISR_DMAERR) != 0) {
 				device_printf(sc->sf_dev,
 				    "DMA error, resetting\n");
+				ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
 				sf_init_locked(sc);
+				SF_UNLOCK(sc);
+				return (rx_npkts);
 			} else if ((status & SF_ISR_NO_TX_CSUM) != 0) {
 				sc->sf_statistics.sf_tx_gfp_stall++;
 #ifdef	SF_GFP_DEBUG
@@ -1894,8 +1897,10 @@ sf_intr(void *arg)
 			else if ((status & SF_ISR_DMAERR) != 0) {
 				device_printf(sc->sf_dev,
 				    "DMA error, resetting\n");
+				ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
 				sf_init_locked(sc);
-				break;
+				SF_UNLOCK(sc);
+				return;
 			} else if ((status & SF_ISR_NO_TX_CSUM) != 0) {
 				sc->sf_statistics.sf_tx_gfp_stall++;
 #ifdef	SF_GFP_DEBUG
@@ -1984,6 +1989,8 @@ sf_init_locked(struct sf_softc *sc)
 
 	SF_LOCK_ASSERT(sc);
 	ifp = sc->sf_ifp;
+	if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0)
+		return;
 	mii = device_get_softc(sc->sf_miibus);
 
 	sf_stop(sc);
@@ -2547,6 +2554,7 @@ sf_watchdog(struct sf_softc *sc)
 		if_printf(ifp, "watchdog timeout, %d Tx descs are active\n",
 		    sc->sf_cdata.sf_tx_cnt);
 
+	ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
 	sf_init_locked(sc);
 
 	if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))



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