Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 8 Nov 2012 17:43:58 +0000 (UTC)
From:      Adrian Chadd <adrian@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r242779 - head/sys/dev/ath
Message-ID:  <201211081743.qA8HhwvK025512@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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



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