Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 23 Sep 2011 13:53:29 +0000 (UTC)
From:      Adrian Chadd <adrian@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-user@freebsd.org
Subject:   svn commit: r225740 - user/adrian/if_ath_tx/sys/dev/ath
Message-ID:  <201109231353.p8NDrTVF074664@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: adrian
Date: Fri Sep 23 13:53:28 2011
New Revision: 225740
URL: http://svn.freebsd.org/changeset/base/225740

Log:
  Re-introduce the FIFO packet scheduling code.
  
  This makes TX packet scheduling slightly fairer in hostap mode where
  multiple nodes and multiple TIDs may be actively TX'ing.
  
  Obtained from:	 Linux ath9k, Atheros

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

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	Fri Sep 23 05:35:24 2011	(r225739)
+++ user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c	Fri Sep 23 13:53:28 2011	(r225740)
@@ -3486,11 +3486,15 @@ ath_tx_tid_hw_queue_norm(struct ath_soft
  * This function walks the list of TIDs (ie, ath_node TIDs
  * with queued traffic) and attempts to schedule traffic
  * from them.
+ *
+ * TID scheduling is implemented as a FIFO, with TIDs being
+ * added to the end of the queue after some frames have been
+ * scheduled.
  */
 void
 ath_txq_sched(struct ath_softc *sc, struct ath_txq *txq)
 {
-	struct ath_tid *tid, *next;
+	struct ath_tid *tid, *next, *last;
 
 	ATH_TXQ_LOCK_ASSERT(txq);
 
@@ -3504,11 +3508,8 @@ ath_txq_sched(struct ath_softc *sc, stru
 		return;
 	}
 
-	/*
-	 * For now, let's not worry about QoS, fair-scheduling
-	 * or the like. That's a later problem. Just throw
-	 * packets at the hardware.
-	 */
+	last = TAILQ_LAST(&txq->axq_tidq, axq_t_s);
+
 	TAILQ_FOREACH_SAFE(tid, &txq->axq_tidq, axq_qelem, next) {
 		/*
 		 * Suspend paused queues here; they'll be resumed
@@ -3516,8 +3517,8 @@ ath_txq_sched(struct ath_softc *sc, stru
 		 */
 		DPRINTF(sc, ATH_DEBUG_SW_TX, "%s: tid=%d, paused=%d\n",
 		    __func__, tid->tid, tid->paused);
+		ath_tx_tid_unsched(sc, tid);
 		if (tid->paused) {
-			ath_tx_tid_unsched(sc, tid);
 			continue;
 		}
 		if (ath_tx_ampdu_running(sc, tid->an, tid->tid))
@@ -3525,14 +3526,22 @@ ath_txq_sched(struct ath_softc *sc, stru
 		else
 			ath_tx_tid_hw_queue_norm(sc, tid->an, tid);
 
-		/* Empty? Remove */
-		if (tid->axq_depth == 0)
-			ath_tx_tid_unsched(sc, tid);
+		/* Not empty? Re-schedule */
+		if (tid->axq_depth != 0)
+			ath_tx_tid_sched(sc, tid);
 
 		/* Give the software queue time to aggregate more packets */
 		if (txq->axq_aggr_depth >= sc->sc_hwq_limit) {
 			break;
 		}
+
+		/*
+		 * If this was the last entry on the original list, stop.
+		 * Otherwise nodes that have been rescheduled onto the end
+		 * of the TID FIFO list will just keep being rescheduled.
+		 */
+		if (tid == last)
+			break;
 	}
 }
 



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