From owner-svn-src-all@FreeBSD.ORG Fri Feb 17 03:46:38 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 D2F6C106566B; Fri, 17 Feb 2012 03:46:38 +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 B89048FC1B; Fri, 17 Feb 2012 03:46:38 +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 q1H3kckm048481; Fri, 17 Feb 2012 03:46:38 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1H3kcv0048479; Fri, 17 Feb 2012 03:46:38 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201202170346.q1H3kcv0048479@svn.freebsd.org> From: Adrian Chadd Date: Fri, 17 Feb 2012 03:46:38 +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: r231857 - head/sys/dev/ath 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: Fri, 17 Feb 2012 03:46:39 -0000 Author: adrian Date: Fri Feb 17 03:46:38 2012 New Revision: 231857 URL: http://svn.freebsd.org/changeset/base/231857 Log: Enforce some consistent ordering and handling of interrupt disable/enable with RX/TX halting. * Always disable/enable interrupts during a channel change, just to simply things. * Ensure that the ath taskqueue has completed and is paused before continuing. This dramatically reduces the instances of overlapping RX and reset conditions. PR: kern/165220 Modified: head/sys/dev/ath/if_ath.c Modified: head/sys/dev/ath/if_ath.c ============================================================================== --- head/sys/dev/ath/if_ath.c Fri Feb 17 03:39:06 2012 (r231856) +++ head/sys/dev/ath/if_ath.c Fri Feb 17 03:46:38 2012 (r231857) @@ -1934,6 +1934,7 @@ ath_txrx_stop_locked(struct ath_softc *s } #undef MAX_TXRX_ITERATIONS +#if 0 static void ath_txrx_stop(struct ath_softc *sc) { @@ -1944,6 +1945,7 @@ ath_txrx_stop(struct ath_softc *sc) ath_txrx_stop_locked(sc); ATH_PCU_UNLOCK(sc); } +#endif static void ath_txrx_start(struct ath_softc *sc) @@ -2049,11 +2051,12 @@ ath_reset(struct ifnet *ifp, ATH_RESET_T ATH_UNLOCK_ASSERT(sc); ATH_PCU_LOCK(sc); + ath_hal_intrset(ah, 0); /* disable interrupts */ + ath_txrx_stop_locked(sc); /* Ensure TX/RX is stopped */ if (ath_reset_grablock(sc, 1) == 0) { device_printf(sc->sc_dev, "%s: concurrent reset! Danger!\n", __func__); } - ath_hal_intrset(ah, 0); /* disable interrupts */ ATH_PCU_UNLOCK(sc); /* @@ -2061,7 +2064,6 @@ ath_reset(struct ifnet *ifp, ATH_RESET_T * and block future ones from occuring. This needs to be * done before the TX queue is drained. */ - ath_txrx_stop(sc); ath_draintxq(sc, reset_type); /* stop xmit side */ /* @@ -5383,21 +5385,16 @@ ath_chan_set(struct ath_softc *sc, struc struct ieee80211com *ic = ifp->if_l2com; struct ath_hal *ah = sc->sc_ah; int ret = 0; - int dointr = 0; /* Treat this as an interface reset */ ATH_PCU_LOCK(sc); + ath_hal_intrset(ah, 0); /* Stop new RX/TX completion */ + ath_txrx_stop_locked(sc); /* Stop pending RX/TX completion */ if (ath_reset_grablock(sc, 1) == 0) { device_printf(sc->sc_dev, "%s: concurrent reset! Danger!\n", __func__); } - if (chan != sc->sc_curchan) { - dointr = 1; - /* XXX only do this if inreset_cnt is 1? */ - ath_hal_intrset(ah, 0); - } ATH_PCU_UNLOCK(sc); - ath_txrx_stop(sc); DPRINTF(sc, ATH_DEBUG_RESET, "%s: %u (%u MHz, flags 0x%x)\n", __func__, ieee80211_chan2ieee(ic, chan), @@ -5466,10 +5463,10 @@ ath_chan_set(struct ath_softc *sc, struc ath_beacon_config(sc, NULL); } -#if 0 /* * Re-enable interrupts. */ +#if 0 ath_hal_intrset(ah, sc->sc_imask); #endif } @@ -5478,8 +5475,7 @@ finish: ATH_PCU_LOCK(sc); sc->sc_inreset_cnt--; /* XXX only do this if sc_inreset_cnt == 0? */ - if (dointr) - ath_hal_intrset(ah, sc->sc_imask); + ath_hal_intrset(ah, sc->sc_imask); ATH_PCU_UNLOCK(sc); /* XXX do this inside of IF_LOCK? */