From owner-svn-src-user@FreeBSD.ORG Sat Oct 15 16:05:27 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 82327106566B; Sat, 15 Oct 2011 16:05:27 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 67A0A8FC16; Sat, 15 Oct 2011 16:05:27 +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 p9FG5Rbv020818; Sat, 15 Oct 2011 16:05:27 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p9FG5RLN020815; Sat, 15 Oct 2011 16:05:27 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201110151605.p9FG5RLN020815@svn.freebsd.org> From: Adrian Chadd Date: Sat, 15 Oct 2011 16:05:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r226399 - user/adrian/if_ath_tx/sys/dev/ath X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 Oct 2011 16:05:27 -0000 Author: adrian Date: Sat Oct 15 16:05:27 2011 New Revision: 226399 URL: http://svn.freebsd.org/changeset/base/226399 Log: Begin pushing the ath lock into other places where the hardware is fondled. This includes: * where the PCU RX is stopped/started; * where ath_reset() is called. Modified: user/adrian/if_ath_tx/sys/dev/ath/if_ath.c user/adrian/if_ath_tx/sys/dev/ath/if_ath_misc.h Modified: user/adrian/if_ath_tx/sys/dev/ath/if_ath.c ============================================================================== --- user/adrian/if_ath_tx/sys/dev/ath/if_ath.c Sat Oct 15 15:57:55 2011 (r226398) +++ user/adrian/if_ath_tx/sys/dev/ath/if_ath.c Sat Oct 15 16:05:27 2011 (r226399) @@ -1210,7 +1210,6 @@ ath_vap_delete(struct ieee80211vap *vap) sc->sc_swbmiss = 0; } #endif - ATH_UNLOCK(sc); free(avp, M_80211_VAP); if (ifp->if_drv_flags & IFF_DRV_RUNNING) { @@ -1231,6 +1230,7 @@ ath_vap_delete(struct ieee80211vap *vap) } ath_hal_intrset(ah, sc->sc_imask); } + ATH_UNLOCK(sc); } void @@ -1812,6 +1812,18 @@ ath_stop(struct ifnet *ifp) ATH_UNLOCK(sc); } +int +ath_reset(struct ifnet *ifp, ATH_RESET_TYPE reset_type) +{ + int r; + + struct ath_softc *sc = ifp->if_softc; + + ATH_LOCK(sc); + r = ath_reset_locked(ifp, reset_type); + ATH_UNLOCK(sc); + return r; +} /* * Reset the hardware w/o losing operational state. This is * basically a more efficient way of doing ath_stop, ath_init, @@ -1820,13 +1832,15 @@ ath_stop(struct ifnet *ifp) * to reset or reload hardware state. */ int -ath_reset(struct ifnet *ifp, ATH_RESET_TYPE reset_type) +ath_reset_locked(struct ifnet *ifp, ATH_RESET_TYPE reset_type) { struct ath_softc *sc = ifp->if_softc; struct ieee80211com *ic = ifp->if_l2com; struct ath_hal *ah = sc->sc_ah; HAL_STATUS status; + ATH_LOCK_ASSERT(sc); + DPRINTF(sc, ATH_DEBUG_RESET, "%s: called\n", __func__); ath_hal_intrset(ah, 0); /* disable interrupts */ @@ -4978,6 +4992,8 @@ ath_startrecv(struct ath_softc *sc) struct ath_hal *ah = sc->sc_ah; struct ath_buf *bf; + ATH_LOCK_ASSERT(sc); + sc->sc_rxlink = NULL; sc->sc_rxpending = NULL; TAILQ_FOREACH(bf, &sc->sc_rxbuf, bf_list) { @@ -5029,6 +5045,8 @@ ath_chan_set(struct ath_softc *sc, struc struct ieee80211com *ic = ifp->if_l2com; struct ath_hal *ah = sc->sc_ah; + ATH_LOCK_ASSERT(sc); + DPRINTF(sc, ATH_DEBUG_RESET, "%s: %u (%u MHz, flags 0x%x)\n", __func__, ieee80211_chan2ieee(ic, chan), chan->ic_freq, chan->ic_flags); @@ -5131,7 +5149,7 @@ ath_calibrate(void *arg) DPRINTF(sc, ATH_DEBUG_CALIBRATE, "%s: rfgain change\n", __func__); sc->sc_stats.ast_per_rfgain++; - ath_reset(ifp, ATH_RESET_NOLOSS); + ath_reset_locked(ifp, ATH_RESET_NOLOSS); } /* * If this long cal is after an idle period, then @@ -5249,6 +5267,8 @@ ath_set_channel(struct ieee80211com *ic) struct ifnet *ifp = ic->ic_ifp; struct ath_softc *sc = ifp->if_softc; + ATH_LOCK(sc); + (void) ath_chan_set(sc, ic->ic_curchan); /* * If we are returning to our bss channel then mark state @@ -5258,6 +5278,8 @@ ath_set_channel(struct ieee80211com *ic) */ if (!sc->sc_scanning && ic->ic_curchan == ic->ic_bsschan) sc->sc_syncbeacon = 1; + + ATH_UNLOCK(sc); } /* @@ -5797,7 +5819,7 @@ ath_watchdog(void *arg) hangs & 0xff ? "bb" : "mac", hangs); } else if_printf(ifp, "device timeout\n"); - ath_reset(ifp, ATH_RESET_NOLOSS); + ath_reset_locked(ifp, ATH_RESET_NOLOSS); ifp->if_oerrors++; sc->sc_stats.ast_watchdog++; } Modified: user/adrian/if_ath_tx/sys/dev/ath/if_ath_misc.h ============================================================================== --- user/adrian/if_ath_tx/sys/dev/ath/if_ath_misc.h Sat Oct 15 15:57:55 2011 (r226398) +++ user/adrian/if_ath_tx/sys/dev/ath/if_ath_misc.h Sat Oct 15 16:05:27 2011 (r226399) @@ -57,6 +57,7 @@ extern struct ath_buf * ath_buf_clone(st extern void ath_freebuf(struct ath_softc *sc, struct ath_buf *bf); extern int ath_reset(struct ifnet *, ATH_RESET_TYPE); +extern int ath_reset_locked(struct ifnet *, ATH_RESET_TYPE); extern void ath_tx_draintxq(struct ath_softc *sc, struct ath_txq *txq); extern void ath_tx_default_comp(struct ath_softc *sc, struct ath_buf *bf, int fail);