From owner-svn-src-all@FreeBSD.ORG Thu Feb 23 06:13:13 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6F775106564A; Thu, 23 Feb 2012 06:13:13 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 510688FC08; Thu, 23 Feb 2012 06:13:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q1N6DDdh087181; Thu, 23 Feb 2012 06:13:13 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1N6DD2a087178; Thu, 23 Feb 2012 06:13:13 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201202230613.q1N6DD2a087178@svn.freebsd.org> From: Pyun YongHyeon Date: Thu, 23 Feb 2012 06:13:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r232029 - head/sys/dev/sf X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Feb 2012 06:13:13 -0000 Author: yongari Date: Thu Feb 23 06:13:12 2012 New Revision: 232029 URL: http://svn.freebsd.org/changeset/base/232029 Log: Remove taskqueue based MII stat change handler. Driver does not need deferred link state change processing. While I'm here, do not report current link status if interface is not UP. Modified: head/sys/dev/sf/if_sf.c head/sys/dev/sf/if_sfreg.h Modified: head/sys/dev/sf/if_sf.c ============================================================================== --- head/sys/dev/sf/if_sf.c Thu Feb 23 05:36:49 2012 (r232028) +++ head/sys/dev/sf/if_sf.c Thu Feb 23 06:13:12 2012 (r232029) @@ -96,7 +96,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include @@ -192,7 +191,6 @@ static uint8_t sf_read_eeprom(struct sf_ static int sf_miibus_readreg(device_t, int, int); static int sf_miibus_writereg(device_t, int, int, int); static void sf_miibus_statchg(device_t); -static void sf_link_task(void *, int); #ifdef DEVICE_POLLING static int sf_poll(struct ifnet *ifp, enum poll_cmd cmd, int count); #endif @@ -394,30 +392,16 @@ static void sf_miibus_statchg(device_t dev) { struct sf_softc *sc; - - sc = device_get_softc(dev); - taskqueue_enqueue(taskqueue_swi, &sc->sf_link_task); -} - -static void -sf_link_task(void *arg, int pending) -{ - struct sf_softc *sc; struct mii_data *mii; struct ifnet *ifp; uint32_t val; - sc = (struct sf_softc *)arg; - - SF_LOCK(sc); - + sc = device_get_softc(dev); mii = device_get_softc(sc->sf_miibus); ifp = sc->sf_ifp; if (mii == NULL || ifp == NULL || - (ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) { - SF_UNLOCK(sc); + (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) @@ -454,8 +438,6 @@ sf_link_task(void *arg, int pending) else val &= ~SF_TIMER_TIMES_TEN; csr_write_4(sc, SF_TIMER_CTL, val); - - SF_UNLOCK(sc); } static void @@ -558,8 +540,12 @@ sf_ifmedia_sts(struct ifnet *ifp, struct sc = ifp->if_softc; SF_LOCK(sc); - mii = device_get_softc(sc->sf_miibus); + if ((ifp->if_flags & IFF_UP) == 0) { + SF_UNLOCK(sc); + return; + } + mii = device_get_softc(sc->sf_miibus); mii_pollstat(mii); ifmr->ifm_active = mii->mii_media_active; ifmr->ifm_status = mii->mii_media_status; @@ -753,7 +739,6 @@ sf_attach(device_t dev) mtx_init(&sc->sf_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK, MTX_DEF); callout_init_mtx(&sc->sf_co, &sc->sf_mtx, 0); - TASK_INIT(&sc->sf_link_task, 0, sf_link_task, sc); /* * Map control/status registers. @@ -955,7 +940,6 @@ sf_detach(device_t dev) sf_stop(sc); SF_UNLOCK(sc); callout_drain(&sc->sf_co); - taskqueue_drain(taskqueue_swi, &sc->sf_link_task); if (ifp != NULL) ether_ifdetach(ifp); } Modified: head/sys/dev/sf/if_sfreg.h ============================================================================== --- head/sys/dev/sf/if_sfreg.h Thu Feb 23 05:36:49 2012 (r232028) +++ head/sys/dev/sf/if_sfreg.h Thu Feb 23 06:13:12 2012 (r232029) @@ -1083,7 +1083,6 @@ struct sf_softc { int sf_if_flags; struct callout sf_co; int sf_watchdog_timer; - struct task sf_link_task; int sf_link; int sf_suspended; int sf_detach;