From owner-svn-src-user@FreeBSD.ORG Fri Sep 23 13:53:29 2011 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6B2BC106566C; Fri, 23 Sep 2011 13:53:29 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4236F8FC0C; Fri, 23 Sep 2011 13:53:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p8NDrT3H074666; Fri, 23 Sep 2011 13:53:29 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p8NDrTVF074664; Fri, 23 Sep 2011 13:53:29 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201109231353.p8NDrTVF074664@svn.freebsd.org> From: Adrian Chadd Date: Fri, 23 Sep 2011 13:53:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225740 - user/adrian/if_ath_tx/sys/dev/ath X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Sep 2011 13:53:29 -0000 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; } }