Author: adrian
Date: Tue Nov 8 17:08:12 2011
New Revision: 227344
URL: http://svn.freebsd.org/changeset/base/227344
Log:
Migrate the STAILQ lists to TAILQs.
A bunch of the 11n TX aggregation logic wants to traverse lists of buffers
in various ways. In order to provide O(1) behaviour in this instance,
use TAILQs.
This does blow out the memory footprint and CPU cycles slightly for some
of these operations. I may convert some of these back to STAILQs once
the rest of the software transmit queue handling has been stabilised.
Sponsored by: Hobnob, Inc.
Modified:
head/sys/dev/ath/if_ath.c
head/sys/dev/ath/if_ath_sysctl.c
head/sys/dev/ath/if_ath_tx.c
head/sys/dev/ath/if_athvar.h
Modified: head/sys/dev/ath/if_ath.c
==
--- head/sys/dev/ath/if_ath.c Tue Nov 8 15:38:21 2011(r227343)
+++ head/sys/dev/ath/if_ath.c Tue Nov 8 17:08:12 2011(r227344)
@@ -263,7 +263,7 @@ static int ath_bstuck_threshold = 4; /*
SYSCTL_INT(_hw_ath, OID_AUTO, bstuck, CTLFLAG_RW, ath_bstuck_threshold,
0, max missed beacon xmits before chip reset);
-static MALLOC_DEFINE(M_ATHDEV, athdev, ath driver dma buffers);
+MALLOC_DEFINE(M_ATHDEV, athdev, ath driver dma buffers);
#defineHAL_MODE_HT20 (HAL_MODE_11NG_HT20 | HAL_MODE_11NA_HT20)
#defineHAL_MODE_HT40 \
@@ -952,7 +952,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;
}
@@ -1014,8 +1014,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
@@ -1796,14 +1796,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);
}
return bf;
@@ -1849,7 +1849,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;
}
@@ -1860,7 +1860,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,
@@ -1892,7 +1892,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)
@@ -1913,9 +1913,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;
}
@@ -2414,7 +2414,7 @@ ath_beacon_update(struct ieee80211vap *v
static void
ath_txqmove(struct ath_txq *dst, struct ath_txq *src)
{
-