Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 8 Oct 2010 19:34:23 +0000 (UTC)
From:      Pyun YongHyeon <yongari@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
Subject:   svn commit: r213606 - stable/7/sys/dev/stge
Message-ID:  <201010081934.o98JYNkO010828@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: yongari
Date: Fri Oct  8 19:34:23 2010
New Revision: 213606
URL: http://svn.freebsd.org/changeset/base/213606

Log:
  MFC r212972,21300:
  r212972:
    Remove unnecessary controller reinitialization.
  
    PR:	kern/87506
  
  r213000:
    Fix build breakage introduced in r212972.

Modified:
  stable/7/sys/dev/stge/if_stge.c
Directory Properties:
  stable/7/sys/   (props changed)
  stable/7/sys/cddl/contrib/opensolaris/   (props changed)
  stable/7/sys/contrib/dev/acpica/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)

Modified: stable/7/sys/dev/stge/if_stge.c
==============================================================================
--- stable/7/sys/dev/stge/if_stge.c	Fri Oct  8 19:32:39 2010	(r213605)
+++ stable/7/sys/dev/stge/if_stge.c	Fri Oct  8 19:34:23 2010	(r213606)
@@ -1386,6 +1386,7 @@ stge_watchdog(struct stge_softc *sc)
 	ifp = sc->sc_ifp;
 	if_printf(sc->sc_ifp, "device timeout\n");
 	ifp->if_oerrors++;
+	ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
 	stge_init_locked(sc);
 	if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
 		stge_start_locked(ifp);
@@ -1414,7 +1415,10 @@ stge_ioctl(struct ifnet *ifp, u_long cmd
 		else if (ifp->if_mtu != ifr->ifr_mtu) {
 			ifp->if_mtu = ifr->ifr_mtu;
 			STGE_LOCK(sc);
-			stge_init_locked(sc);
+			if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) {
+				ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
+				stge_init_locked(sc);
+			}
 			STGE_UNLOCK(sc);
 		}
 		break;
@@ -1648,8 +1652,10 @@ stge_intr(void *arg)
 	}
 
 force_init:
-	if (reinit != 0)
+	if (reinit != 0) {
+		ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
 		stge_init_locked(sc);
+	}
 
 	/* Re-enable interrupts. */
 	CSR_WRITE_2(sc, STGE_IntEnable, sc->sc_IntEnable);
@@ -1940,11 +1946,14 @@ stge_poll(struct ifnet *ifp, enum poll_c
 			if ((status & IS_HostError) != 0) {
 				device_printf(sc->sc_dev,
 				    "Host interface error, resetting...\n");
+				ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
 				stge_init_locked(sc);
 			}
 			if ((status & IS_TxComplete) != 0) {
-				if (stge_tx_error(sc) != 0)
+				if (stge_tx_error(sc) != 0) {
+					ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
 					stge_init_locked(sc);
+				}
 			}
 		}
 
@@ -2124,6 +2133,8 @@ stge_init_locked(struct stge_softc *sc)
 	STGE_LOCK_ASSERT(sc);
 
 	ifp = sc->sc_ifp;
+	if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0)
+		return;
 	mii = device_get_softc(sc->sc_miibus);
 
 	/*



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