From owner-svn-src-user@FreeBSD.ORG Mon Jun 13 13:21:12 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 C4DDB106564A; Mon, 13 Jun 2011 13:21:12 +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 730538FC0C; Mon, 13 Jun 2011 13:21:12 +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 p5DDLCGC076024; Mon, 13 Jun 2011 13:21:12 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p5DDLCNC076020; Mon, 13 Jun 2011 13:21:12 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201106131321.p5DDLCNC076020@svn.freebsd.org> From: Adrian Chadd Date: Mon, 13 Jun 2011 13:21:12 +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: r223045 - 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: Mon, 13 Jun 2011 13:21:12 -0000 Author: adrian Date: Mon Jun 13 13:21:12 2011 New Revision: 223045 URL: http://svn.freebsd.org/changeset/base/223045 Log: Reduce some duplicated code from ath_tx_processq() and the couple other places which unmap, free and call completion handlers for mbufs/ath_bufs. Modified: user/adrian/if_ath_tx/sys/dev/ath/if_ath.c user/adrian/if_ath_tx/sys/dev/ath/if_ath_misc.h user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c Modified: user/adrian/if_ath_tx/sys/dev/ath/if_ath.c ============================================================================== --- user/adrian/if_ath_tx/sys/dev/ath/if_ath.c Mon Jun 13 12:45:19 2011 (r223044) +++ user/adrian/if_ath_tx/sys/dev/ath/if_ath.c Mon Jun 13 13:21:12 2011 (r223045) @@ -3977,27 +3977,6 @@ ath_tx_findrix(const struct ath_softc *s } static void -ath_tx_freebuf(struct ath_softc *sc, struct ath_buf *bf) -{ - struct ath_buf *last; - - bus_dmamap_sync(sc->sc_dmat, bf->bf_dmamap, - BUS_DMASYNC_POSTWRITE); - bus_dmamap_unload(sc->sc_dmat, bf->bf_dmamap); - - m_freem(bf->bf_m); - bf->bf_m = NULL; - bf->bf_node = NULL; - - ATH_TXBUF_LOCK(sc); - last = STAILQ_LAST(&sc->sc_txbuf, ath_buf, bf_list); - if (last != NULL) - last->bf_flags &= ~ATH_BUF_BUSY; - STAILQ_INSERT_TAIL(&sc->sc_txbuf, bf, bf_list); - ATH_TXBUF_UNLOCK(sc); -} - -static void ath_tx_update_stats(struct ath_softc *sc, struct ath_tx_status *ts, struct ath_buf *bf) { @@ -4127,20 +4106,15 @@ ath_tx_processq(struct ath_softc *sc, st } ath_rate_tx_complete(sc, an, bf); } - - /* - * Do any tx complete callback. Note this must - * be done before releasing the node reference. - */ - if (bf->bf_m->m_flags & M_TXCB) - ieee80211_process_callback(ni, bf->bf_m, - (bf->bf_txflags & HAL_TXDESC_NOACK) == 0 ? - ts->ts_status : HAL_TXERR_XRETRY); - ieee80211_free_node(ni); } - - /* Free the mbuf; recycle the ath_buf */ - ath_tx_freebuf(sc, bf); + /* + * Do any tx complete callback. Note this must + * be done before releasing the node reference. + * This will free the node as well. + */ + ath_tx_freebuf(sc, bf, + ((bf->bf_txflags & HAL_TXDESC_NOACK) == 0) ? + ts->ts_status : HAL_TXERR_XRETRY); } #ifdef IEEE80211_SUPPORT_SUPERG /* @@ -4256,7 +4230,7 @@ ath_tx_proc(void *arg, int npending) * It recycles a single ath_buf. */ void -ath_tx_buf_drainone(struct ath_softc *sc, struct ath_buf *bf) +ath_tx_freebuf(struct ath_softc *sc, struct ath_buf *bf, int status) { struct ieee80211_node *ni; @@ -4268,7 +4242,7 @@ ath_tx_buf_drainone(struct ath_softc *sc * Do any callback and reclaim the node reference. */ if (bf->bf_m->m_flags & M_TXCB) - ieee80211_process_callback(ni, bf->bf_m, -1); + ieee80211_process_callback(ni, bf->bf_m, status); ieee80211_free_node(ni); } m_freem(bf->bf_m); @@ -4319,7 +4293,7 @@ ath_tx_draintxq(struct ath_softc *sc, st bf->bf_m->m_len, 0, -1); } #endif /* ATH_DEBUG */ - ath_tx_buf_drainone(sc, bf); + ath_tx_freebuf(sc, bf, -1); } } Modified: user/adrian/if_ath_tx/sys/dev/ath/if_ath_misc.h ============================================================================== --- user/adrian/if_ath_tx/sys/dev/ath/if_ath_misc.h Mon Jun 13 12:45:19 2011 (r223044) +++ user/adrian/if_ath_tx/sys/dev/ath/if_ath_misc.h Mon Jun 13 13:21:12 2011 (r223045) @@ -55,6 +55,7 @@ extern struct ath_buf * _ath_getbuf_lock extern int ath_reset(struct ifnet *); extern void ath_tx_draintxq(struct ath_softc *sc, struct ath_txq *txq); -extern void ath_tx_buf_drainone(struct ath_softc *sc, struct ath_buf *bf); +extern void ath_tx_freebuf(struct ath_softc *sc, struct ath_buf *bf, + int status); #endif 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 Mon Jun 13 12:45:19 2011 (r223044) +++ user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c Mon Jun 13 13:21:12 2011 (r223045) @@ -1410,7 +1410,7 @@ ath_tx_tid_free_pkts(struct ath_softc *s } ATH_TXQ_REMOVE_HEAD(atid, bf_list); ATH_TXQ_UNLOCK(atid); - ath_tx_buf_drainone(sc, bf); + ath_tx_freebuf(sc, bf, -1); } }