From owner-svn-src-user@FreeBSD.ORG Fri Aug 12 04:06:44 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 EB906106564A; Fri, 12 Aug 2011 04:06:43 +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 D29E48FC12; Fri, 12 Aug 2011 04:06:43 +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 p7C46h50021478; Fri, 12 Aug 2011 04:06:43 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7C46hjE021475; Fri, 12 Aug 2011 04:06:43 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201108120406.p7C46hjE021475@svn.freebsd.org> From: Adrian Chadd Date: Fri, 12 Aug 2011 04:06:43 +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: r224790 - 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, 12 Aug 2011 04:06:44 -0000 Author: adrian Date: Fri Aug 12 04:06:43 2011 New Revision: 224790 URL: http://svn.freebsd.org/changeset/base/224790 Log: Begin fleshing out the cleanup code needed when transitioning from aggregation to non-aggregation on a TID. This will pause the TID scheduling and let hardware-queued packets complete, before restarting the (now non-aggregate) TID. 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 Thu Aug 11 20:34:57 2011 (r224789) +++ user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c Fri Aug 12 04:06:43 2011 (r224790) @@ -1735,6 +1735,7 @@ ath_tx_tid_init(struct ath_softc *sc, st atid->baw_head = atid->baw_tail = 0; atid->paused = 0; atid->sched = 0; + atid->cleanup_inprogress = 0; if (i == IEEE80211_NONQOS_TID) atid->ac = WME_AC_BE; else @@ -1915,6 +1916,57 @@ ath_tx_normal_comp(struct ath_softc *sc, } #endif +#ifdef notyet +/* + * Handle cleanup of aggregate state packets that aren't + * an A-MPDU. + */ +static void +ath_tx_comp_cleanup(struct ath_softc *sc, struct ath_buf *bf) +{ + +} +#endif + +/* + * Performs transmit side cleanup when TID changes from aggregated to + * unaggregated. + * - Discard all retry frames from the s/w queue. + * - Fix the tx completion function for all buffers in s/w queue. + * - Count the number of unacked frames, and let transmit completion + * handle it later. + */ +static void +ath_tx_cleanup(struct ath_softc *sc, struct ath_node *an, int tid) +{ + struct ath_tid *atid = &an->an_tid[tid]; + struct ath_txq *txq = sc->sc_ac2q[atid->ac]; + + ATH_TXQ_LOCK(txq); + + /* + * + Discard retry frames in the queue + * + Fix the completion function to be non-aggregate + */ + + /* Pause the TID */ + + /* + * Calculate what incomplete frames exist, based on + * the current BAW size. Ie, what frames have been + * added to the TX hardware queue for this TID but + * not yet ACKed. + */ + + /* + * If cleanup is required, defer TID scheduling + * until all the HW queued packets have been + * sent. + */ + + ATH_TXQ_UNLOCK(txq); +} + static void ath_tx_set_retry(struct ath_softc *sc, struct ath_buf *bf) { @@ -1995,6 +2047,20 @@ ath_tx_aggr_comp(struct ath_softc *sc, s DPRINTF(sc, ATH_DEBUG_SW_TX, "%s: bf=%p: tid=%d\n", __func__, bf, bf->bf_state.bfs_tid); + + /* + * If a cleanup is in progress, punt to comp_cleanup; + * rather than handling it here. It's thus their + * responsibility to do the BAW update, track the + * incomplete packet count, etc. + */ +#ifdef notyet + if (atid->cleanup_inprogress) { + ath_tx_comp_cleanup(sc, bf); + return; + } +#endif + /* * Don't bother with the retry check if all frames * are being failed (eg during queue deletion.) @@ -2306,11 +2372,12 @@ void ath_addba_stop(struct ieee80211_node *ni, struct ieee80211_tx_ampdu *tap) { struct ath_softc *sc = ni->ni_ic->ic_ifp->if_softc; -#if 0 int tid = WME_AC_TO_TID(tap->txa_ac); struct ath_node *an = ATH_NODE(ni); +#if 0 struct ath_tid *atid = an->an_tid[tid]; #endif DPRINTF(sc, ATH_DEBUG_SW_TX_CTRL, "%s: called\n", __func__); sc->sc_addba_stop(ni, tap); + ath_tx_cleanup(sc, an, tid); } Modified: user/adrian/if_ath_tx/sys/dev/ath/if_athvar.h ============================================================================== --- user/adrian/if_ath_tx/sys/dev/ath/if_athvar.h Thu Aug 11 20:34:57 2011 (r224789) +++ user/adrian/if_ath_tx/sys/dev/ath/if_athvar.h Fri Aug 12 04:06:43 2011 (r224790) @@ -106,6 +106,17 @@ struct ath_tid { int paused; /* >0 if the TID has been paused */ /* + * Is the TID being cleaned up after a transition + * from aggregation to non-aggregation? + * When this is set to 1, this TID will be paused + * and no further traffic will be queued until all + * the hardware packets pending for this TID have been + * TXed/completed; at which point (non-aggregation) + * traffic will resume being TXed. + */ + int cleanup_inprogress; + + /* * The following implements a ring representing * the frames in the current BAW. * To avoid copying the array content each time