svn commit: r200904 - head/sys/dev/ste

Pyun YongHyeon yongari at FreeBSD.org
Wed Dec 23 17:46:12 UTC 2009


Author: yongari
Date: Wed Dec 23 17:46:11 2009
New Revision: 200904
URL: http://svn.freebsd.org/changeset/base/200904

Log:
  Don't reinitialize controller if driver is already running. This
  reduces number of link state UP/DOWN changes.

Modified:
  head/sys/dev/ste/if_ste.c

Modified: head/sys/dev/ste/if_ste.c
==============================================================================
--- head/sys/dev/ste/if_ste.c	Wed Dec 23 16:30:39 2009	(r200903)
+++ head/sys/dev/ste/if_ste.c	Wed Dec 23 17:46:11 2009	(r200904)
@@ -643,8 +643,10 @@ ste_poll_locked(struct ifnet *ifp, enum 
 		if (status & STE_ISR_STATS_OFLOW)
 			ste_stats_update(sc);
 
-		if (status & STE_ISR_HOSTERR)
+		if (status & STE_ISR_HOSTERR) {
+			ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
 			ste_init_locked(sc);
+		}
 	}
 	return (rx_npkts);
 }
@@ -692,8 +694,10 @@ ste_intr(void *xsc)
 		if (status & STE_ISR_STATS_OFLOW)
 			ste_stats_update(sc);
 
-		if (status & STE_ISR_HOSTERR)
+		if (status & STE_ISR_HOSTERR) {
 			ste_init_locked(sc);
+			ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
+		}
 	}
 
 	/* Re-enable interrupts */
@@ -832,6 +836,7 @@ ste_txeoc(struct ste_softc *sc)
 				STE_SETBIT4(sc, STE_DMACTL,
 				    STE_DMACTL_TXDMA_STALL);
 				ste_wait(sc);
+				ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
 				ste_init_locked(sc);
 				break;
 			}
@@ -1548,6 +1553,9 @@ ste_init_locked(struct ste_softc *sc)
 	STE_LOCK_ASSERT(sc);
 	ifp = sc->ste_ifp;
 
+	if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0)
+		return;
+
 	ste_stop(sc);
 	/* Reset the chip to a known state. */
 	ste_reset(sc);
@@ -2005,6 +2013,7 @@ ste_watchdog(struct ste_softc *sc)
 	ste_txeof(sc);
 	ste_txeoc(sc);
 	ste_rxeof(sc, -1);
+	ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
 	ste_init_locked(sc);
 
 	if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))


More information about the svn-src-head mailing list