summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoradrian <adrian@FreeBSD.org>2012-10-07 23:45:19 +0000
committeradrian <adrian@FreeBSD.org>2012-10-07 23:45:19 +0000
commit909d71f7839f908b99ac45c42b2603db8bc39e88 (patch)
treefae3c2dbcd29bf05bcde06c1e86bf4514c82b0a6
parentcfdf328b7d456b26d4044dd7fa503e1f1a10809d (diff)
downloadFreeBSD-src-909d71f7839f908b99ac45c42b2603db8bc39e88.zip
FreeBSD-src-909d71f7839f908b99ac45c42b2603db8bc39e88.tar.gz
Migrate the TID TXQ accesses to a new set of macros, rather than reusing
the ATH_TXQ_* macros. * Introduce the new macros; * rename the TID queue and TID filtered frame queue so the compiler tells me I'm using the wrong macro. These should correspond 1:1 to the existing code.
-rw-r--r--sys/dev/ath/if_ath_tx.c60
-rw-r--r--sys/dev/ath/if_ath_tx_ht.c4
-rw-r--r--sys/dev/ath/if_athvar.h25
3 files changed, 55 insertions, 34 deletions
diff --git a/sys/dev/ath/if_ath_tx.c b/sys/dev/ath/if_ath_tx.c
index e2d48565..13593fc 100644
--- a/sys/dev/ath/if_ath_tx.c
+++ b/sys/dev/ath/if_ath_tx.c
@@ -2669,7 +2669,7 @@ ath_tx_xmit_aggr(struct ath_softc *sc, struct ath_node *an,
/* paused? queue */
if (tid->paused) {
- ATH_TXQ_INSERT_HEAD(tid, bf, bf_list);
+ ATH_TID_INSERT_HEAD(tid, bf, bf_list);
/* XXX don't sched - we're paused! */
return;
}
@@ -2678,7 +2678,7 @@ ath_tx_xmit_aggr(struct ath_softc *sc, struct ath_node *an,
if (bf->bf_state.bfs_dobaw &&
(! BAW_WITHIN(tap->txa_start, tap->txa_wnd,
SEQNO(bf->bf_state.bfs_seqno)))) {
- ATH_TXQ_INSERT_HEAD(tid, bf, bf_list);
+ ATH_TID_INSERT_HEAD(tid, bf, bf_list);
ath_tx_tid_sched(sc, tid);
return;
}
@@ -2777,11 +2777,11 @@ ath_tx_swq(struct ath_softc *sc, struct ieee80211_node *ni, struct ath_txq *txq,
if (atid->paused) {
/* TID is paused, queue */
DPRINTF(sc, ATH_DEBUG_SW_TX, "%s: paused\n", __func__);
- ATH_TXQ_INSERT_TAIL(atid, bf, bf_list);
+ ATH_TID_INSERT_TAIL(atid, bf, bf_list);
} else if (ath_tx_ampdu_pending(sc, an, tid)) {
/* AMPDU pending; queue */
DPRINTF(sc, ATH_DEBUG_SW_TX, "%s: pending\n", __func__);
- ATH_TXQ_INSERT_TAIL(atid, bf, bf_list);
+ ATH_TID_INSERT_TAIL(atid, bf, bf_list);
/* XXX sched? */
} else if (ath_tx_ampdu_running(sc, an, tid)) {
/* AMPDU running, attempt direct dispatch if possible */
@@ -2789,7 +2789,7 @@ ath_tx_swq(struct ath_softc *sc, struct ieee80211_node *ni, struct ath_txq *txq,
/*
* Always queue the frame to the tail of the list.
*/
- ATH_TXQ_INSERT_TAIL(atid, bf, bf_list);
+ ATH_TID_INSERT_TAIL(atid, bf, bf_list);
/*
* If the hardware queue isn't busy, direct dispatch
@@ -2799,8 +2799,8 @@ ath_tx_swq(struct ath_softc *sc, struct ieee80211_node *ni, struct ath_txq *txq,
* Otherwise, schedule the TID.
*/
if (txq->axq_depth < sc->sc_hwq_limit) {
- bf = TAILQ_FIRST(&atid->axq_q);
- ATH_TXQ_REMOVE(atid, bf, bf_list);
+ bf = ATH_TID_FIRST(atid);
+ ATH_TID_REMOVE(atid, bf, bf_list);
/*
* Ensure it's definitely treated as a non-AMPDU
@@ -2831,7 +2831,7 @@ ath_tx_swq(struct ath_softc *sc, struct ieee80211_node *ni, struct ath_txq *txq,
} else {
/* Busy; queue */
DPRINTF(sc, ATH_DEBUG_SW_TX, "%s: swq'ing\n", __func__);
- ATH_TXQ_INSERT_TAIL(atid, bf, bf_list);
+ ATH_TID_INSERT_TAIL(atid, bf, bf_list);
ath_tx_tid_sched(sc, atid);
}
}
@@ -2856,8 +2856,8 @@ ath_tx_tid_init(struct ath_softc *sc, struct ath_node *an)
/* XXX now with this bzer(), is the field 0'ing needed? */
bzero(atid, sizeof(*atid));
- TAILQ_INIT(&atid->axq_q);
- TAILQ_INIT(&atid->filtq.axq_q);
+ TAILQ_INIT(&atid->tid_q);
+ TAILQ_INIT(&atid->filtq.tid_q);
atid->tid = i;
atid->an = an;
for (j = 0; j < ATH_TID_MAX_BUFS; j++)
@@ -2948,7 +2948,7 @@ ath_tx_tid_filt_addbuf(struct ath_softc *sc, struct ath_tid *tid,
ath_tx_set_retry(sc, bf);
sc->sc_stats.ast_tx_swfiltered++;
- ATH_TXQ_INSERT_TAIL(&tid->filtq, bf, bf_list);
+ ATH_TID_INSERT_TAIL(&tid->filtq, bf, bf_list);
}
/*
@@ -2997,9 +2997,9 @@ ath_tx_tid_filt_comp_complete(struct ath_softc *sc, struct ath_tid *tid)
tid->clrdmask = 1;
/* XXX this is really quite inefficient */
- while ((bf = TAILQ_LAST(&tid->filtq.axq_q, ath_bufhead_s)) != NULL) {
- ATH_TXQ_REMOVE(&tid->filtq, bf, bf_list);
- ATH_TXQ_INSERT_HEAD(tid, bf, bf_list);
+ while ((bf = ATH_TID_LAST(&tid->filtq, ath_bufhead_s)) != NULL) {
+ ATH_TID_REMOVE(&tid->filtq, bf, bf_list);
+ ATH_TID_INSERT_HEAD(tid, bf, bf_list);
}
ath_tx_tid_resume(sc, tid);
@@ -3392,7 +3392,7 @@ ath_tx_tid_drain(struct ath_softc *sc, struct ath_node *an,
/* Walk the queue, free frames */
t = 0;
for (;;) {
- bf = TAILQ_FIRST(&tid->axq_q);
+ bf = ATH_TID_FIRST(tid);
if (bf == NULL) {
break;
}
@@ -3402,14 +3402,14 @@ ath_tx_tid_drain(struct ath_softc *sc, struct ath_node *an,
t = 1;
}
- ATH_TXQ_REMOVE(tid, bf, bf_list);
+ ATH_TID_REMOVE(tid, bf, bf_list);
ath_tx_tid_drain_pkt(sc, an, tid, bf_cq, bf);
}
/* And now, drain the filtered frame queue */
t = 0;
for (;;) {
- bf = TAILQ_FIRST(&tid->filtq.axq_q);
+ bf = ATH_TID_FIRST(&tid->filtq);
if (bf == NULL)
break;
@@ -3418,7 +3418,7 @@ ath_tx_tid_drain(struct ath_softc *sc, struct ath_node *an,
t = 1;
}
- ATH_TXQ_REMOVE(&tid->filtq, bf, bf_list);
+ ATH_TID_REMOVE(&tid->filtq, bf, bf_list);
ath_tx_tid_drain_pkt(sc, an, tid, bf_cq, bf);
}
@@ -3668,9 +3668,9 @@ ath_tx_tid_cleanup(struct ath_softc *sc, struct ath_node *an, int tid)
* we run off and discard/process things.
*/
/* XXX this is really quite inefficient */
- while ((bf = TAILQ_LAST(&atid->filtq.axq_q, ath_bufhead_s)) != NULL) {
- ATH_TXQ_REMOVE(&atid->filtq, bf, bf_list);
- ATH_TXQ_INSERT_HEAD(atid, bf, bf_list);
+ while ((bf = ATH_TID_LAST(&atid->filtq, ath_bufhead_s)) != NULL) {
+ ATH_TID_REMOVE(&atid->filtq, bf, bf_list);
+ ATH_TID_INSERT_HEAD(atid, bf, bf_list);
}
/*
@@ -3679,11 +3679,11 @@ ath_tx_tid_cleanup(struct ath_softc *sc, struct ath_node *an, int tid)
* + Discard retry frames in the queue
* + Fix the completion function to be non-aggregate
*/
- bf = TAILQ_FIRST(&atid->axq_q);
+ bf = ATH_TID_FIRST(atid);
while (bf) {
if (bf->bf_state.bfs_isretried) {
bf_next = TAILQ_NEXT(bf, bf_list);
- TAILQ_REMOVE(&atid->axq_q, bf, bf_list);
+ ATH_TID_REMOVE(atid, bf, bf_list);
atid->axq_depth--;
if (bf->bf_state.bfs_dobaw) {
ath_tx_update_baw(sc, an, atid, bf);
@@ -3888,7 +3888,7 @@ ath_tx_aggr_retry_unaggr(struct ath_softc *sc, struct ath_buf *bf)
* Insert this at the head of the queue, so it's
* retried before any current/subsequent frames.
*/
- ATH_TXQ_INSERT_HEAD(atid, bf, bf_list);
+ ATH_TID_INSERT_HEAD(atid, bf, bf_list);
ath_tx_tid_sched(sc, atid);
/* Send the BAR if there are no other frames waiting */
if (ath_tx_tid_bar_tx_ready(sc, atid))
@@ -4017,7 +4017,7 @@ ath_tx_comp_aggr_error(struct ath_softc *sc, struct ath_buf *bf_first,
/* Prepend all frames to the beginning of the queue */
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_TID_INSERT_HEAD(tid, bf, bf_list);
}
/*
@@ -4387,7 +4387,7 @@ ath_tx_aggr_comp_aggr(struct ath_softc *sc, struct ath_buf *bf_first,
/* Prepend all frames to the beginning of the queue */
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_TID_INSERT_HEAD(atid, bf, bf_list);
}
/*
@@ -4665,7 +4665,7 @@ ath_tx_tid_hw_queue_aggr(struct ath_softc *sc, struct ath_node *an,
if (tid->paused)
break;
- bf = TAILQ_FIRST(&tid->axq_q);
+ bf = ATH_TID_FIRST(tid);
if (bf == NULL) {
break;
}
@@ -4678,7 +4678,7 @@ ath_tx_tid_hw_queue_aggr(struct ath_softc *sc, struct ath_node *an,
DPRINTF(sc, ATH_DEBUG_SW_TX_AGGR,
"%s: non-baw packet\n",
__func__);
- ATH_TXQ_REMOVE(tid, bf, bf_list);
+ ATH_TID_REMOVE(tid, bf, bf_list);
if (bf->bf_state.bfs_nframes > 1)
device_printf(sc->sc_dev,
@@ -4868,12 +4868,12 @@ ath_tx_tid_hw_queue_norm(struct ath_softc *sc, struct ath_node *an,
if (tid->paused)
break;
- bf = TAILQ_FIRST(&tid->axq_q);
+ bf = ATH_TID_FIRST(tid);
if (bf == NULL) {
break;
}
- ATH_TXQ_REMOVE(tid, bf, bf_list);
+ ATH_TID_REMOVE(tid, bf, bf_list);
KASSERT(txq == bf->bf_state.bfs_txq, ("txqs not equal!\n"));
diff --git a/sys/dev/ath/if_ath_tx_ht.c b/sys/dev/ath/if_ath_tx_ht.c
index f12ec6e..c12cafe 100644
--- a/sys/dev/ath/if_ath_tx_ht.c
+++ b/sys/dev/ath/if_ath_tx_ht.c
@@ -661,7 +661,7 @@ ath_tx_form_aggr(struct ath_softc *sc, struct ath_node *an,
h_baw = tap->txa_wnd / 2;
for (;;) {
- bf = TAILQ_FIRST(&tid->axq_q);
+ bf = ATH_TID_FIRST(tid);
if (bf_first == NULL)
bf_first = bf;
if (bf == NULL) {
@@ -760,7 +760,7 @@ ath_tx_form_aggr(struct ath_softc *sc, struct ath_node *an,
/*
* this packet is part of an aggregate.
*/
- ATH_TXQ_REMOVE(tid, bf, bf_list);
+ ATH_TID_REMOVE(tid, bf, bf_list);
/* The TID lock is required for the BAW update */
ath_tx_addto_baw(sc, an, tid, bf);
diff --git a/sys/dev/ath/if_athvar.h b/sys/dev/ath/if_athvar.h
index c30533d..ab31f8d 100644
--- a/sys/dev/ath/if_athvar.h
+++ b/sys/dev/ath/if_athvar.h
@@ -99,7 +99,7 @@ struct ath_buf;
* Note that TID 16 (WME_NUM_TID+1) is for handling non-QoS frames.
*/
struct ath_tid {
- TAILQ_HEAD(,ath_buf) axq_q; /* pending buffers */
+ TAILQ_HEAD(,ath_buf) tid_q; /* pending buffers */
u_int axq_depth; /* SW queue depth */
char axq_name[48]; /* lock name */
struct ath_node *an; /* pointer to parent */
@@ -108,7 +108,7 @@ struct ath_tid {
int hwq_depth; /* how many buffers are on HW */
struct {
- TAILQ_HEAD(,ath_buf) axq_q; /* filtered queue */
+ TAILQ_HEAD(,ath_buf) tid_q; /* filtered queue */
u_int axq_depth; /* SW queue depth */
char axq_name[48]; /* lock name */
} filtq;
@@ -355,6 +355,9 @@ struct ath_txq {
#define ATH_TID_UNLOCK_ASSERT(_sc, _tid) \
ATH_TXQ_UNLOCK_ASSERT((_sc)->sc_ac2q[(_tid)->ac])
+/*
+ * These are for the hardware queue.
+ */
#define ATH_TXQ_INSERT_HEAD(_tq, _elm, _field) do { \
TAILQ_INSERT_HEAD(&(_tq)->axq_q, (_elm), _field); \
(_tq)->axq_depth++; \
@@ -370,6 +373,24 @@ struct ath_txq {
#define ATH_TXQ_FIRST(_tq) TAILQ_FIRST(&(_tq)->axq_q)
#define ATH_TXQ_LAST(_tq, _field) TAILQ_LAST(&(_tq)->axq_q, _field)
+/*
+ * These are for the TID software queue and filtered frames queues.
+ */
+#define ATH_TID_INSERT_HEAD(_tq, _elm, _field) do { \
+ TAILQ_INSERT_HEAD(&(_tq)->tid_q, (_elm), _field); \
+ (_tq)->axq_depth++; \
+} while (0)
+#define ATH_TID_INSERT_TAIL(_tq, _elm, _field) do { \
+ TAILQ_INSERT_TAIL(&(_tq)->tid_q, (_elm), _field); \
+ (_tq)->axq_depth++; \
+} while (0)
+#define ATH_TID_REMOVE(_tq, _elm, _field) do { \
+ TAILQ_REMOVE(&(_tq)->tid_q, _elm, _field); \
+ (_tq)->axq_depth--; \
+} while (0)
+#define ATH_TID_FIRST(_tq) TAILQ_FIRST(&(_tq)->tid_q)
+#define ATH_TID_LAST(_tq, _field) TAILQ_LAST(&(_tq)->tid_q, _field)
+
struct ath_vap {
struct ieee80211vap av_vap; /* base class */
int av_bslot; /* beacon slot index */
OpenPOWER on IntegriCloud