svn commit: r192716 - head/sys/dev/msk

Pyun YongHyeon yongari at FreeBSD.org
Mon May 25 03:24:48 UTC 2009


Author: yongari
Date: Mon May 25 03:24:47 2009
New Revision: 192716
URL: http://svn.freebsd.org/changeset/base/192716

Log:
  Remove link handling taskqueue and use mii callback directly. While
  I'm here also checks driver running state.

Modified:
  head/sys/dev/msk/if_msk.c
  head/sys/dev/msk/if_mskreg.h

Modified: head/sys/dev/msk/if_msk.c
==============================================================================
--- head/sys/dev/msk/if_msk.c	Mon May 25 03:06:26 2009	(r192715)
+++ head/sys/dev/msk/if_msk.c	Mon May 25 03:24:47 2009	(r192716)
@@ -285,7 +285,6 @@ static int msk_phy_writereg(struct msk_i
 static int msk_miibus_readreg(device_t, int, int);
 static int msk_miibus_writereg(device_t, int, int, int);
 static void msk_miibus_statchg(device_t);
-static void msk_link_task(void *, int);
 
 static void msk_rxfilter(struct msk_if_softc *);
 static void msk_setvlan(struct msk_if_softc *, struct ifnet *);
@@ -459,32 +458,22 @@ msk_phy_writereg(struct msk_if_softc *sc
 static void
 msk_miibus_statchg(device_t dev)
 {
-	struct msk_if_softc *sc_if;
-
-	sc_if = device_get_softc(dev);
-	taskqueue_enqueue(taskqueue_swi, &sc_if->msk_link_task);
-}
-
-static void
-msk_link_task(void *arg, int pending)
-{
 	struct msk_softc *sc;
 	struct msk_if_softc *sc_if;
 	struct mii_data *mii;
 	struct ifnet *ifp;
 	uint32_t gmac;
 
-	sc_if = (struct msk_if_softc *)arg;
+	sc_if = device_get_softc(dev);
 	sc = sc_if->msk_softc;
 
 	MSK_IF_LOCK(sc_if);
 
 	mii = device_get_softc(sc_if->msk_miibus);
 	ifp = sc_if->msk_ifp;
-	if (mii == NULL || ifp == NULL) {
-		MSK_IF_UNLOCK(sc_if);
+	if (mii == NULL || ifp == NULL ||
+	    (ifp->if_drv_flags & IFF_DRV_RUNNING) == 0)
 		return;
-	}
 
 	if (mii->mii_media_status & IFM_ACTIVE) {
 		if (IFM_SUBTYPE(mii->mii_media_active) != IFM_NONE)
@@ -554,8 +543,6 @@ msk_link_task(void *arg, int pending)
 		/* Read again to ensure writing. */
 		GMAC_READ_2(sc, sc_if->msk_port, GM_GP_CTRL);
 	}
-
-	MSK_IF_UNLOCK(sc_if);
 }
 
 static void
@@ -1416,7 +1403,6 @@ msk_attach(device_t dev)
 	}
 
 	callout_init_mtx(&sc_if->msk_tick_ch, &sc_if->msk_softc->msk_mtx, 0);
-	TASK_INIT(&sc_if->msk_link_task, 0, msk_link_task, sc_if);
 	msk_sysctl_node(sc_if);
 
 	/* Disable jumbo frame for Yukon FE. */
@@ -1791,7 +1777,6 @@ msk_detach(device_t dev)
 		MSK_IF_UNLOCK(sc_if);
 		callout_drain(&sc_if->msk_tick_ch);
 		taskqueue_drain(taskqueue_fast, &sc_if->msk_tx_task);
-		taskqueue_drain(taskqueue_swi, &sc_if->msk_link_task);
 		ether_ifdetach(ifp);
 		MSK_IF_LOCK(sc_if);
 	}

Modified: head/sys/dev/msk/if_mskreg.h
==============================================================================
--- head/sys/dev/msk/if_mskreg.h	Mon May 25 03:06:26 2009	(r192715)
+++ head/sys/dev/msk/if_mskreg.h	Mon May 25 03:24:47 2009	(r192716)
@@ -2395,7 +2395,6 @@ struct msk_if_softc {
 	struct msk_ring_data	msk_rdata;
 	struct msk_softc	*msk_softc;	/* parent controller */
 	struct msk_hw_stats	msk_stats;
-	struct task		msk_link_task;
 	struct task		msk_tx_task;
 	int			msk_if_flags;
 	int			msk_detach;


More information about the svn-src-all mailing list