Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 29 Nov 2009 18:51:58 +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-8@freebsd.org
Subject:   svn commit: r199908 - stable/8/sys/dev/jme
Message-ID:  <200911291851.nATIpw5U004485@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: yongari
Date: Sun Nov 29 18:51:58 2009
New Revision: 199908
URL: http://svn.freebsd.org/changeset/base/199908

Log:
  MFC r197585.
    Remove unnecessary device reinitialization.

Modified:
  stable/8/sys/dev/jme/if_jme.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)
  stable/8/sys/dev/xen/xenpci/   (props changed)

Modified: stable/8/sys/dev/jme/if_jme.c
==============================================================================
--- stable/8/sys/dev/jme/if_jme.c	Sun Nov 29 18:03:49 2009	(r199907)
+++ stable/8/sys/dev/jme/if_jme.c	Sun Nov 29 18:51:58 2009	(r199908)
@@ -306,6 +306,10 @@ jme_mediastatus(struct ifnet *ifp, struc
 
 	sc = ifp->if_softc;
 	JME_LOCK(sc);
+	if ((ifp->if_flags & IFF_UP) == 0) {
+		JME_UNLOCK(sc);
+		return;
+	}
 	mii = device_get_softc(sc->jme_miibus);
 
 	mii_pollstat(mii);
@@ -1585,8 +1589,10 @@ jme_resume(device_t dev)
 		    pmc + PCIR_POWER_STATUS, pmstat, 2);
 	}
 	ifp = sc->jme_ifp;
-	if ((ifp->if_flags & IFF_UP) != 0)
+	if ((ifp->if_flags & IFF_UP) != 0) {
+		ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
 		jme_init_locked(sc);
+	}
 
 	JME_UNLOCK(sc);
 
@@ -1861,6 +1867,7 @@ jme_watchdog(struct jme_softc *sc)
 	if ((sc->jme_flags & JME_FLAG_LINK) == 0) {
 		if_printf(sc->jme_ifp, "watchdog timeout (missed link)\n");
 		ifp->if_oerrors++;
+		ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
 		jme_init_locked(sc);
 		return;
 	}
@@ -1875,6 +1882,7 @@ jme_watchdog(struct jme_softc *sc)
 
 	if_printf(sc->jme_ifp, "watchdog timeout\n");
 	ifp->if_oerrors++;
+	ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
 	jme_init_locked(sc);
 	if (!IFQ_DRV_IS_EMPTY(&ifp->if_snd))
 		taskqueue_enqueue(sc->jme_tq, &sc->jme_tx_task);
@@ -1917,8 +1925,10 @@ jme_ioctl(struct ifnet *ifp, u_long cmd,
 				VLAN_CAPABILITIES(ifp);
 			}
 			ifp->if_mtu = ifr->ifr_mtu;
-			if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0)
+			if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) {
+				ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
 				jme_init_locked(sc);
+			}
 			JME_UNLOCK(sc);
 		}
 		break;
@@ -2642,6 +2652,8 @@ jme_init_locked(struct jme_softc *sc)
 	ifp = sc->jme_ifp;
 	mii = device_get_softc(sc->jme_miibus);
 
+	if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0)
+		return;
 	/*
 	 * Cancel any pending I/O.
 	 */



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