Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 11 Jun 2011 12:40:15 +0000 (UTC)
From:      Adrian Chadd <adrian@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-user@freebsd.org
Subject:   svn commit: r222983 - user/adrian/if_ath_tx/sys/dev/ath
Message-ID:  <201106111240.p5BCeFWo075398@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: adrian
Date: Sat Jun 11 12:40:14 2011
New Revision: 222983
URL: http://svn.freebsd.org/changeset/base/222983

Log:
  * add a per-node queue depth counter
  * correctly lock access to sc->sc_txnodeq
  * fix an incorrect txq reference

Modified:
  user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c
  user/adrian/if_ath_tx/sys/dev/ath/if_athvar.h

Modified: user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c
==============================================================================
--- user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c	Sat Jun 11 12:34:08 2011	(r222982)
+++ user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c	Sat Jun 11 12:40:14 2011	(r222983)
@@ -937,6 +937,11 @@ ath_tx_start(struct ath_softc *sc, struc
 	/* Fill in the details in the descriptor list */
 	ath_tx_chaindesclist(sc, txq, bf);
 
+#if 0
+	/* add to software queue */
+	ath_tx_swq(sc, ni, bf, m0);
+#else
+
 	/*
 	 * For now, since there's no software queue,
 	 * direct-dispatch to the hardware.
@@ -945,6 +950,7 @@ ath_tx_start(struct ath_softc *sc, struc
 		ath_tx_handoff_mcast(sc, txq, bf);
 	else
 		ath_tx_handoff_hw(sc, txq, bf);
+#endif
 
 	return 0;
 }
@@ -1287,6 +1293,10 @@ ath_tx_swq(struct ath_softc *sc, struct 
 	ATH_TXQ_INSERT_TAIL(atid, bf, bf_list);
 	ATH_TXQ_UNLOCK(atid);
 
+	/* Bump queued packet counter */
+	/* XXX does this have to be atomic? */
+	an->an_qdepth++;
+
 	/* Mark the given node/tid as having packets to dequeue */
 	ATH_LOCK(sc);
 	ath_tx_node_sched(sc, an);
@@ -1416,7 +1426,7 @@ ath_tx_tid_hw_queue(struct ath_softc *sc
 
 	for (;;) {
 		ATH_TXQ_LOCK(atid);
-                bf = STAILQ_FIRST(&txq->axq_q);
+                bf = STAILQ_FIRST(&atid->axq_q);
 		if (bf == NULL) {
 			ATH_TXQ_UNLOCK(atid);
 			break;
@@ -1424,6 +1434,9 @@ ath_tx_tid_hw_queue(struct ath_softc *sc
 		ATH_TXQ_REMOVE_HEAD(atid, bf_list);
 		ATH_TXQ_UNLOCK(atid);
 
+		/* XXX does this have to be atomic? */
+		an->an_qdepth--;
+
 		txq = bf->bf_state.bfs_txq;
 		/* Sanity check! */
 		if (tid != bf->bf_state.bfs_tid) {
@@ -1457,33 +1470,24 @@ ath_tx_hw_queue(struct ath_softc *sc, st
 	}
 }
 
-/*
- * This is pretty disgusting, but again it's just temporary.
- */
 static int
 ath_txq_node_qlen(struct ath_softc *sc, struct ath_node *an)
 {
-	int qlen = 0;
-	int i;
-	for (i = 0; i < IEEE80211_TID_SIZE; i++) {
-		ATH_TXQ_LOCK(&an->an_tid[i]);
-		qlen += an->an_tid[i].axq_depth;
-		ATH_TXQ_UNLOCK(&an->an_tid[i]);
-	}
-	return qlen;
+	return an->an_qdepth;
 }
 
 /*
  * Handle scheduling some packets from whichever nodes have
  * signaled they're (potentially) ready.
- *
- * This must be called with the ATH lock held.
  */
 void
 ath_txq_sched(struct ath_softc *sc)
 {
 	struct ath_node *an, *next;
 
+	/* XXX I'm not happy the ATH lock is held for so long here */
+	ATH_LOCK(sc);
+
 	/* Iterate over the list of active nodes, queuing packets */
 	STAILQ_FOREACH_SAFE(an, &sc->sc_txnodeq, an_list, next) {
 		/* Try dequeueing packets from the current node */
@@ -1493,4 +1497,5 @@ ath_txq_sched(struct ath_softc *sc)
 		if (! ath_txq_node_qlen(sc, an))
 			ath_tx_node_unsched(sc, an);
 	}
+	ATH_UNLOCK(sc);
 } 

Modified: user/adrian/if_ath_tx/sys/dev/ath/if_athvar.h
==============================================================================
--- user/adrian/if_ath_tx/sys/dev/ath/if_athvar.h	Sat Jun 11 12:34:08 2011	(r222982)
+++ user/adrian/if_ath_tx/sys/dev/ath/if_athvar.h	Sat Jun 11 12:40:14 2011	(r222983)
@@ -109,6 +109,7 @@ struct ath_node {
 						 * added to the txq axq_nodeq */
 	struct ath_buf	*an_ff_buf[WME_NUM_AC]; /* ff staging area */
 	struct ath_tid	an_tid[IEEE80211_TID_SIZE];	/* per-TID state */
+	u_int		an_qdepth;	/* Current queue depth of all TIDs */
 	/* variable-length rate control state follows */
 };
 #define	ATH_NODE(ni)	((struct ath_node *)(ni))



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