Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 26 Oct 2013 18:40:17 +0000 (UTC)
From:      Gleb Smirnoff <glebius@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r257184 - in head/sys/dev: mii usb/net xl
Message-ID:  <201310261840.r9QIeH89083767@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: glebius
Date: Sat Oct 26 18:40:17 2013
New Revision: 257184
URL: http://svnweb.freebsd.org/changeset/base/257184

Log:
  The MII layer shouldn't care about administrative status of an
  interface. Make MII drivers forget about 'struct ifnet'.
  
  Later plan is to provide an administrative downcall from ifnet
  layer into drivers, to inform them about administrative status
  change. If someone thinks that processing MII events for an
  administratively down interface is a big problem, then drivers
  would turn MII processing off.
  
  The following MII drivers do evil things, like strcmp() on
  driver name, so they still need knowledge of ifnet and thus
  include if_var.h. They all need to be fixed:
  
  sys/dev/mii/brgphy.c
  sys/dev/mii/e1000phy.c
  sys/dev/mii/ip1000phy.c
  sys/dev/mii/jmphy.c
  sys/dev/mii/nsphy.c
  sys/dev/mii/rgephy.c
  sys/dev/mii/truephy.c
  
  Sponsored by:	Netflix
  Sponsored by:	Nginx, Inc.

Modified:
  head/sys/dev/mii/acphy.c
  head/sys/dev/mii/amphy.c
  head/sys/dev/mii/atphy.c
  head/sys/dev/mii/axphy.c
  head/sys/dev/mii/bmtphy.c
  head/sys/dev/mii/brgphy.c
  head/sys/dev/mii/ciphy.c
  head/sys/dev/mii/e1000phy.c
  head/sys/dev/mii/gentbi.c
  head/sys/dev/mii/icsphy.c
  head/sys/dev/mii/ip1000phy.c
  head/sys/dev/mii/jmphy.c
  head/sys/dev/mii/lxtphy.c
  head/sys/dev/mii/mii_physubr.c
  head/sys/dev/mii/mlphy.c
  head/sys/dev/mii/nsgphy.c
  head/sys/dev/mii/nsphy.c
  head/sys/dev/mii/nsphyter.c
  head/sys/dev/mii/pnaphy.c
  head/sys/dev/mii/qsphy.c
  head/sys/dev/mii/rdcphy.c
  head/sys/dev/mii/rgephy.c
  head/sys/dev/mii/rlphy.c
  head/sys/dev/mii/rlswitch.c
  head/sys/dev/mii/smcphy.c
  head/sys/dev/mii/smscphy.c
  head/sys/dev/mii/tdkphy.c
  head/sys/dev/mii/tlphy.c
  head/sys/dev/mii/truephy.c
  head/sys/dev/mii/ukphy.c
  head/sys/dev/mii/xmphy.c
  head/sys/dev/usb/net/ruephy.c
  head/sys/dev/xl/xlphy.c

