Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 7 Oct 2012 23:45:19 +0000 (UTC)
From:      Adrian Chadd <adrian@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r241336 - head/sys/dev/ath
Message-ID:  <201210072345.q97NjJ0i091562@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: adrian
Date: Sun Oct  7 23:45:19 2012
New Revision: 241336
URL: http://svn.freebsd.org/changeset/base/241336

Log:
  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.

Modified:
  head/sys/dev/ath/if_ath_tx.c
  head/sys/dev/ath/if_ath_tx_ht.c
  head/sys/dev/ath/if_athvar.h

Modified: head/sys/dev/ath/if_ath_tx.c
==============================================================================
--- head/sys/dev/ath/if_ath_tx.c	Sun Oct  7 21:33:04 2012	(r241335)
+++ head/sys/dev/ath/if_ath_tx.c	Sun Oct  7 23:45:19 2012	(r241336)
@@ -2669,7 +2669,7 @@ ath_tx_xmit_aggr(struct ath_softc *sc, s
 
 	/* 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, s
 	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 
 	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 
 		/*
 		 * 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 
 		 * 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 
 	} 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, st
 		/* 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 
 	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
 	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, s
 	/* 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, s
 			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, s
 			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,
 	 * 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,
 	 * + 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_soft
 	 * 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 
 	/* 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 *
 	/* 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_soft
 		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_soft
 			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_soft
 		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"));
 

Modified: head/sys/dev/ath/if_ath_tx_ht.c
==============================================================================
--- head/sys/dev/ath/if_ath_tx_ht.c	Sun Oct  7 21:33:04 2012	(r241335)
+++ head/sys/dev/ath/if_ath_tx_ht.c	Sun Oct  7 23:45:19 2012	(r241336)
@@ -661,7 +661,7 @@ ath_tx_form_aggr(struct ath_softc *sc, s
 	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, s
 		/*
 		 * 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);

Modified: head/sys/dev/ath/if_athvar.h
==============================================================================
--- head/sys/dev/ath/if_athvar.h	Sun Oct  7 21:33:04 2012	(r241335)
+++ head/sys/dev/ath/if_athvar.h	Sun Oct  7 23:45:19 2012	(r241336)
@@ -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 */



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201210072345.q97NjJ0i091562>