From owner-svn-src-all@FreeBSD.ORG Sun Feb 20 01:10:15 2011 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 50A1F1065670; Sun, 20 Feb 2011 01:10:15 +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 3CF4E8FC12; Sun, 20 Feb 2011 01:10:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p1K1AFwA014779; Sun, 20 Feb 2011 01:10:15 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p1K1AFlO014776; Sun, 20 Feb 2011 01:10:15 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201102200110.p1K1AFlO014776@svn.freebsd.org> From: Pyun YongHyeon Date: Sun, 20 Feb 2011 01:10:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r218869 - stable/7/sys/dev/alc 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: Sun, 20 Feb 2011 01:10:15 -0000 Author: yongari Date: Sun Feb 20 01:10:14 2011 New Revision: 218869 URL: http://svn.freebsd.org/changeset/base/218869 Log: MFC r217379: - Move ether_ifdetach() earlier and remove now-unneeded IN_DETACH flag. - Expand locking in interrupt handler. Modified: stable/7/sys/dev/alc/if_alc.c stable/7/sys/dev/alc/if_alcvar.h 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/alc/if_alc.c ============================================================================== --- stable/7/sys/dev/alc/if_alc.c Sun Feb 20 01:08:49 2011 (r218868) +++ stable/7/sys/dev/alc/if_alc.c Sun Feb 20 01:10:14 2011 (r218869) @@ -1052,13 +1052,12 @@ alc_detach(device_t dev) ifp = sc->alc_ifp; if (device_is_attached(dev)) { + ether_ifdetach(ifp); ALC_LOCK(sc); - sc->alc_flags |= ALC_FLAG_DETACH; alc_stop(sc); ALC_UNLOCK(sc); callout_drain(&sc->alc_tick_ch); taskqueue_drain(sc->alc_tq, &sc->alc_int_task); - ether_ifdetach(ifp); } if (sc->alc_tq != NULL) { @@ -2368,7 +2367,7 @@ alc_ioctl(struct ifnet *ifp, u_long cmd, ((ifp->if_flags ^ sc->alc_if_flags) & (IFF_PROMISC | IFF_ALLMULTI)) != 0) alc_rxfilter(sc); - else if ((sc->alc_flags & ALC_FLAG_DETACH) == 0) + else alc_init_locked(sc); } else if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) alc_stop(sc); @@ -2663,6 +2662,7 @@ alc_int_task(void *arg, int pending) ifp = sc->alc_ifp; status = CSR_READ_4(sc, ALC_INTR_STATUS); + ALC_LOCK(sc); if (sc->alc_morework != 0) { sc->alc_morework = 0; status |= INTR_RX_PKT; @@ -2680,7 +2680,6 @@ alc_int_task(void *arg, int pending) if (more == EAGAIN) sc->alc_morework = 1; else if (more == EIO) { - ALC_LOCK(sc); ifp->if_drv_flags &= ~IFF_DRV_RUNNING; alc_init_locked(sc); ALC_UNLOCK(sc); @@ -2698,7 +2697,6 @@ alc_int_task(void *arg, int pending) if ((status & INTR_TXQ_TO_RST) != 0) device_printf(sc->alc_dev, "TxQ reset! -- resetting\n"); - ALC_LOCK(sc); ifp->if_drv_flags &= ~IFF_DRV_RUNNING; alc_init_locked(sc); ALC_UNLOCK(sc); @@ -2706,11 +2704,12 @@ alc_int_task(void *arg, int pending) } if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0 && !IFQ_DRV_IS_EMPTY(&ifp->if_snd)) - alc_start(ifp); + alc_start_locked(ifp); } if (more == EAGAIN || (CSR_READ_4(sc, ALC_INTR_STATUS) & ALC_INTRS) != 0) { + ALC_UNLOCK(sc); taskqueue_enqueue(sc->alc_tq, &sc->alc_int_task); return; } @@ -2720,6 +2719,7 @@ done: /* Re-enable interrupts if we're running. */ CSR_WRITE_4(sc, ALC_INTR_STATUS, 0x7FFFFFFF); } + ALC_UNLOCK(sc); } static void @@ -3039,7 +3039,9 @@ alc_rxeof(struct alc_softc *sc, struct r #endif { /* Pass it on. */ + ALC_UNLOCK(sc); (*ifp->if_input)(ifp, m); + ALC_LOCK(sc); } } } Modified: stable/7/sys/dev/alc/if_alcvar.h ============================================================================== --- stable/7/sys/dev/alc/if_alcvar.h Sun Feb 20 01:08:49 2011 (r218868) +++ stable/7/sys/dev/alc/if_alcvar.h Sun Feb 20 01:10:14 2011 (r218869) @@ -230,7 +230,6 @@ struct alc_softc { #define ALC_FLAG_L0S 0x0400 #define ALC_FLAG_L1S 0x0800 #define ALC_FLAG_APS 0x1000 -#define ALC_FLAG_DETACH 0x4000 #define ALC_FLAG_LINK 0x8000 struct callout alc_tick_ch;