Date: Thu, 18 Aug 2011 16:19:26 +0000 (UTC) From: Adrian Chadd <adrian@FreeBSD.org> To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r224974 - user/adrian/if_ath_tx/sys/dev/ath Message-ID: <201108181619.p7IGJQWb064503@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: adrian Date: Thu Aug 18 16:19:26 2011 New Revision: 224974 URL: http://svn.freebsd.org/changeset/base/224974 Log: As much as I've been wanting to avoid this, convert STAILQ->TAILQ. There's at least one instance where I need to traverse the list in reverse order, and that's impossible with a STAILQ. It also makes TID schedule/unschedule O(1). Modified: user/adrian/if_ath_tx/sys/dev/ath/if_ath.c user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx_ht.c user/adrian/if_ath_tx/sys/dev/ath/if_athvar.h Modified: user/adrian/if_ath_tx/sys/dev/ath/if_ath.c ============================================================================== --- user/adrian/if_ath_tx/sys/dev/ath/if_ath.c Thu Aug 18 16:07:41 2011 (r224973) +++ user/adrian/if_ath_tx/sys/dev/ath/if_ath.c Thu Aug 18 16:19:26 2011 (r224974) @@ -977,7 +977,7 @@ ath_vap_create(struct ieee80211com *ic, /* * Check that a beacon buffer is available; the code below assumes it. */ - if (needbeacon & STAILQ_EMPTY(&sc->sc_bbuf)) { + if (needbeacon & TAILQ_EMPTY(&sc->sc_bbuf)) { device_printf(sc->sc_dev, "no beacon buffer available\n"); goto bad; } @@ -1039,8 +1039,8 @@ ath_vap_create(struct ieee80211com *ic, * multicast frames. We know a beacon buffer is * available because we checked above. */ - avp->av_bcbuf = STAILQ_FIRST(&sc->sc_bbuf); - STAILQ_REMOVE_HEAD(&sc->sc_bbuf, bf_list); + avp->av_bcbuf = TAILQ_FIRST(&sc->sc_bbuf); + TAILQ_REMOVE(&sc->sc_bbuf, avp->av_bcbuf, bf_list); if (opmode != IEEE80211_M_IBSS || !sc->sc_hasveol) { /* * Assign the vap to a beacon xmit slot. As above @@ -1845,14 +1845,14 @@ _ath_getbuf_locked(struct ath_softc *sc) ATH_TXBUF_LOCK_ASSERT(sc); - bf = STAILQ_FIRST(&sc->sc_txbuf); + bf = TAILQ_FIRST(&sc->sc_txbuf); if (bf != NULL && (bf->bf_flags & ATH_BUF_BUSY) == 0) - STAILQ_REMOVE_HEAD(&sc->sc_txbuf, bf_list); + TAILQ_REMOVE(&sc->sc_txbuf, bf, bf_list); else bf = NULL; if (bf == NULL) { DPRINTF(sc, ATH_DEBUG_XMIT, "%s: %s\n", __func__, - STAILQ_FIRST(&sc->sc_txbuf) == NULL ? + TAILQ_FIRST(&sc->sc_txbuf) == NULL ? "out of xmit buffers" : "xmit buffer busy"); } bf->bf_next = NULL; /* XXX just to be sure */ @@ -1899,7 +1899,7 @@ ath_start(struct ifnet *ifp) IFQ_DEQUEUE(&ifp->if_snd, m); if (m == NULL) { ATH_TXBUF_LOCK(sc); - STAILQ_INSERT_HEAD(&sc->sc_txbuf, bf, bf_list); + TAILQ_INSERT_HEAD(&sc->sc_txbuf, bf, bf_list); ATH_TXBUF_UNLOCK(sc); break; } @@ -1910,7 +1910,7 @@ ath_start(struct ifnet *ifp) * buffers to send all the fragments so all * go out or none... */ - STAILQ_INIT(&frags); + TAILQ_INIT(&frags); if ((m->m_flags & M_FRAG) && !ath_txfrag_setup(sc, &frags, m, ni)) { DPRINTF(sc, ATH_DEBUG_XMIT, @@ -1942,7 +1942,7 @@ ath_start(struct ifnet *ifp) bf->bf_m = NULL; bf->bf_node = NULL; ATH_TXBUF_LOCK(sc); - STAILQ_INSERT_HEAD(&sc->sc_txbuf, bf, bf_list); + TAILQ_INSERT_HEAD(&sc->sc_txbuf, bf, bf_list); ath_txfrag_cleanup(sc, &frags, ni); ATH_TXBUF_UNLOCK(sc); if (ni != NULL) @@ -1963,9 +1963,9 @@ ath_start(struct ifnet *ifp) goto reclaim; } m = next; - bf = STAILQ_FIRST(&frags); + bf = TAILQ_FIRST(&frags); KASSERT(bf != NULL, ("no buf for txfrag")); - STAILQ_REMOVE_HEAD(&frags, bf_list); + TAILQ_REMOVE(&frags, bf, bf_list); goto nextfrag; } @@ -2468,7 +2468,7 @@ ath_beacon_update(struct ieee80211vap *v static void ath_txqmove(struct ath_txq *dst, struct ath_txq *src) { - STAILQ_CONCAT(&dst->axq_q, &src->axq_q); + TAILQ_CONCAT(&dst->axq_q, &src->axq_q, bf_list); dst->axq_link = src->axq_link; src->axq_link = NULL; dst->axq_depth += src->axq_depth; @@ -2663,7 +2663,7 @@ ath_beacon_generate(struct ath_softc *sc * Move frames from the s/w mcast q to the h/w cab q. * XXX MORE_DATA bit */ - bfm = STAILQ_FIRST(&avp->av_mcastq.axq_q); + bfm = TAILQ_FIRST(&avp->av_mcastq.axq_q); if (cabq->axq_link != NULL) { *cabq->axq_link = bfm->bf_daddr; } else @@ -2752,7 +2752,7 @@ ath_beacon_return(struct ath_softc *sc, ieee80211_free_node(bf->bf_node); bf->bf_node = NULL; } - STAILQ_INSERT_TAIL(&sc->sc_bbuf, bf, bf_list); + TAILQ_INSERT_TAIL(&sc->sc_bbuf, bf, bf_list); } /* @@ -2763,7 +2763,7 @@ ath_beacon_free(struct ath_softc *sc) { struct ath_buf *bf; - STAILQ_FOREACH(bf, &sc->sc_bbuf, bf_list) { + TAILQ_FOREACH(bf, &sc->sc_bbuf, bf_list) { if (bf->bf_m != NULL) { bus_dmamap_unload(sc->sc_dmat, bf->bf_dmamap); m_freem(bf->bf_m); @@ -3082,7 +3082,7 @@ ath_descdma_setup(struct ath_softc *sc, } dd->dd_bufptr = bf; - STAILQ_INIT(head); + TAILQ_INIT(head); for (i = 0; i < nbuf; i++, bf++, ds += (ndesc * desc_len)) { bf->bf_desc = (struct ath_desc *) ds; bf->bf_daddr = DS2PHYS(dd, ds); @@ -3109,7 +3109,7 @@ ath_descdma_setup(struct ath_softc *sc, return error; } bf->bf_lastds = bf->bf_desc; /* Just an initial value */ - STAILQ_INSERT_TAIL(head, bf, bf_list); + TAILQ_INSERT_TAIL(head, bf, bf_list); } return 0; fail3: @@ -3138,7 +3138,7 @@ ath_descdma_cleanup(struct ath_softc *sc bus_dmamap_destroy(dd->dd_dmat, dd->dd_dmamap); bus_dma_tag_destroy(dd->dd_dmat); - STAILQ_FOREACH(bf, head, bf_list) { + TAILQ_FOREACH(bf, head, bf_list) { if (bf->bf_m) { m_freem(bf->bf_m); bf->bf_m = NULL; @@ -3157,7 +3157,7 @@ ath_descdma_cleanup(struct ath_softc *sc } } - STAILQ_INIT(head); + TAILQ_INIT(head); free(dd->dd_bufptr, M_ATHDEV); memset(dd, 0, sizeof(*dd)); } @@ -3511,7 +3511,7 @@ ath_rx_proc(void *arg, int npending) sc->sc_stats.ast_rx_noise = nf; tsf = ath_hal_gettsf64(ah); do { - bf = STAILQ_FIRST(&sc->sc_rxbuf); + bf = TAILQ_FIRST(&sc->sc_rxbuf); if (sc->sc_rxslink && bf == NULL) { /* NB: shouldn't happen */ if_printf(ifp, "%s: no buffer!\n", __func__); break; @@ -3531,7 +3531,7 @@ ath_rx_proc(void *arg, int npending) */ /* XXX make debug msg */ if_printf(ifp, "%s: no mbuf!\n", __func__); - STAILQ_REMOVE_HEAD(&sc->sc_rxbuf, bf_list); + TAILQ_REMOVE(&sc->sc_rxbuf, bf, bf_list); goto rx_next; } ds = bf->bf_desc; @@ -3561,7 +3561,7 @@ ath_rx_proc(void *arg, int npending) #endif if (status == HAL_EINPROGRESS) break; - STAILQ_REMOVE_HEAD(&sc->sc_rxbuf, bf_list); + TAILQ_REMOVE(&sc->sc_rxbuf, bf, bf_list); /* These aren't specifically errors */ if (rs->rs_flags & HAL_RX_GI) @@ -3828,7 +3828,7 @@ rx_accept: ath_led_event(sc, 0); } rx_next: - STAILQ_INSERT_TAIL(&sc->sc_rxbuf, bf, bf_list); + TAILQ_INSERT_TAIL(&sc->sc_rxbuf, bf, bf_list); } while (ath_rxbuf_init(sc, bf) == 0); /* rx signal state monitoring */ @@ -3877,8 +3877,8 @@ ath_txq_init(struct ath_softc *sc, struc txq->axq_depth = 0; txq->axq_intrcnt = 0; txq->axq_link = NULL; - STAILQ_INIT(&txq->axq_q); - STAILQ_INIT(&txq->axq_tidq); + TAILQ_INIT(&txq->axq_q); + TAILQ_INIT(&txq->axq_tidq); ATH_TXQ_LOCK_INIT(sc, txq); } @@ -4188,7 +4188,7 @@ ath_tx_processq(struct ath_softc *sc, st for (;;) { txq->axq_intrcnt = 0; /* reset periodic desc intr count */ ATH_TXQ_LOCK(txq); - bf = STAILQ_FIRST(&txq->axq_q); + bf = TAILQ_FIRST(&txq->axq_q); if (bf == NULL) { ATH_TXQ_UNLOCK(txq); break; @@ -4206,7 +4206,7 @@ ath_tx_processq(struct ath_softc *sc, st ATH_TXQ_UNLOCK(txq); break; } - ATH_TXQ_REMOVE_HEAD(txq, bf_list); + ATH_TXQ_REMOVE(txq, bf, bf_list); #ifdef IEEE80211_SUPPORT_TDMA if (txq->axq_depth > 0) { /* @@ -4434,7 +4434,7 @@ ath_tx_freebuf(struct ath_softc *sc, str bf->bf_flags &= ~ATH_BUF_BUSY; ATH_TXBUF_LOCK(sc); - STAILQ_INSERT_TAIL(&sc->sc_txbuf, bf, bf_list); + TAILQ_INSERT_TAIL(&sc->sc_txbuf, bf, bf_list); ATH_TXBUF_UNLOCK(sc); } @@ -4452,20 +4452,20 @@ ath_tx_draintxq(struct ath_softc *sc, st * we do not need to block ath_tx_proc */ ATH_TXBUF_LOCK(sc); - bf = STAILQ_LAST(&sc->sc_txbuf, ath_buf, bf_list); + bf = TAILQ_LAST(&sc->sc_txbuf, ath_bufhead_s); if (bf != NULL) bf->bf_flags &= ~ATH_BUF_BUSY; ATH_TXBUF_UNLOCK(sc); for (ix = 0;; ix++) { ATH_TXQ_LOCK(txq); - bf = STAILQ_FIRST(&txq->axq_q); + bf = TAILQ_FIRST(&txq->axq_q); if (bf == NULL) { txq->axq_link = NULL; ATH_TXQ_UNLOCK(txq); break; } - ATH_TXQ_REMOVE_HEAD(txq, bf_list); + ATH_TXQ_REMOVE(txq, bf, bf_list); ATH_TXQ_UNLOCK(txq); #ifdef ATH_DEBUG if (sc->sc_debug & ATH_DEBUG_RESET) { @@ -4530,7 +4530,7 @@ ath_draintxq(struct ath_softc *sc) ath_tx_draintxq(sc, &sc->sc_txq[i]); #ifdef ATH_DEBUG if (sc->sc_debug & ATH_DEBUG_RESET) { - struct ath_buf *bf = STAILQ_FIRST(&sc->sc_bbuf); + struct ath_buf *bf = TAILQ_FIRST(&sc->sc_bbuf); if (bf != NULL && bf->bf_m != NULL) { ath_printtxbuf(sc, bf, sc->sc_bhalq, 0, ath_hal_txprocdesc(ah, bf->bf_desc, @@ -4568,7 +4568,7 @@ ath_stoprecv(struct ath_softc *sc) printf("%s: rx queue %p, link %p\n", __func__, (caddr_t)(uintptr_t) ath_hal_getrxbuf(ah), sc->sc_rxlink); ix = 0; - STAILQ_FOREACH(bf, &sc->sc_rxbuf, bf_list) { + TAILQ_FOREACH(bf, &sc->sc_rxbuf, bf_list) { struct ath_desc *ds = bf->bf_desc; struct ath_rx_status *rs = &bf->bf_status.ds_rxstat; HAL_STATUS status = ath_hal_rxprocdesc(ah, ds, @@ -4598,7 +4598,7 @@ ath_startrecv(struct ath_softc *sc) sc->sc_rxlink = NULL; sc->sc_rxpending = NULL; - STAILQ_FOREACH(bf, &sc->sc_rxbuf, bf_list) { + TAILQ_FOREACH(bf, &sc->sc_rxbuf, bf_list) { int error = ath_rxbuf_init(sc, bf); if (error != 0) { DPRINTF(sc, ATH_DEBUG_RECV, @@ -4608,7 +4608,7 @@ ath_startrecv(struct ath_softc *sc) } } - bf = STAILQ_FIRST(&sc->sc_rxbuf); + bf = TAILQ_FIRST(&sc->sc_rxbuf); ath_hal_putrxbuf(ah, bf->bf_daddr); ath_hal_rxena(ah); /* enable recv descriptors */ ath_mode_init(sc); /* set filters, etc. */ 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 18 16:07:41 2011 (r224973) +++ user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c Thu Aug 18 16:19:26 2011 (r224974) @@ -181,10 +181,10 @@ ath_txfrag_cleanup(struct ath_softc *sc, ATH_TXBUF_LOCK_ASSERT(sc); - STAILQ_FOREACH_SAFE(bf, frags, bf_list, next) { + TAILQ_FOREACH_SAFE(bf, frags, bf_list, next) { /* NB: bf assumed clean */ - STAILQ_REMOVE_HEAD(frags, bf_list); - STAILQ_INSERT_HEAD(&sc->sc_txbuf, bf, bf_list); + TAILQ_REMOVE(frags, bf, bf_list); + TAILQ_INSERT_HEAD(&sc->sc_txbuf, bf, bf_list); ieee80211_node_decref(ni); } } @@ -209,11 +209,11 @@ ath_txfrag_setup(struct ath_softc *sc, a break; } ieee80211_node_incref(ni); - STAILQ_INSERT_TAIL(frags, bf, bf_list); + TAILQ_INSERT_TAIL(frags, bf, bf_list); } ATH_TXBUF_UNLOCK(sc); - return !STAILQ_EMPTY(frags); + return !TAILQ_EMPTY(frags); } /* @@ -453,7 +453,7 @@ ath_tx_handoff_mcast(struct ath_softc *s KASSERT((bf->bf_flags & ATH_BUF_BUSY) == 0, ("%s: busy status 0x%x", __func__, bf->bf_flags)); if (txq->axq_link != NULL) { - struct ath_buf *last = ATH_TXQ_LAST(txq); + struct ath_buf *last = ATH_TXQ_LAST(txq, axq_q_s); struct ieee80211_frame *wh; /* mark previous frame */ @@ -542,7 +542,7 @@ ath_tx_handoff_hw(struct ath_softc *sc, * is/was empty. */ ath_hal_puttxbuf(ah, txq->axq_qnum, - STAILQ_FIRST(&txq->axq_q)->bf_daddr); + TAILQ_FIRST(&txq->axq_q)->bf_daddr); txq->axq_flags &= ~ATH_TXQ_PUTPENDING; DPRINTF(sc, ATH_DEBUG_TDMA | ATH_DEBUG_XMIT, "%s: Q%u restarted\n", __func__, @@ -1608,7 +1608,7 @@ ath_raw_xmit(struct ieee80211_node *ni, return 0; bad2: ATH_TXBUF_LOCK(sc); - STAILQ_INSERT_HEAD(&sc->sc_txbuf, bf, bf_list); + TAILQ_INSERT_HEAD(&sc->sc_txbuf, bf, bf_list); ATH_TXBUF_UNLOCK(sc); bad: ifp->if_oerrors++; @@ -1812,7 +1812,7 @@ ath_tx_tid_sched(struct ath_softc *sc, s atid->sched = 1; - STAILQ_INSERT_TAIL(&txq->axq_tidq, atid, axq_qelem); + TAILQ_INSERT_TAIL(&txq->axq_tidq, atid, axq_qelem); } /* @@ -1833,7 +1833,7 @@ ath_tx_tid_unsched(struct ath_softc *sc, return; atid->sched = 0; - STAILQ_REMOVE(&txq->axq_tidq, atid, ath_tid, axq_qelem); + TAILQ_REMOVE(&txq->axq_tidq, atid, axq_qelem); } /* @@ -1961,7 +1961,7 @@ ath_tx_tid_init(struct ath_softc *sc, st for (i = 0; i < IEEE80211_TID_SIZE; i++) { atid = &an->an_tid[i]; - STAILQ_INIT(&atid->axq_q); + TAILQ_INIT(&atid->axq_q); atid->tid = i; atid->an = an; for (j = 0; j < ATH_TID_MAX_BUFS; j++) @@ -2063,7 +2063,7 @@ ath_tx_tid_free_pkts(struct ath_softc *s /* Walk the queue, free frames */ for (;;) { ATH_TXQ_LOCK(atid); - bf = STAILQ_FIRST(&atid->axq_q); + bf = TAILQ_FIRST(&atid->axq_q); if (bf == NULL) { ATH_TXQ_UNLOCK(atid); break; @@ -2077,7 +2077,7 @@ ath_tx_tid_free_pkts(struct ath_softc *s bf->bf_state.bfs_dobaw) ath_tx_update_baw(sc, an, atid, SEQNO(bf->bf_state.bfs_seqno)); - ATH_TXQ_REMOVE_HEAD(atid, bf_list); + ATH_TXQ_REMOVE(atid, bf, bf_list); ATH_TXQ_UNLOCK(atid); ath_tx_freebuf(sc, bf, -1); } @@ -2200,11 +2200,11 @@ ath_tx_cleanup(struct ath_softc *sc, str * + Fix the completion function to be non-aggregate */ ATH_TXQ_LOCK(atid); - bf = STAILQ_FIRST(&atid->axq_q); + bf = TAILQ_FIRST(&atid->axq_q); while (bf) { if (bf->bf_state.bfs_isretried) { - bf_next = STAILQ_NEXT(bf, bf_list); - STAILQ_REMOVE(&atid->axq_q, bf, ath_buf, bf_list); + bf_next = TAILQ_NEXT(bf, bf_list); + TAILQ_REMOVE(&atid->axq_q, bf, bf_list); atid->axq_depth--; if (bf->bf_state.bfs_dobaw) ath_tx_update_baw(sc, an, atid, @@ -2219,7 +2219,7 @@ ath_tx_cleanup(struct ath_softc *sc, str } /* Give these the default completion handler */ bf->bf_comp = ath_tx_normal_comp; - bf = STAILQ_NEXT(bf, bf_list); + bf = TAILQ_NEXT(bf, bf_list); } ATH_TXQ_UNLOCK(atid); @@ -2403,7 +2403,7 @@ ath_tx_retry_subframe(struct ath_softc * ath_tx_set_retry(sc, bf); bf->bf_next = NULL; /* Just to make sure */ - STAILQ_INSERT_TAIL(bf_q, bf, bf_list); + TAILQ_INSERT_TAIL(bf_q, bf, bf_list); return 0; } @@ -2423,7 +2423,7 @@ ath_tx_comp_aggr_error(struct ath_softc tap = ath_tx_get_tx_tid(an, tid->tid); - STAILQ_INIT(&bf_q); + TAILQ_INIT(&bf_q); /* Retry all subframes */ bf = bf_first; @@ -2458,14 +2458,9 @@ ath_tx_comp_aggr_error(struct ath_softc #endif /* Prepend all frames to the beginning of the queue */ - /* - * XXX for now, these are done in reverse order. - * XXX I'll have to convert this into a TAILQ, so it can - * XXX added to by walking in the reverse order. - */ ATH_TXQ_LOCK(tid); - while ((bf = STAILQ_FIRST(&bf_q)) != NULL) { - STAILQ_REMOVE_HEAD(&bf_q, bf_list); + while ((bf = TAILQ_LAST(&bf_q, ath_bufhead_s)) != NULL) { + TAILQ_REMOVE(&bf_q, bf, bf_list); ATH_TXQ_INSERT_HEAD(tid, bf, bf_list); } ATH_TXQ_UNLOCK(tid); @@ -2546,7 +2541,7 @@ ath_tx_aggr_comp_aggr(struct ath_softc * return; } - STAILQ_INIT(&bf_q); + TAILQ_INIT(&bf_q); tap = ath_tx_get_tx_tid(an, tid); /* @@ -2626,14 +2621,9 @@ ath_tx_aggr_comp_aggr(struct ath_softc * #endif /* Prepend all frames to the beginning of the queue */ - /* - * XXX for now, these are done in reverse order. - * XXX I'll have to convert this into a TAILQ, so it can - * XXX added to by walking in the reverse order. - */ ATH_TXQ_LOCK(atid); - while ((bf = STAILQ_FIRST(&bf_q)) != NULL) { - STAILQ_REMOVE_HEAD(&bf_q, bf_list); + while ((bf = TAILQ_LAST(&bf_q, ath_bufhead_s)) != NULL) { + TAILQ_REMOVE(&bf_q, bf, bf_list); ATH_TXQ_INSERT_HEAD(atid, bf, bf_list); } ATH_TXQ_UNLOCK(atid); @@ -2742,7 +2732,7 @@ ath_tx_tid_hw_queue_aggr(struct ath_soft if (atid->paused) break; - bf = STAILQ_FIRST(&atid->axq_q); + bf = TAILQ_FIRST(&atid->axq_q); if (bf == NULL) { ATH_TXQ_UNLOCK(atid); break; @@ -2755,7 +2745,7 @@ ath_tx_tid_hw_queue_aggr(struct ath_soft if (! bf->bf_state.bfs_dobaw) { DPRINTF(sc, ATH_DEBUG_SW_TX_CTRL, "%s: non-baw packet\n", __func__); - ATH_TXQ_REMOVE_HEAD(atid, bf_list); + ATH_TXQ_REMOVE(atid, bf, bf_list); ATH_TXQ_UNLOCK(atid); bf->bf_state.bfs_aggr = 0; /* Ensure the last descriptor link is 0 */ @@ -2771,7 +2761,7 @@ ath_tx_tid_hw_queue_aggr(struct ath_soft ATH_TXQ_UNLOCK(atid); /* Don't lock the TID - ath_tx_form_aggr will lock as needed */ - STAILQ_INIT(&bf_q); + TAILQ_INIT(&bf_q); status = ath_tx_form_aggr(sc, an, atid, &bf_q); DPRINTF(sc, ATH_DEBUG_SW_TX_CTRL, @@ -2780,14 +2770,14 @@ ath_tx_tid_hw_queue_aggr(struct ath_soft /* * No frames to be picked up - out of BAW */ - if (STAILQ_EMPTY(&bf_q)) + if (TAILQ_EMPTY(&bf_q)) break; /* * This assumes that the descriptor list in the ath_bufhead * are already linked together via bf_next pointers. */ - bf = STAILQ_FIRST(&bf_q); + bf = TAILQ_FIRST(&bf_q); /* * If it's the only frame send as non-aggregate @@ -2890,13 +2880,13 @@ ath_tx_tid_hw_queue_norm(struct ath_soft if (atid->paused) break; - bf = STAILQ_FIRST(&atid->axq_q); + bf = TAILQ_FIRST(&atid->axq_q); if (bf == NULL) { ATH_TXQ_UNLOCK(atid); break; } - ATH_TXQ_REMOVE_HEAD(atid, bf_list); + ATH_TXQ_REMOVE(atid, bf, bf_list); ATH_TXQ_UNLOCK(atid); txq = bf->bf_state.bfs_txq; @@ -2939,7 +2929,7 @@ ath_txq_sched(struct ath_softc *sc, stru * or the like. That's a later problem. Just throw * packets at the hardware. */ - STAILQ_FOREACH_SAFE(atid, &txq->axq_tidq, axq_qelem, next) { + TAILQ_FOREACH_SAFE(atid, &txq->axq_tidq, axq_qelem, next) { /* * Suspend paused queues here; they'll be resumed * once the addba completes or times out. Modified: user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx_ht.c ============================================================================== --- user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx_ht.c Thu Aug 18 16:07:41 2011 (r224973) +++ user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx_ht.c Thu Aug 18 16:19:26 2011 (r224974) @@ -354,7 +354,7 @@ ath_tx_form_aggr(struct ath_softc *sc, s for (;;) { ATH_TXQ_LOCK(tid); - bf = STAILQ_FIRST(&tid->axq_q); + bf = TAILQ_FIRST(&tid->axq_q); if (bf_first == NULL) bf_first = bf; if (bf == NULL) { @@ -432,11 +432,11 @@ ath_tx_form_aggr(struct ath_softc *sc, s /* * this packet is part of an aggregate. */ - ATH_TXQ_REMOVE_HEAD(tid, bf_list); + ATH_TXQ_REMOVE(tid, bf, bf_list); ATH_TXQ_UNLOCK(tid); ath_tx_addto_baw(sc, an, tid, bf); - STAILQ_INSERT_TAIL(bf_q, bf, bf_list); + TAILQ_INSERT_TAIL(bf_q, bf, bf_list); nframes ++; /* Completion handler */ 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 18 16:07:41 2011 (r224973) +++ user/adrian/if_ath_tx/sys/dev/ath/if_athvar.h Thu Aug 18 16:19:26 2011 (r224974) @@ -91,7 +91,7 @@ struct ath_buf; * Note that TID 16 (WME_NUM_TID+1) is for handling non-QoS frames. */ struct ath_tid { - STAILQ_HEAD(,ath_buf) axq_q; /* pending buffers */ + TAILQ_HEAD(,ath_buf) axq_q; /* pending buffers */ struct mtx axq_lock; /* lock on q and link */ u_int axq_depth; /* SW queue depth */ char axq_name[48]; /* lock name */ @@ -103,7 +103,7 @@ struct ath_tid { * Entry on the ath_txq; when there's traffic * to send */ - STAILQ_ENTRY(ath_tid) axq_qelem; + TAILQ_ENTRY(ath_tid) axq_qelem; int sched; int paused; /* >0 if the TID has been paused */ @@ -170,7 +170,7 @@ struct ath_node { #define ATH_RSSI(x) ATH_EP_RND(x, HAL_RSSI_EP_MULTIPLIER) struct ath_buf { - STAILQ_ENTRY(ath_buf) bf_list; + TAILQ_ENTRY(ath_buf) bf_list; struct ath_buf * bf_next; /* next buffer in the aggregate */ int bf_nseg; uint16_t bf_txflags; /* tx descriptor flags */ @@ -234,7 +234,7 @@ struct ath_buf { struct ath_rc_series bfs_rc[ATH_RC_NUM]; /* non-11n TX series */ } bf_state; }; -typedef STAILQ_HEAD(, ath_buf) ath_bufhead; +typedef TAILQ_HEAD(ath_bufhead_s, ath_buf) ath_bufhead; #define ATH_BUF_BUSY 0x00000002 /* (tx) desc owned by h/w */ @@ -270,12 +270,12 @@ struct ath_txq { u_int axq_depth; /* queue depth (stat only) */ u_int axq_intrcnt; /* interrupt count */ u_int32_t *axq_link; /* link ptr in last TX desc */ - STAILQ_HEAD(, ath_buf) axq_q; /* transmit queue */ + TAILQ_HEAD(axq_q_s, ath_buf) axq_q; /* transmit queue */ struct mtx axq_lock; /* lock on q and link */ char axq_name[12]; /* e.g. "ath0_txq4" */ /* Per-TID traffic queue for software -> hardware TX */ - STAILQ_HEAD(,ath_tid) axq_tidq; + TAILQ_HEAD(,ath_tid) axq_tidq; }; #define ATH_NODE_LOCK(_an) mtx_lock(&(_an)->an_mtx) @@ -294,21 +294,18 @@ struct ath_txq { #define ATH_TXQ_IS_LOCKED(_tq) mtx_owned(&(_tq)->axq_lock) #define ATH_TXQ_INSERT_HEAD(_tq, _elm, _field) do { \ - STAILQ_INSERT_HEAD(&(_tq)->axq_q, (_elm), _field); \ + TAILQ_INSERT_HEAD(&(_tq)->axq_q, (_elm), _field); \ (_tq)->axq_depth++; \ } while (0) #define ATH_TXQ_INSERT_TAIL(_tq, _elm, _field) do { \ - STAILQ_INSERT_TAIL(&(_tq)->axq_q, (_elm), _field); \ + TAILQ_INSERT_TAIL(&(_tq)->axq_q, (_elm), _field); \ (_tq)->axq_depth++; \ } while (0) -#define ATH_TXQ_REMOVE_HEAD(_tq, _field) do { \ - STAILQ_REMOVE_HEAD(&(_tq)->axq_q, _field); \ +#define ATH_TXQ_REMOVE(_tq, _elm, _field) do { \ + TAILQ_REMOVE(&(_tq)->axq_q, _elm, _field); \ (_tq)->axq_depth--; \ } while (0) -/* NB: this does not do the "head empty check" that STAILQ_LAST does */ -#define ATH_TXQ_LAST(_tq) \ - ((struct ath_buf *)(void *) \ - ((char *)((_tq)->axq_q.stqh_last) - __offsetof(struct ath_buf, bf_list))) +#define ATH_TXQ_LAST(_tq, _field) TAILQ_LAST(&(_tq)->axq_q, _field) struct ath_vap { struct ieee80211vap av_vap; /* base class */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201108181619.p7IGJQWb064503>