Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 19 Oct 2011 13:11:50 +0000 (UTC)
From:      Adrian Chadd <adrian@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-user@freebsd.org
Subject:   svn commit: r226543 - user/adrian/if_ath_tx/sys/dev/ath
Message-ID:  <201110191311.p9JDBo7S026179@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: adrian
Date: Wed Oct 19 13:11:50 2011
New Revision: 226543
URL: http://svn.freebsd.org/changeset/base/226543

Log:
  * Remove the locking around the channel set code (for now),
    as we can't hold the lock across where ath_rx_proc() will be
    called to properly drain the RX queue.
  
  * Split out the "drain txq" and "stop tx dma" code.

Modified:
  user/adrian/if_ath_tx/sys/dev/ath/if_ath.c

Modified: user/adrian/if_ath_tx/sys/dev/ath/if_ath.c
==============================================================================
--- user/adrian/if_ath_tx/sys/dev/ath/if_ath.c	Wed Oct 19 12:16:19 2011	(r226542)
+++ user/adrian/if_ath_tx/sys/dev/ath/if_ath.c	Wed Oct 19 13:11:50 2011	(r226543)
@@ -4872,17 +4872,16 @@ ath_tx_stopdma(struct ath_softc *sc, str
 	(void) ath_hal_stoptxdma(ah, txq->axq_qnum);
 }
 
-/*
- * Drain the transmit queues and reclaim resources.
- */
-static void
-ath_draintxq(struct ath_softc *sc, ATH_RESET_TYPE reset_type)
+static int
+ath_stoptxdma(struct ath_softc *sc)
 {
 	struct ath_hal *ah = sc->sc_ah;
-	struct ifnet *ifp = sc->sc_ifp;
 	int i;
 
 	/* XXX return value */
+	if (!sc->sc_invalid)
+		return 0;
+
 	if (!sc->sc_invalid) {
 		/* don't touch the hardware if marked invalid */
 		DPRINTF(sc, ATH_DEBUG_RESET, "%s: tx queue [%u] %p, link %p\n",
@@ -4894,6 +4893,22 @@ ath_draintxq(struct ath_softc *sc, ATH_R
 			if (ATH_TXQ_SETUP(sc, i))
 				ath_tx_stopdma(sc, &sc->sc_txq[i]);
 	}
+
+	return 1;
+}
+
+/*
+ * Drain the transmit queues and reclaim resources.
+ */
+static void
+ath_draintxq(struct ath_softc *sc, ATH_RESET_TYPE reset_type)
+{
+	struct ath_hal *ah = sc->sc_ah;
+	struct ifnet *ifp = sc->sc_ifp;
+	int i;
+
+	(void) ath_stoptxdma(sc);
+
 	for (i = 0; i < HAL_NUM_TX_QUEUES; i++)
 		if (ATH_TXQ_SETUP(sc, i))
 			ath_tx_draintxq(sc, &sc->sc_txq[i]);
@@ -5018,8 +5033,6 @@ 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);
@@ -5240,8 +5253,6 @@ 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
@@ -5251,8 +5262,6 @@ ath_set_channel(struct ieee80211com *ic)
 	 */
 	if (!sc->sc_scanning && ic->ic_curchan == ic->ic_bsschan)
 		sc->sc_syncbeacon = 1;
-
-	ATH_UNLOCK(sc);
 }
 
 /*



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201110191311.p9JDBo7S026179>