Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 3 Aug 2011 07:36:10 +0000 (UTC)
From:      Adrian Chadd <adrian@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-user@freebsd.org
Subject:   svn commit: r224626 - user/adrian/if_ath_tx/sys/dev/ath
Message-ID:  <201108030736.p737aAD1091728@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: adrian
Date: Wed Aug  3 07:36:10 2011
New Revision: 224626
URL: http://svn.freebsd.org/changeset/base/224626

Log:
  Since the hardware TXQ lock now protects all the node TIDs that are behind it,
  the completion functions also need protecting by the same lock.
  So, shuffle the TXQ lock to protect the whole loop, including the TXQ
  dequeue, completion check/function, and txq schedule.

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 Aug  3 07:00:55 2011	(r224625)
+++ user/adrian/if_ath_tx/sys/dev/ath/if_ath.c	Wed Aug  3 07:36:10 2011	(r224626)
@@ -4144,12 +4144,11 @@ ath_tx_processq(struct ath_softc *sc, st
 		(caddr_t)(uintptr_t) ath_hal_gettxbuf(sc->sc_ah, txq->axq_qnum),
 		txq->axq_link);
 	nacked = 0;
+	ATH_TXQ_LOCK(txq);
 	for (;;) {
-		ATH_TXQ_LOCK(txq);
 		txq->axq_intrcnt = 0;	/* reset periodic desc intr count */
 		bf = STAILQ_FIRST(&txq->axq_q);
 		if (bf == NULL) {
-			ATH_TXQ_UNLOCK(txq);
 			break;
 		}
 		ds0 = &bf->bf_desc[0];
@@ -4162,7 +4161,6 @@ ath_tx_processq(struct ath_softc *sc, st
 			    status == HAL_OK);
 #endif
 		if (status == HAL_EINPROGRESS) {
-			ATH_TXQ_UNLOCK(txq);
 			break;
 		}
 		ATH_TXQ_REMOVE_HEAD(txq, bf_list);
@@ -4179,7 +4177,6 @@ ath_tx_processq(struct ath_softc *sc, st
 		if (txq->axq_depth == 0)
 #endif
 			txq->axq_link = NULL;
-		ATH_TXQ_UNLOCK(txq);
 
 		ni = bf->bf_node;
 		/*
@@ -4223,16 +4220,6 @@ ath_tx_processq(struct ath_softc *sc, st
 #endif
 
 	/* Kick the TXQ scheduler */
-	/*
-	 * XXX for now, (whilst the completion functions aren't doing anything),
-	 * XXX re-lock the hardware txq here.
-	 *
-	 * Later on though, those completion functions may grovel around
-	 * in the per-tid state. That's going to require locking.
-	 * The reference code kept TXQ locked for the whole of this duration
-	 * so the completion functions didn't race.
-	 */
-	ATH_TXQ_LOCK(txq);
 	ath_txq_sched(sc, txq);
 	ATH_TXQ_UNLOCK(txq);
 



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