Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 10 Apr 2012 19:53:27 -0700
From:      Adrian Chadd <adrian@freebsd.org>
To:        freebsd-wireless@freebsd.org
Subject:   [RFC] net80211/ath/iwn: move ni_tx_ampdu to be per-tid, rather than per WME AC
Message-ID:  <CAJ-Vmomx7VkfMgb-muZonehcW4ChGidjVTLKC=0oNxuyj5NSZA@mail.gmail.com>

next in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]
Hi,

This patch changes ni_tx_ampdu to be per-TID rather than per-AC.

It includes:

* changes to net80211 to use the QoS frame TID, rather than
calculating it from the AC (which may have been calculated from the
TID in the first place);
* the one changes to ath(4) to use it;
* a couple of changes to iwn which was using ni_tx_ampdu state.

I'd like to commit this to -HEAD.

Thanks,


Adrian

[-- Attachment #2 --]
Index: sys/net80211/ieee80211_ht.c
===================================================================
--- sys/net80211/ieee80211_ht.c	(revision 234108)
+++ sys/net80211/ieee80211_ht.c	(working copy)
@@ -1023,7 +1023,7 @@
 ieee80211_ht_node_init(struct ieee80211_node *ni)
 {
 	struct ieee80211_tx_ampdu *tap;
-	int ac;
+	int tid;
 
 	if (ni->ni_flags & IEEE80211_NODE_HT) {
 		/*
@@ -1033,9 +1033,10 @@
 		 */
 		ieee80211_ht_node_cleanup(ni);
 	}
-	for (ac = 0; ac < WME_NUM_AC; ac++) {
-		tap = &ni->ni_tx_ampdu[ac];
-		tap->txa_ac = ac;
+	for (tid = 0; tid < WME_NUM_TID; tid++) {
+		tap = &ni->ni_tx_ampdu[tid];
+		tap->txa_ac = TID_TO_WME_AC(tid);
+		tap->txa_tid = tid;
 		tap->txa_ni = ni;
 		/* NB: further initialization deferred */
 	}
@@ -1055,7 +1056,7 @@
 	KASSERT(ni->ni_flags & IEEE80211_NODE_HT, ("not an HT node"));
 
 	/* XXX optimize this */
-	for (i = 0; i < WME_NUM_AC; i++) {
+	for (i = 0; i < WME_NUM_TID; i++) {
 		struct ieee80211_tx_ampdu *tap = &ni->ni_tx_ampdu[i];
 		if (tap->txa_flags & IEEE80211_AGGR_SETUP)
 			ampdu_tx_stop(tap);
@@ -1160,7 +1161,7 @@
 {
 	struct ieee80211vap *vap = ni->ni_vap;
 	struct ieee80211_tx_ampdu *tap;
-	int ac;
+	int tid;
 
 	KASSERT(vap->iv_flags_ht & IEEE80211_FHT_HT, ("no HT requested"));
 
@@ -1198,9 +1199,10 @@
 	ni->ni_htopmode = 0;		/* XXX need protection state */
 	ni->ni_htstbc = 0;		/* XXX need info */
 
-	for (ac = 0; ac < WME_NUM_AC; ac++) {
-		tap = &ni->ni_tx_ampdu[ac];
-		tap->txa_ac = ac;
+	for (tid = 0; tid < WME_NUM_TID; tid++) {
+		tap = &ni->ni_tx_ampdu[tid];
+		tap->txa_ac = TID_TO_WME_AC(tid);
+		tap->txa_tid = tid;
 	}
 	/* NB: AMPDU tx/rx governed by IEEE80211_FHT_AMPDU_{TX,RX} */
 	ni->ni_flags |= IEEE80211_NODE_HT | IEEE80211_NODE_AMPDU;
@@ -1909,7 +1911,7 @@
 	batimeout = LE_READ_2(frm+7);
 
 	ac = TID_TO_WME_AC(tid);
-	tap = &ni->ni_tx_ampdu[ac];
+	tap = &ni->ni_tx_ampdu[tid];
 	if ((tap->txa_flags & IEEE80211_AGGR_XCHGPEND) == 0) {
 		IEEE80211_DISCARD_MAC(vap,
 		    IEEE80211_MSG_ACTION | IEEE80211_MSG_11N,
@@ -1986,7 +1988,7 @@
 
 	if ((baparamset & IEEE80211_DELBAPS_INIT) == 0) {
 		ac = TID_TO_WME_AC(tid);
-		tap = &ni->ni_tx_ampdu[ac];
+		tap = &ni->ni_tx_ampdu[tid];
 		ic->ic_addba_stop(ni, tap);
 	} else {
 		rap = &ni->ni_rx_ampdu[tid];
@@ -2099,7 +2101,7 @@
 	tap->txa_flags &= ~IEEE80211_AGGR_NAK;
 
 	dialogtoken = (tokens+1) % 63;		/* XXX */
-	tid = WME_AC_TO_TID(tap->txa_ac);
+	tid = tap->txa_tid;
 	tap->txa_start = ni->ni_txseqs[tid];
 
 	args[0] = dialogtoken;
@@ -2152,7 +2154,7 @@
 		vap->iv_stats.is_ampdu_stop++;
 
 		ic->ic_addba_stop(ni, tap);
-		args[0] = WME_AC_TO_TID(tap->txa_ac);
+		args[0] = tap->txa_tid;
 		args[1] = IEEE80211_DELBAPS_INIT;
 		args[2] = reason;			/* XXX reason code */
 		ic->ic_send_action(ni, IEEE80211_ACTION_CAT_BA,
@@ -2237,7 +2239,7 @@
 		    tap->txa_start,
 		    IEEE80211_SEQ_ADD(tap->txa_start, tap->txa_wnd-1),
 		    tap->txa_qframes, tap->txa_seqpending,
-		    WME_AC_TO_TID(tap->txa_ac));
+		    tap->txa_tid);
 
 		/* NB: timer already stopped in bar_tx_complete */
 		tap->txa_start = tap->txa_seqpending;
@@ -2292,7 +2294,7 @@
 	IEEE80211_ADDR_COPY(bar->i_ra, ni->ni_macaddr);
 	IEEE80211_ADDR_COPY(bar->i_ta, vap->iv_myaddr);
 
-	tid = WME_AC_TO_TID(tap->txa_ac);
+	tid = tap->txa_tid;
 	barctl 	= (tap->txa_flags & IEEE80211_AGGR_IMMEDIATE ?
 			0 : IEEE80211_BAR_NOACK)
 		| IEEE80211_BAR_COMP
Index: sys/net80211/ieee80211_ht.h
===================================================================
--- sys/net80211/ieee80211_ht.h	(revision 234108)
+++ sys/net80211/ieee80211_ht.h	(working copy)
@@ -45,6 +45,7 @@
 #define	IEEE80211_AGGR_NAK		0x0010	/* peer NAK'd ADDBA request */
 #define	IEEE80211_AGGR_BARPEND		0x0020	/* BAR response pending */
 	uint8_t		txa_ac;
+	uint8_t		txa_tid;
 	uint8_t		txa_token;	/* dialog token */
 	int		txa_lastsample;	/* ticks @ last traffic sample */
 	int		txa_pkts;	/* packets over last sample interval */
Index: sys/net80211/ieee80211_node.h
===================================================================
--- sys/net80211/ieee80211_node.h	(revision 234108)
+++ sys/net80211/ieee80211_node.h	(working copy)
@@ -214,7 +214,7 @@
 	uint8_t			ni_htstbc;	/* HT */
 	uint8_t			ni_chw;		/* negotiated channel width */
 	struct ieee80211_htrateset ni_htrates;	/* negotiated ht rate set */
-	struct ieee80211_tx_ampdu ni_tx_ampdu[WME_NUM_AC];
+	struct ieee80211_tx_ampdu ni_tx_ampdu[WME_NUM_TID];
 	struct ieee80211_rx_ampdu ni_rx_ampdu[WME_NUM_TID];
 
 	/* others */
Index: sys/net80211/ieee80211_output.c
===================================================================
--- sys/net80211/ieee80211_output.c	(revision 234108)
+++ sys/net80211/ieee80211_output.c	(working copy)
@@ -324,7 +324,8 @@
 		    (vap->iv_flags_ht & IEEE80211_FHT_AMPDU_TX) &&
 		    (m->m_flags & M_EAPOL) == 0) {
 			const int ac = M_WME_GETAC(m);
-			struct ieee80211_tx_ampdu *tap = &ni->ni_tx_ampdu[ac];
+			const int tid = WME_AC_TO_TID(ac);
+			struct ieee80211_tx_ampdu *tap = &ni->ni_tx_ampdu[tid];
 
 			ieee80211_txampdu_count_packet(tap);
 			if (IEEE80211_AMPDU_RUNNING(tap)) {
@@ -589,7 +590,7 @@
 	}
 	*(uint16_t *)&wh->i_dur[0] = 0;
 
-	tap = &ni->ni_tx_ampdu[TID_TO_WME_AC(tid)];
+	tap = &ni->ni_tx_ampdu[tid];
 	if (tid != IEEE80211_NONQOS_TID && IEEE80211_AMPDU_RUNNING(tap))
 		m->m_flags |= M_AMPDU_MPDU;
 	else {
Index: sys/net80211/ieee80211_superg.c
===================================================================
--- sys/net80211/ieee80211_superg.c	(revision 234108)
+++ sys/net80211/ieee80211_superg.c	(working copy)
@@ -562,9 +562,11 @@
 	IEEE80211_LOCK(ic);
 	head = sq->head;
 	while ((m = sq->head) != NULL && M_AGE_GET(m) < quanta) {
+		int ac = M_WME_GETAC(m);
+		int tid = WME_AC_TO_TID(ac);
 		/* clear tap ref to frame */
 		ni = (struct ieee80211_node *) m->m_pkthdr.rcvif;
-		tap = &ni->ni_tx_ampdu[M_WME_GETAC(m)];
+		tap = &ni->ni_tx_ampdu[tid];
 		KASSERT(tap->txa_private == m, ("staging queue empty"));
 		tap->txa_private = NULL;
 
@@ -661,6 +663,7 @@
 	struct ieee80211_tx_ampdu *tap;
 	struct mbuf *mstaged;
 	uint32_t txtime, limit;
+	int tid = WME_AC_TO_TID(pri);
 
 	/*
 	 * Check if the supplied frame can be aggregated.
@@ -670,7 +673,7 @@
 	 *     be aggregated with other types of frames when encryption is on?
 	 */
 	IEEE80211_LOCK(ic);
-	tap = &ni->ni_tx_ampdu[pri];
+	tap = &ni->ni_tx_ampdu[tid];
 	mstaged = tap->txa_private;		/* NB: we reuse AMPDU state */
 	ieee80211_txampdu_count_packet(tap);
 
@@ -783,12 +786,13 @@
 	struct ieee80211_superg *sg = ic->ic_superg;
 	struct ieee80211_tx_ampdu *tap;
 	struct mbuf *m, *head;
-	int ac;
+	int tid;
 
 	IEEE80211_LOCK(ic);
 	head = NULL;
-	for (ac = 0; ac < WME_NUM_AC; ac++) {
-		tap = &ni->ni_tx_ampdu[ac];
+	for (tid = 0; tid < WME_NUM_TID; tid++) {
+		int ac = TID_TO_WME_AC(tid);
+		tap = &ni->ni_tx_ampdu[tid];
 		m = tap->txa_private;
 		if (m != NULL) {
 			tap->txa_private = NULL;
Index: sys/net80211/ieee80211_ddb.c
===================================================================
--- sys/net80211/ieee80211_ddb.c	(revision 234108)
+++ sys/net80211/ieee80211_ddb.c	(working copy)
@@ -293,7 +293,7 @@
 		ni->ni_htopmode, ni->ni_htstbc, ni->ni_chw);
 
 	/* XXX ampdu state */
-	for (i = 0; i < WME_NUM_AC; i++)
+	for (i = 0; i < WME_NUM_TID; i++)
 		if (ni->ni_tx_ampdu[i].txa_flags & IEEE80211_AGGR_SETUP)
 			_db_show_txampdu("\t", i, &ni->ni_tx_ampdu[i]);
 	for (i = 0; i < WME_NUM_TID; i++)
Index: sys/modules/wlan/Makefile
===================================================================
--- sys/modules/wlan/Makefile	(revision 234108)
+++ sys/modules/wlan/Makefile	(working copy)
@@ -12,7 +12,7 @@
 	ieee80211_ratectl_none.c ieee80211_regdomain.c \
 	ieee80211_ht.c ieee80211_hwmp.c ieee80211_adhoc.c ieee80211_hostap.c \
 	ieee80211_monitor.c ieee80211_sta.c ieee80211_wds.c ieee80211_ddb.c \
-	ieee80211_tdma.c
+	ieee80211_tdma.c ieee80211_alq.c ieee80211_superg.c
 SRCS+=	bus_if.h device_if.h opt_ddb.h opt_inet.h opt_inet6.h opt_ipx.h \
 	opt_tdma.h opt_wlan.h
 
Index: sys/dev/ath/if_ath_tx.c
===================================================================
--- sys/dev/ath/if_ath_tx.c	(revision 234108)
+++ sys/dev/ath/if_ath_tx.c	(working copy)
@@ -4214,14 +4214,11 @@
 {
 	struct ieee80211_node *ni = &an->an_node;
 	struct ieee80211_tx_ampdu *tap;
-	int ac;
 
 	if (tid == IEEE80211_NONQOS_TID)
 		return NULL;
 
-	ac = TID_TO_WME_AC(tid);
-
-	tap = &ni->ni_tx_ampdu[ac];
+	tap = &ni->ni_tx_ampdu[tid];
 	return tap;
 }
 
Index: sys/dev/iwn/if_iwn.c
===================================================================
--- sys/dev/iwn/if_iwn.c	(revision 234108)
+++ sys/dev/iwn/if_iwn.c	(working copy)
@@ -3309,9 +3309,12 @@
 	}
 	ac = M_WME_GETAC(m);
 
+	/*
+	 * XXX what about the non-QoS TID?
+	 */
 	if (IEEE80211_QOS_HAS_SEQ(wh) &&
-	    IEEE80211_AMPDU_RUNNING(&ni->ni_tx_ampdu[ac])) {
-		struct ieee80211_tx_ampdu *tap = &ni->ni_tx_ampdu[ac];
+	    IEEE80211_AMPDU_RUNNING(&ni->ni_tx_ampdu[tid])) {
+		struct ieee80211_tx_ampdu *tap = &ni->ni_tx_ampdu[tid];
 
 		ring = &sc->txq[*(int *)tap->txa_private];
 		*(uint16_t *)wh->i_seq =
@@ -5612,7 +5615,7 @@
 iwn_ampdu_tx_start(struct ieee80211com *ic, struct ieee80211_node *ni,
     uint8_t tid)
 {
-	struct ieee80211_tx_ampdu *tap = &ni->ni_tx_ampdu[TID_TO_WME_AC(tid)];
+	struct ieee80211_tx_ampdu *tap = &ni->ni_tx_ampdu[tid];
 	struct iwn_softc *sc = ni->ni_ic->ic_ifp->if_softc;
 	struct iwn_ops *ops = &sc->ops;
 	struct iwn_node *wn = (void *)ni;

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAJ-Vmomx7VkfMgb-muZonehcW4ChGidjVTLKC=0oNxuyj5NSZA>