Modified: head/sys/dev/mii/acphy.c
==============================================================================
--- head/sys/dev/mii/acphy.c	Sat Oct 26 18:25:55 2013	(r257183)
+++ head/sys/dev/mii/acphy.c	Sat Oct 26 18:40:17 2013	(r257184)
@@ -168,12 +168,6 @@ acphy_service(struct mii_softc *sc, stru
 		break;
 
 	case MII_MEDIACHG:
-		/*
-		 * If the interface is not up, don't do anything.
-		 */
-		if ((mii->mii_ifp->if_flags & IFF_UP) == 0)
-			break;
-
 		/* Wake & deisolate up if necessary */
 		reg = PHY_READ(sc, MII_BMCR);
 		if (reg & (BMCR_ISO | BMCR_PDOWN))
@@ -184,12 +178,6 @@ acphy_service(struct mii_softc *sc, stru
 
 	case MII_TICK:
 		/*
-		 * Is the interface even up?
-		 */
-		if ((mii->mii_ifp->if_flags & IFF_UP) == 0)
-			return (0);
-
-		/*
 		 * This PHY's autonegotiation doesn't need to be kicked.
 		 */
 		break;

Modified: head/sys/dev/mii/amphy.c
==============================================================================
--- head/sys/dev/mii/amphy.c	Sat Oct 26 18:25:55 2013	(r257183)
+++ head/sys/dev/mii/amphy.c	Sat Oct 26 18:40:17 2013	(r257184)
@@ -119,12 +119,6 @@ amphy_service(struct mii_softc *sc, stru
 		break;
 
 	case MII_MEDIACHG:
-		/*
-		 * If the interface is not up, don't do anything.
-		 */
-		if ((mii->mii_ifp->if_flags & IFF_UP) == 0)
-			break;
-
 		mii_phy_setmedia(sc);
 		break;
 

Modified: head/sys/dev/mii/atphy.c
==============================================================================
--- head/sys/dev/mii/atphy.c	Sat Oct 26 18:25:55 2013	(r257183)
+++ head/sys/dev/mii/atphy.c	Sat Oct 26 18:40:17 2013	(r257184)
@@ -116,12 +116,6 @@ atphy_service(struct mii_softc *sc, stru
 		break;
 
 	case MII_MEDIACHG:
-		/*
-		 * If the interface is not up, don't do anything.
-		 */
-		if ((mii->mii_ifp->if_flags & IFF_UP) == 0)
-			break;
-
 		if (IFM_SUBTYPE(ife->ifm_media) == IFM_AUTO ||
 		    IFM_SUBTYPE(ife->ifm_media) == IFM_1000_T) {
 			atphy_setmedia(sc, ife->ifm_media);
@@ -175,12 +169,6 @@ done:
 
 	case MII_TICK:
 		/*
-		 * Is the interface even up?
-		 */
-		if ((mii->mii_ifp->if_flags & IFF_UP) == 0)
-			return (0);
-
-		/*
 		 * Only used for autonegotiation.
 		 */
 		if (IFM_SUBTYPE(ife->ifm_media) != IFM_AUTO) {

Modified: head/sys/dev/mii/axphy.c
==============================================================================
--- head/sys/dev/mii/axphy.c	Sat Oct 26 18:25:55 2013	(r257183)
+++ head/sys/dev/mii/axphy.c	Sat Oct 26 18:40:17 2013	(r257184)
@@ -113,12 +113,6 @@ axphy_service(struct mii_softc *sc, stru
 		break;
 
 	case MII_MEDIACHG:
-		/*
-		 * If the interface is not up, don't do anything.
-		 */
-		if ((mii->mii_ifp->if_flags & IFF_UP) == 0)
-			break;
-
 		mii_phy_setmedia(sc);
 		break;
 

Modified: head/sys/dev/mii/bmtphy.c
==============================================================================
--- head/sys/dev/mii/bmtphy.c	Sat Oct 26 18:25:55 2013	(r257183)
+++ head/sys/dev/mii/bmtphy.c	Sat Oct 26 18:40:17 2013	(r257184)
@@ -159,12 +159,6 @@ bmtphy_service(struct mii_softc *sc, str
 		break;
 
 	case MII_MEDIACHG:
-		/*
-		 * If the interface is not up, don't do anything.
-		 */
-		if ((mii->mii_ifp->if_flags & IFF_UP) == 0)
-			break;
-
 		mii_phy_setmedia(sc);
 		break;
 

Modified: head/sys/dev/mii/brgphy.c
==============================================================================
--- head/sys/dev/mii/brgphy.c	Sat Oct 26 18:25:55 2013	(r257183)
+++ head/sys/dev/mii/brgphy.c	Sat Oct 26 18:40:17 2013	(r257184)
@@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/bus.h>
 
 #include <net/if.h>
+#include <net/if_var.h>
 #include <net/ethernet.h>
 #include <net/if_media.h>
 
@@ -314,10 +315,6 @@ brgphy_service(struct mii_softc *sc, str
 	case MII_POLLSTAT:
 		break;
 	case MII_MEDIACHG:
-		/* If the interface is not up, don't do anything. */
-		if ((mii->mii_ifp->if_flags & IFF_UP) == 0)
-			break;
-
 		/* Todo: Why is this here?  Is it really needed? */
 		PHY_RESET(sc);	/* XXX hardware bug work-around */
 
@@ -337,11 +334,6 @@ brgphy_service(struct mii_softc *sc, str
 		}
 		break;
 	case MII_TICK:
-		/* Bail if the interface isn't up. */
-		if ((mii->mii_ifp->if_flags & IFF_UP) == 0)
-			return (0);
-
-
 		/* Bail if autoneg isn't in process. */
 		if (IFM_SUBTYPE(ife->ifm_media) != IFM_AUTO) {
 			sc->mii_ticks = 0;

Modified: head/sys/dev/mii/ciphy.c
==============================================================================
--- head/sys/dev/mii/ciphy.c	Sat Oct 26 18:25:55 2013	(r257183)
+++ head/sys/dev/mii/ciphy.c	Sat Oct 26 18:40:17 2013	(r257184)
@@ -131,12 +131,6 @@ ciphy_service(struct mii_softc *sc, stru
 		break;
 
 	case MII_MEDIACHG:
-		/*
-		 * If the interface is not up, don't do anything.
-		 */
-		if ((mii->mii_ifp->if_flags & IFF_UP) == 0)
-			break;
-
 		ciphy_fixup(sc);	/* XXX hardware bug work-around */
 
 		switch (IFM_SUBTYPE(ife->ifm_media)) {
@@ -187,12 +181,6 @@ setit:
 
 	case MII_TICK:
 		/*
-		 * Is the interface even up?
-		 */
-		if ((mii->mii_ifp->if_flags & IFF_UP) == 0)
-			return (0);
-
-		/*
 		 * Only used for autonegotiation.
 		 */
 		if (IFM_SUBTYPE(ife->ifm_media) != IFM_AUTO)

Modified: head/sys/dev/mii/e1000phy.c
==============================================================================
--- head/sys/dev/mii/e1000phy.c	Sat Oct 26 18:25:55 2013	(r257183)
+++ head/sys/dev/mii/e1000phy.c	Sat Oct 26 18:40:17 2013	(r257184)
@@ -50,8 +50,8 @@ __FBSDID("$FreeBSD$");
 #include <sys/socket.h>
 #include <sys/bus.h>
 
-
 #include <net/if.h>
+#include <net/if_var.h>
 #include <net/if_media.h>
 
 #include <dev/mii/mii.h>
@@ -311,12 +311,6 @@ e1000phy_service(struct mii_softc *sc, s
 		break;
 
 	case MII_MEDIACHG:
-		/*
-		 * If the interface is not up, don't do anything.
-		 */
-		if ((mii->mii_ifp->if_flags & IFF_UP) == 0)
-			break;
-
 		if (IFM_SUBTYPE(ife->ifm_media) == IFM_AUTO) {
 			e1000phy_mii_phy_auto(sc, ife->ifm_media);
 			break;
@@ -375,12 +369,6 @@ done:
 		break;
 	case MII_TICK:
 		/*
-		 * Is the interface even up?
-		 */
-		if ((mii->mii_ifp->if_flags & IFF_UP) == 0)
-			return (0);
-
-		/*
 		 * Only used for autonegotiation.
 		 */
 		if (IFM_SUBTYPE(ife->ifm_media) != IFM_AUTO) {

Modified: head/sys/dev/mii/gentbi.c
==============================================================================
--- head/sys/dev/mii/gentbi.c	Sat Oct 26 18:25:55 2013	(r257183)
+++ head/sys/dev/mii/gentbi.c	Sat Oct 26 18:40:17 2013	(r257184)
@@ -191,12 +191,6 @@ gentbi_service(struct mii_softc *sc, str
 		break;
 
 	case MII_MEDIACHG:
-		/*
-		 * If the interface is not up, don't do anything.
-		 */
-		if ((mii->mii_ifp->if_flags & IFF_UP) == 0)
-			break;
-
 		mii_phy_setmedia(sc);
 		break;
 

Modified: head/sys/dev/mii/icsphy.c
==============================================================================
--- head/sys/dev/mii/icsphy.c	Sat Oct 26 18:25:55 2013	(r257183)
+++ head/sys/dev/mii/icsphy.c	Sat Oct 26 18:40:17 2013	(r257184)
@@ -145,12 +145,6 @@ icsphy_service(struct mii_softc *sc, str
 		break;
 
 	case MII_MEDIACHG:
-		/*
-		 * If the interface is not up, don't do anything.
-		 */
-		if ((mii->mii_ifp->if_flags & IFF_UP) == 0)
-			break;
-
 		mii_phy_setmedia(sc);
 		break;
 

Modified: head/sys/dev/mii/ip1000phy.c
==============================================================================
--- head/sys/dev/mii/ip1000phy.c	Sat Oct 26 18:25:55 2013	(r257183)
+++ head/sys/dev/mii/ip1000phy.c	Sat Oct 26 18:40:17 2013	(r257184)
@@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/bus.h>
 
 #include <net/if.h>
+#include <net/if_var.h>
 #include <net/if_media.h>
 
 #include <dev/mii/mii.h>
@@ -126,13 +127,6 @@ ip1000phy_service(struct mii_softc *sc, 
 		break;
 
 	case MII_MEDIACHG:
-		/*
-		 * If the interface is not up, don't do anything.
-		 */
-		if ((mii->mii_ifp->if_flags & IFF_UP) == 0) {
-			break;
-		}
-
 		PHY_RESET(sc);
 		switch (IFM_SUBTYPE(ife->ifm_media)) {
 		case IFM_AUTO:
@@ -180,12 +174,6 @@ done:
 
 	case MII_TICK:
 		/*
-		 * Is the interface even up?
-		 */
-		if ((mii->mii_ifp->if_flags & IFF_UP) == 0)
-			return (0);
-
-		/*
 		 * Only used for autonegotiation.
 		 */
 		if (IFM_SUBTYPE(ife->ifm_media) != IFM_AUTO) {

Modified: head/sys/dev/mii/jmphy.c
==============================================================================
--- head/sys/dev/mii/jmphy.c	Sat Oct 26 18:25:55 2013	(r257183)
+++ head/sys/dev/mii/jmphy.c	Sat Oct 26 18:40:17 2013	(r257184)
@@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/bus.h>
 
 #include <net/if.h>
+#include <net/if_var.h>
 #include <net/if_media.h>
 
 #include <dev/mii/mii.h>
@@ -121,24 +122,12 @@ jmphy_service(struct mii_softc *sc, stru
 		break;
 
 	case MII_MEDIACHG:
-		/*
-		 * If the interface is not up, don't do anything.
-		 */
-		if ((mii->mii_ifp->if_flags & IFF_UP) == 0)
-			break;
-
 		if (jmphy_setmedia(sc, ife) != EJUSTRETURN)
 			return (EINVAL);
 		break;
 
 	case MII_TICK:
 		/*
-		 * Is the interface even up?
-		 */
-		if ((mii->mii_ifp->if_flags & IFF_UP) == 0)
-			return (0);
-
-		/*
 		 * Only used for autonegotiation.
 		 */
 		if (IFM_SUBTYPE(ife->ifm_media) != IFM_AUTO) {

Modified: head/sys/dev/mii/lxtphy.c
==============================================================================
--- head/sys/dev/mii/lxtphy.c	Sat Oct 26 18:25:55 2013	(r257183)
+++ head/sys/dev/mii/lxtphy.c	Sat Oct 26 18:40:17 2013	(r257184)
@@ -168,12 +168,6 @@ lxtphy_service(struct mii_softc *sc, str
 		break;
 
 	case MII_MEDIACHG:
-		/*
-		 * If the interface is not up, don't do anything.
-		 */
-		if ((mii->mii_ifp->if_flags & IFF_UP) == 0)
-			break;
-
 		if (IFM_SUBTYPE(ife->ifm_media) == IFM_100_FX)
 			lxtphy_set_fx(sc);
 		else

Modified: head/sys/dev/mii/mii_physubr.c
==============================================================================
--- head/sys/dev/mii/mii_physubr.c	Sat Oct 26 18:25:55 2013	(r257183)
+++ head/sys/dev/mii/mii_physubr.c	Sat Oct 26 18:40:17 2013	(r257184)
@@ -209,13 +209,8 @@ int
 mii_phy_tick(struct mii_softc *sc)
 {
 	struct ifmedia_entry *ife = sc->mii_pdata->mii_media.ifm_cur;
-	struct ifnet *ifp = sc->mii_pdata->mii_ifp;
 	int reg;
 
-	/* Just bail now if the interface is down. */
-	if ((ifp->if_flags & IFF_UP) == 0)
-		return (EJUSTRETURN);
-
 	/*
 	 * If we're not doing autonegotiation, we don't need to do
 	 * any extra work here.  However, we need to check the link

Modified: head/sys/dev/mii/mlphy.c
==============================================================================
--- head/sys/dev/mii/mlphy.c	Sat Oct 26 18:25:55 2013	(r257183)
+++ head/sys/dev/mii/mlphy.c	Sat Oct 26 18:40:17 2013	(r257184)
@@ -205,12 +205,6 @@ mlphy_service(xsc, mii, cmd)
 		break;
 
 	case MII_MEDIACHG:
-		/*
-		 * If the interface is not up, don't do anything.
-		 */
-		if ((mii->mii_ifp->if_flags & IFF_UP) == 0)
-			break;
-
 		switch (IFM_SUBTYPE(ife->ifm_media)) {
 		case IFM_AUTO:
 			/*
@@ -266,12 +260,6 @@ mlphy_service(xsc, mii, cmd)
 
 	case MII_TICK:
 		/*
-		 * Is the interface even up?
-		 */
-		if ((mii->mii_ifp->if_flags & IFF_UP) == 0)
-			return (0);
-
-		/*
 		 * Only used for autonegotiation.
 		 */
 		if (IFM_SUBTYPE(ife->ifm_media) != IFM_AUTO)

Modified: head/sys/dev/mii/nsgphy.c
==============================================================================
--- head/sys/dev/mii/nsgphy.c	Sat Oct 26 18:25:55 2013	(r257183)
+++ head/sys/dev/mii/nsgphy.c	Sat Oct 26 18:40:17 2013	(r257184)
@@ -159,12 +159,6 @@ nsgphy_service(struct mii_softc *sc, str
 		break;
 
 	case MII_MEDIACHG:
-		/*
-		 * If the interface is not up, don't do anything.
-		 */
-		if ((mii->mii_ifp->if_flags & IFF_UP) == 0)
-			break;
-
 		mii_phy_setmedia(sc);
 		break;
 

Modified: head/sys/dev/mii/nsphy.c
==============================================================================
--- head/sys/dev/mii/nsphy.c	Sat Oct 26 18:25:55 2013	(r257183)
+++ head/sys/dev/mii/nsphy.c	Sat Oct 26 18:40:17 2013	(r257184)
@@ -71,6 +71,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/bus.h>
 
 #include <net/if.h>
+#include <net/if_var.h>
 #include <net/if_media.h>
 
 #include <dev/mii/mii.h>
@@ -152,12 +153,6 @@ nsphy_service(struct mii_softc *sc, stru
 		break;
 
 	case MII_MEDIACHG:
-		/*
-		 * If the interface is not up, don't do anything.
-		 */
-		if ((mii->mii_ifp->if_flags & IFF_UP) == 0)
-			break;
-
 		reg = PHY_READ(sc, MII_NSPHY_PCR);
 
 		/*

Modified: head/sys/dev/mii/nsphyter.c
==============================================================================
--- head/sys/dev/mii/nsphyter.c	Sat Oct 26 18:25:55 2013	(r257183)
+++ head/sys/dev/mii/nsphyter.c	Sat Oct 26 18:40:17 2013	(r257184)
@@ -149,12 +149,6 @@ nsphyter_service(struct mii_softc *sc, s
 		break;
 
 	case MII_MEDIACHG:
-		/*
-		 * If the interface is not up, don't do anything.
-		 */
-		if ((mii->mii_ifp->if_flags & IFF_UP) == 0)
-			break;
-
 		mii_phy_setmedia(sc);
 		break;
 

Modified: head/sys/dev/mii/pnaphy.c
==============================================================================
--- head/sys/dev/mii/pnaphy.c	Sat Oct 26 18:25:55 2013	(r257183)
+++ head/sys/dev/mii/pnaphy.c	Sat Oct 26 18:40:17 2013	(r257184)
@@ -121,12 +121,6 @@ pnaphy_service(struct mii_softc *sc, str
 		break;
 
 	case MII_MEDIACHG:
-		/*
-		 * If the interface is not up, don't do anything.
-		 */
-		if ((mii->mii_ifp->if_flags & IFF_UP) == 0)
-			break;
-
 		switch (IFM_SUBTYPE(ife->ifm_media)) {
 		case IFM_HPNA_1:
 			mii_phy_setmedia(sc);

Modified: head/sys/dev/mii/qsphy.c
==============================================================================
--- head/sys/dev/mii/qsphy.c	Sat Oct 26 18:25:55 2013	(r257183)
+++ head/sys/dev/mii/qsphy.c	Sat Oct 26 18:40:17 2013	(r257184)
@@ -143,23 +143,11 @@ qsphy_service(struct mii_softc *sc, stru
 		break;
 
 	case MII_MEDIACHG:
-		/*
-		 * If the interface is not up, don't do anything.
-		 */
-		if ((mii->mii_ifp->if_flags & IFF_UP) == 0)
-			break;
-
 		mii_phy_setmedia(sc);
 		break;
 
 	case MII_TICK:
 		/*
-		 * Is the interface even up?
-		 */
-		if ((mii->mii_ifp->if_flags & IFF_UP) == 0)
-			return (0);
-
-		/*
 		 * This PHY's autonegotiation doesn't need to be kicked.
 		 */
 		break;

Modified: head/sys/dev/mii/rdcphy.c
==============================================================================
--- head/sys/dev/mii/rdcphy.c	Sat Oct 26 18:25:55 2013	(r257183)
+++ head/sys/dev/mii/rdcphy.c	Sat Oct 26 18:40:17 2013	(r257184)
@@ -121,12 +121,6 @@ rdcphy_service(struct mii_softc *sc, str
 		break;
 
 	case MII_MEDIACHG:
-		/*
-		 * If the interface is not up, don't do anything.
-		 */
-		if ((mii->mii_ifp->if_flags & IFF_UP) == 0)
-			break;
-
 		mii_phy_setmedia(sc);
 		switch (IFM_SUBTYPE(ife->ifm_media)) {
 		case IFM_100_TX:

Modified: head/sys/dev/mii/rgephy.c
==============================================================================
--- head/sys/dev/mii/rgephy.c	Sat Oct 26 18:25:55 2013	(r257183)
+++ head/sys/dev/mii/rgephy.c	Sat Oct 26 18:40:17 2013	(r257184)
@@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/bus.h>
 
 #include <net/if.h>
+#include <net/if_var.h>
 #include <net/if_arp.h>
 #include <net/if_media.h>
 
@@ -153,12 +154,6 @@ rgephy_service(struct mii_softc *sc, str
 		break;
 
 	case MII_MEDIACHG:
-		/*
-		 * If the interface is not up, don't do anything.
-		 */
-		if ((mii->mii_ifp->if_flags & IFF_UP) == 0)
-			break;
-
 		PHY_RESET(sc);	/* XXX hardware bug work-around */
 
 		anar = PHY_READ(sc, RGEPHY_MII_ANAR);
@@ -231,12 +226,6 @@ setit:
 
 	case MII_TICK:
 		/*
-		 * Is the interface even up?
-		 */
-		if ((mii->mii_ifp->if_flags & IFF_UP) == 0)
-			return (0);
-
-		/*
 		 * Only used for autonegotiation.
 		 */
 		if (IFM_SUBTYPE(ife->ifm_media) != IFM_AUTO) {

Modified: head/sys/dev/mii/rlphy.c
==============================================================================
--- head/sys/dev/mii/rlphy.c	Sat Oct 26 18:25:55 2013	(r257183)
+++ head/sys/dev/mii/rlphy.c	Sat Oct 26 18:40:17 2013	(r257184)
@@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/module.h>
 #include <sys/socket.h>
 #include <sys/bus.h>
+#include <sys/taskqueue.h>	/* XXXGL: if_rlreg.h contamination */
 
 #include <net/if.h>
 #include <net/if_arp.h>
@@ -141,23 +142,11 @@ rlphy_service(struct mii_softc *sc, stru
 		break;
 
 	case MII_MEDIACHG:
-		/*
-		 * If the interface is not up, don't do anything.
-		 */
-		if ((mii->mii_ifp->if_flags & IFF_UP) == 0)
-			break;
-
 		mii_phy_setmedia(sc);
 		break;
 
 	case MII_TICK:
 		/*
-		 * Is the interface even up?
-		 */
-		if ((mii->mii_ifp->if_flags & IFF_UP) == 0)
-			return (0);
-
-		/*
 		 * The RealTek PHY's autonegotiation doesn't need to be
 		 * kicked; it continues in the background.
 		 */

Modified: head/sys/dev/mii/rlswitch.c
==============================================================================
--- head/sys/dev/mii/rlswitch.c	Sat Oct 26 18:25:55 2013	(r257183)
+++ head/sys/dev/mii/rlswitch.c	Sat Oct 26 18:40:17 2013	(r257184)
@@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/module.h>
 #include <sys/socket.h>
 #include <sys/bus.h>
+#include <sys/taskqueue.h>	/* XXXGL: if_rlreg.h contamination */
 
 #include <net/if.h>
 #include <net/if_arp.h>
@@ -353,11 +354,6 @@ rlswitch_service(struct mii_softc *sc, s
 		break;
 
 	case MII_TICK:
-		/*
-		 * Is the interface even up?
-		 */
-		if ((mii->mii_ifp->if_flags & IFF_UP) == 0)
-			return (0);
 		break;
 	}
 

Modified: head/sys/dev/mii/smcphy.c
==============================================================================
--- head/sys/dev/mii/smcphy.c	Sat Oct 26 18:25:55 2013	(r257183)
+++ head/sys/dev/mii/smcphy.c	Sat Oct 26 18:40:17 2013	(r257184)
@@ -134,12 +134,6 @@ smcphy_service(struct mii_softc *sc, str
                 break;
 
         case MII_MEDIACHG:
-                /*
-                 * If the interface is not up, don't do anything.
-                 */
-                if ((mii->mii_ifp->if_flags & IFF_UP) == 0)
-                        break;
-
 		switch (IFM_SUBTYPE(ife->ifm_media)) {
 		case IFM_AUTO:
 			smcphy_auto(sc, ife->ifm_media);
@@ -153,10 +147,6 @@ smcphy_service(struct mii_softc *sc, str
                 break;
 
         case MII_TICK:
-		if ((mii->mii_ifp->if_flags & IFF_UP) == 0) {
-			return (0);
-		}
-
 		if (IFM_SUBTYPE(ife->ifm_media) != IFM_AUTO) {
 			break;
 		}

Modified: head/sys/dev/mii/smscphy.c
==============================================================================
--- head/sys/dev/mii/smscphy.c	Sat Oct 26 18:25:55 2013	(r257183)
+++ head/sys/dev/mii/smscphy.c	Sat Oct 26 18:40:17 2013	(r257184)
@@ -120,12 +120,6 @@ smscphy_service(struct mii_softc *sc, st
                 break;
 
         case MII_MEDIACHG:
-                /*
-                 * If the interface is not up, don't do anything.
-                 */
-                if ((mii->mii_ifp->if_flags & IFF_UP) == 0)
-                        break;
-
 		switch (IFM_SUBTYPE(ife->ifm_media)) {
 		case IFM_AUTO:
 			smscphy_auto(sc, ife->ifm_media);
@@ -139,10 +133,6 @@ smscphy_service(struct mii_softc *sc, st
                 break;
 
         case MII_TICK:
-		if ((mii->mii_ifp->if_flags & IFF_UP) == 0) {
-			return (0);
-		}
-
 		if (IFM_SUBTYPE(ife->ifm_media) != IFM_AUTO) {
 			break;
 		}

Modified: head/sys/dev/mii/tdkphy.c
==============================================================================
--- head/sys/dev/mii/tdkphy.c	Sat Oct 26 18:25:55 2013	(r257183)
+++ head/sys/dev/mii/tdkphy.c	Sat Oct 26 18:40:17 2013	(r257184)
@@ -122,12 +122,6 @@ tdkphy_service(struct mii_softc *sc, str
 		break;
 
 	case MII_MEDIACHG:
-		/*
-		 * If the interface is not up, don't do anything.
-		 */
-		if ((mii->mii_ifp->if_flags & IFF_UP) == 0)
-			break;
-
 		mii_phy_setmedia(sc);
 		break;
 

Modified: head/sys/dev/mii/tlphy.c
==============================================================================
--- head/sys/dev/mii/tlphy.c	Sat Oct 26 18:25:55 2013	(r257183)
+++ head/sys/dev/mii/tlphy.c	Sat Oct 26 18:40:17 2013	(r257184)
@@ -217,12 +217,6 @@ tlphy_service(struct mii_softc *self, st
 		break;
 
 	case MII_MEDIACHG:
-		/*
-		 * If the interface is not up, don't do anything.
-		 */
-		if ((mii->mii_ifp->if_flags & IFF_UP) == 0)
-			break;
-
 		switch (IFM_SUBTYPE(ife->ifm_media)) {
 		case IFM_AUTO:
 			/*
@@ -247,12 +241,6 @@ tlphy_service(struct mii_softc *self, st
 
 	case MII_TICK:
 		/*
-		 * Is the interface even up?
-		 */
-		if ((mii->mii_ifp->if_flags & IFF_UP) == 0)
-			return (0);
-
-		/*
 		 * Only used for autonegotiation.
 		 */
 		if (IFM_SUBTYPE(ife->ifm_media) != IFM_AUTO)

Modified: head/sys/dev/mii/truephy.c
==============================================================================
--- head/sys/dev/mii/truephy.c	Sat Oct 26 18:25:55 2013	(r257183)
+++ head/sys/dev/mii/truephy.c	Sat Oct 26 18:40:17 2013	(r257184)
@@ -44,6 +44,7 @@
 #include <sys/bus.h>
 
 #include <net/if.h>
+#include <net/if_var.h>
 #include <net/if_media.h>
 #include <net/if_arp.h>
 #include <net/ethernet.h>
@@ -180,12 +181,6 @@ truephy_service(struct mii_softc *sc, st
 		break;
 
 	case MII_MEDIACHG:
-		/*
-		 * If the interface is not up, don't do anything.
-		 */
-		if ((mii->mii_ifp->if_flags & IFF_UP) == 0)
-			break;
-
 		if (IFM_SUBTYPE(ife->ifm_media) != IFM_AUTO) {
 			bmcr = PHY_READ(sc, MII_BMCR) & ~BMCR_AUTOEN;
 			PHY_WRITE(sc, MII_BMCR, bmcr);

Modified: head/sys/dev/mii/ukphy.c
==============================================================================
--- head/sys/dev/mii/ukphy.c	Sat Oct 26 18:25:55 2013	(r257183)
+++ head/sys/dev/mii/ukphy.c	Sat Oct 26 18:40:17 2013	(r257184)
@@ -140,12 +140,6 @@ ukphy_service(struct mii_softc *sc, stru
 		break;
 
 	case MII_MEDIACHG:
-		/*
-		 * If the interface is not up, don't do anything.
-		 */
-		if ((mii->mii_ifp->if_flags & IFF_UP) == 0)
-			break;
-
 		mii_phy_setmedia(sc);
 		break;
 

Modified: head/sys/dev/mii/xmphy.c
==============================================================================
--- head/sys/dev/mii/xmphy.c	Sat Oct 26 18:25:55 2013	(r257183)
+++ head/sys/dev/mii/xmphy.c	Sat Oct 26 18:40:17 2013	(r257184)
@@ -148,12 +148,6 @@ xmphy_service(struct mii_softc *sc, stru
 		break;
 
 	case MII_MEDIACHG:
-		/*
-		 * If the interface is not up, don't do anything.
-		 */
-		if ((mii->mii_ifp->if_flags & IFF_UP) == 0)
-			break;
-
 		switch (IFM_SUBTYPE(ife->ifm_media)) {
 		case IFM_AUTO:
 #ifdef foo
@@ -182,12 +176,6 @@ xmphy_service(struct mii_softc *sc, stru
 
 	case MII_TICK:
 		/*
-		 * Is the interface even up?
-		 */
-		if ((mii->mii_ifp->if_flags & IFF_UP) == 0)
-			return (0);
-
-		/*
 		 * Only used for autonegotiation.
 		 */
 		if (IFM_SUBTYPE(ife->ifm_media) != IFM_AUTO)

Modified: head/sys/dev/usb/net/ruephy.c
==============================================================================
--- head/sys/dev/usb/net/ruephy.c	Sat Oct 26 18:25:55 2013	(r257183)
+++ head/sys/dev/usb/net/ruephy.c	Sat Oct 26 18:40:17 2013	(r257184)
@@ -123,23 +123,11 @@ ruephy_service(struct mii_softc *sc, str
 		break;
 
 	case MII_MEDIACHG:
-		/*
-		 * If the interface is not up, don't do anything.
-		 */
-		if ((mii->mii_ifp->if_flags & IFF_UP) == 0)
-			break;
-
 		mii_phy_setmedia(sc);
 		break;
 
 	case MII_TICK:
 		/*
-		 * Is the interface even up?
-		 */
-		if ((mii->mii_ifp->if_flags & IFF_UP) == 0)
-			return (0);
-
-		/*
 		 * Only used for autonegotiation.
 		 */
 		if (IFM_SUBTYPE(ife->ifm_media) != IFM_AUTO)

Modified: head/sys/dev/xl/xlphy.c
==============================================================================
--- head/sys/dev/xl/xlphy.c	Sat Oct 26 18:25:55 2013	(r257183)
+++ head/sys/dev/xl/xlphy.c	Sat Oct 26 18:40:17 2013	(r257184)
@@ -152,23 +152,11 @@ xlphy_service(struct mii_softc *sc, stru
 		break;
 
 	case MII_MEDIACHG:
-		/*
-		 * If the interface is not up, don't do anything.
-		 */
-		if ((mii->mii_ifp->if_flags & IFF_UP) == 0)
-			break;
-
 		mii_phy_setmedia(sc);
 		break;
 
 	case MII_TICK:
 		/*
-		 * Is the interface even up?
-		 */
-		if ((mii->mii_ifp->if_flags & IFF_UP) == 0)
-			return (0);
-
-		/*
 		 * The 3Com PHY's autonegotiation doesn't need to be
 		 * kicked; it continues in the background.
 		 */



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