From owner-svn-src-all@FreeBSD.ORG Tue Aug 14 22:32:21 2012 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7700E106564A; Tue, 14 Aug 2012 22:32:21 +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 56A7A8FC0A; Tue, 14 Aug 2012 22:32:21 +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 q7EMWL2d059951; Tue, 14 Aug 2012 22:32:21 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q7EMWLaq059948; Tue, 14 Aug 2012 22:32:21 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201208142232.q7EMWLaq059948@svn.freebsd.org> From: Adrian Chadd Date: Tue, 14 Aug 2012 22:32:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r239262 - head/sys/dev/ath X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Aug 2012 22:32:21 -0000 Author: adrian Date: Tue Aug 14 22:32:20 2012 New Revision: 239262 URL: http://svn.freebsd.org/changeset/base/239262 Log: Break out the TX completion code into a separate function, so it can be re-used by the upcoming EDMA TX completion code. Make ath_stoptxdma() public, again so the EDMA TX code can use it. Don't check for the TXQ bitmap in the ISR when doing EDMA work as it doesn't apply for EDMA. Modified: head/sys/dev/ath/if_ath.c head/sys/dev/ath/if_ath_misc.h Modified: head/sys/dev/ath/if_ath.c ============================================================================== --- head/sys/dev/ath/if_ath.c Tue Aug 14 22:30:17 2012 (r239261) +++ head/sys/dev/ath/if_ath.c Tue Aug 14 22:32:20 2012 (r239262) @@ -1675,12 +1675,14 @@ ath_intr(void *arg) * and blank them. This is the only place we should be * doing this. */ - ATH_PCU_LOCK(sc); - txqs = 0xffffffff; - ath_hal_gettxintrtxqs(sc->sc_ah, &txqs); - sc->sc_txq_active |= txqs; + if (! sc->sc_isedma) { + ATH_PCU_LOCK(sc); + txqs = 0xffffffff; + ath_hal_gettxintrtxqs(sc->sc_ah, &txqs); + sc->sc_txq_active |= txqs; + ATH_PCU_UNLOCK(sc); + } taskqueue_enqueue(sc->sc_tq, &sc->sc_txtask); - ATH_PCU_UNLOCK(sc); } if (status & HAL_INT_BMISS) { sc->sc_stats.ast_bmiss++; @@ -3582,6 +3584,56 @@ ath_tx_update_busy(struct ath_softc *sc) } /* + * Process the completion of the given buffer. + * + * This calls the rate control update and then the buffer completion. + * This will either free the buffer or requeue it. In any case, the + * bf pointer should be treated as invalid after this function is called. + */ +void +ath_tx_process_buf_completion(struct ath_softc *sc, struct ath_txq *txq, + struct ath_tx_status *ts, struct ath_buf *bf) +{ + struct ieee80211_node *ni = bf->bf_node; + struct ath_node *an = NULL; + + ATH_TXQ_UNLOCK_ASSERT(txq); + + /* If unicast frame, update general statistics */ + if (ni != NULL) { + an = ATH_NODE(ni); + /* update statistics */ + ath_tx_update_stats(sc, ts, bf); + } + + /* + * Call the completion handler. + * The completion handler is responsible for + * calling the rate control code. + * + * Frames with no completion handler get the + * rate control code called here. + */ + if (bf->bf_comp == NULL) { + if ((ts->ts_status & HAL_TXERR_FILT) == 0 && + (bf->bf_state.bfs_txflags & HAL_TXDESC_NOACK) == 0) { + /* + * XXX assume this isn't an aggregate + * frame. + */ + ath_tx_update_ratectrl(sc, ni, + bf->bf_state.bfs_rc, ts, + bf->bf_state.bfs_pktlen, 1, + (ts->ts_status == 0 ? 0 : 1)); + } + ath_tx_default_comp(sc, bf, 0); + } else + bf->bf_comp(sc, bf, 0); +} + + + +/* * Process completed xmit descriptors from the specified queue. * Kick the packet scheduler if needed. This can occur from this * particular task. @@ -3594,7 +3646,6 @@ ath_tx_processq(struct ath_softc *sc, st struct ath_desc *ds; struct ath_tx_status *ts; struct ieee80211_node *ni; - struct ath_node *an; #ifdef IEEE80211_SUPPORT_SUPERG struct ieee80211com *ic = sc->sc_ifp->if_l2com; #endif /* IEEE80211_SUPPORT_SUPERG */ @@ -3666,36 +3717,12 @@ ath_tx_processq(struct ath_softc *sc, st } ATH_TXQ_UNLOCK(txq); - /* If unicast frame, update general statistics */ - if (ni != NULL) { - an = ATH_NODE(ni); - /* update statistics */ - ath_tx_update_stats(sc, ts, bf); - } - /* - * Call the completion handler. - * The completion handler is responsible for - * calling the rate control code. - * - * Frames with no completion handler get the - * rate control code called here. + * Update statistics and call completion */ - if (bf->bf_comp == NULL) { - if ((ts->ts_status & HAL_TXERR_FILT) == 0 && - (bf->bf_state.bfs_txflags & HAL_TXDESC_NOACK) == 0) { - /* - * XXX assume this isn't an aggregate - * frame. - */ - ath_tx_update_ratectrl(sc, ni, - bf->bf_state.bfs_rc, ts, - bf->bf_state.bfs_pktlen, 1, - (ts->ts_status == 0 ? 0 : 1)); - } - ath_tx_default_comp(sc, bf, 0); - } else - bf->bf_comp(sc, bf, 0); + ath_tx_process_buf_completion(sc, txq, ts, bf); + + } #ifdef IEEE80211_SUPPORT_SUPERG /* @@ -4087,7 +4114,7 @@ ath_tx_stopdma(struct ath_softc *sc, str (void) ath_hal_stoptxdma(ah, txq->axq_qnum); } -static int +int ath_stoptxdma(struct ath_softc *sc) { struct ath_hal *ah = sc->sc_ah; Modified: head/sys/dev/ath/if_ath_misc.h ============================================================================== --- head/sys/dev/ath/if_ath_misc.h Tue Aug 14 22:30:17 2012 (r239261) +++ head/sys/dev/ath/if_ath_misc.h Tue Aug 14 22:32:20 2012 (r239262) @@ -102,6 +102,11 @@ extern void ath_tx_draintxq(struct ath_s extern void ath_legacy_tx_drain(struct ath_softc *sc, ATH_RESET_TYPE reset_type); +extern void ath_tx_process_buf_completion(struct ath_softc *sc, + struct ath_txq *txq, struct ath_tx_status *ts, struct ath_buf *bf); + +extern int ath_stoptxdma(struct ath_softc *sc); + /* * This is only here so that the RX proc function can call it. * It's very likely that the "start TX after RX" call should be