From owner-svn-src-all@FreeBSD.ORG Thu Nov 8 17:43:59 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 33D89AA6; Thu, 8 Nov 2012 17:43:59 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) by mx1.freebsd.org (Postfix) with ESMTP id 1418B8FC12; Thu, 8 Nov 2012 17:43:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.5/8.14.5) with ESMTP id qA8HhwVZ025513; Thu, 8 Nov 2012 17:43:58 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.5/8.14.5/Submit) id qA8HhwvK025512; Thu, 8 Nov 2012 17:43:58 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201211081743.qA8HhwvK025512@svn.freebsd.org> From: Adrian Chadd Date: Thu, 8 Nov 2012 17:43:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r242779 - head/sys/dev/ath X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 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, 08 Nov 2012 17:43:59 -0000 Author: adrian Date: Thu Nov 8 17:43:58 2012 New Revision: 242779 URL: http://svnweb.freebsd.org/changeset/base/242779 Log: Implement the ATH_RESET_NOLOSS path for TX stop and start; this is needed for 802.11n TX device restarting. Remove the debug printf()s; they're no longer needed here. Modified: head/sys/dev/ath/if_ath_tx_edma.c Modified: head/sys/dev/ath/if_ath_tx_edma.c ============================================================================== --- head/sys/dev/ath/if_ath_tx_edma.c Thu Nov 8 17:32:55 2012 (r242778) +++ head/sys/dev/ath/if_ath_tx_edma.c Thu Nov 8 17:43:58 2012 (r242779) @@ -130,6 +130,8 @@ __FBSDID("$FreeBSD$"); MALLOC_DECLARE(M_ATHDEV); +static void ath_edma_tx_processq(struct ath_softc *sc, int dosched); + static void ath_edma_tx_fifo_fill(struct ath_softc *sc, struct ath_txq *txq) { @@ -170,7 +172,7 @@ static void ath_edma_dma_restart(struct ath_softc *sc, struct ath_txq *txq) { - device_printf(sc->sc_dev, "%s: called: txq=%p, qnum=%d\n", + DPRINTF(sc, ATH_DEBUG_RESET, "%s: called: txq=%p, qnum=%d\n", __func__, txq, txq->axq_qnum); @@ -393,7 +395,7 @@ ath_edma_tx_drain(struct ath_softc *sc, struct ifnet *ifp = sc->sc_ifp; int i; - device_printf(sc->sc_dev, "%s: called\n", __func__); + DPRINTF(sc, ATH_DEBUG_RESET, "%s: called\n", __func__); (void) ath_stoptxdma(sc); @@ -403,17 +405,19 @@ ath_edma_tx_drain(struct ath_softc *sc, * * Otherwise, just toss everything in each TX queue. */ + if (reset_type == ATH_RESET_NOLOSS) { + ath_edma_tx_processq(sc, 0); + } else { + for (i = 0; i < HAL_NUM_TX_QUEUES; i++) { + if (ATH_TXQ_SETUP(sc, i)) + ath_tx_draintxq(sc, &sc->sc_txq[i]); + } + } /* XXX dump out the TX completion FIFO contents */ /* XXX dump out the frames */ - /* XXX for now, just drain */ - for (i = 0; i < HAL_NUM_TX_QUEUES; i++) { - if (ATH_TXQ_SETUP(sc, i)) - ath_tx_draintxq(sc, &sc->sc_txq[i]); - } - IF_LOCK(&ifp->if_snd); ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; IF_UNLOCK(&ifp->if_snd); @@ -421,12 +425,25 @@ ath_edma_tx_drain(struct ath_softc *sc, } /* - * Process the TX status queue. + * TX completion tasklet. */ + static void ath_edma_tx_proc(void *arg, int npending) { struct ath_softc *sc = (struct ath_softc *) arg; + + DPRINTF(sc, ATH_DEBUG_TX_PROC, "%s: called, npending=%d\n", + __func__, npending); + ath_edma_tx_processq(sc, 1); +} + +/* + * Process the TX status queue. + */ +static void +ath_edma_tx_processq(struct ath_softc *sc, int dosched) +{ struct ath_hal *ah = sc->sc_ah; HAL_STATUS status; struct ath_tx_status ts; @@ -441,17 +458,14 @@ ath_edma_tx_proc(void *arg, int npending uint32_t txstatus[32]; #endif - DPRINTF(sc, ATH_DEBUG_TX_PROC, "%s: called, npending=%d\n", - __func__, npending); - for (idx = 0; ; idx++) { bzero(&ts, sizeof(ts)); ATH_TXSTATUS_LOCK(sc); - status = ath_hal_txprocdesc(ah, NULL, (void *) &ts); #ifdef ATH_DEBUG ath_hal_gettxrawtxdesc(ah, txstatus); #endif + status = ath_hal_txprocdesc(ah, NULL, (void *) &ts); ATH_TXSTATUS_UNLOCK(sc); #ifdef ATH_DEBUG @@ -594,7 +608,7 @@ ath_edma_tx_proc(void *arg, int npending * working. */ ATH_TXQ_LOCK(txq); - if (txq->axq_fifo_depth == 0) { + if (dosched && txq->axq_fifo_depth == 0) { ath_edma_tx_fifo_fill(sc, txq); } ATH_TXQ_UNLOCK(txq); @@ -614,7 +628,8 @@ ath_edma_tx_proc(void *arg, int npending * but there's no easy way right now to only populate * the txq task for _one_ TXQ. This should be fixed. */ - taskqueue_enqueue(sc->sc_tq, &sc->sc_txqtask); + if (dosched) + taskqueue_enqueue(sc->sc_tq, &sc->sc_txqtask); } static void