Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 11 Sep 2008 23:27:31 GMT
From:      Sam Leffler <sam@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 149633 for review
Message-ID:  <200809112327.m8BNRV6P046104@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=149633

Change 149633 by sam@sam_ebb on 2008/09/11 23:27:03

	o deal with a pending bar tx when a node is cleaned up
	o pull tx ampdu setup/cleanup work into functions; more
	  stuff will be added later

Affected files ...

.. //depot/projects/vap/sys/net80211/ieee80211_ht.c#51 edit

Differences ...

==== //depot/projects/vap/sys/net80211/ieee80211_ht.c#51 (text+ko) ====

@@ -118,6 +118,8 @@
 	const uint8_t *frm, const uint8_t *efrm);
 static void ieee80211_bar_response(struct ieee80211_node *ni,
 	struct ieee80211_tx_ampdu *tap, int status);
+static void ampdu_tx_stop(struct ieee80211_tx_ampdu *tap);
+static void bar_stop_timer(struct ieee80211_tx_ampdu *tap);
 
 void
 ieee80211_ht_attach(struct ieee80211com *ic)
@@ -821,7 +823,6 @@
 void
 ieee80211_ht_node_cleanup(struct ieee80211_node *ni)
 {
-	struct ieee80211com *ic = ni->ni_ic;
 	int i;
 
 	KASSERT(ni->ni_flags & IEEE80211_NODE_HT, ("not an HT node"));
@@ -829,18 +830,8 @@
 	/* XXX optimize this */
 	for (i = 0; i < WME_NUM_AC; i++) {
 		struct ieee80211_tx_ampdu *tap = &ni->ni_tx_ampdu[i];
-		if (tap->txa_flags & IEEE80211_AGGR_SETUP) {
-			/*
-			 * Stop BA stream if setup so driver has a chance
-			 * to reclaim any resources it might have allocated.
-			 */
-			ic->ic_addba_stop(ni, tap);
-			tap->txa_lastsample = 0;
-			tap->txa_avgpps = 0;
-			/* NB: clearing NAK means we may re-send ADDBA */ 
-			tap->txa_flags &=
-			    ~(IEEE80211_AGGR_SETUP | IEEE80211_AGGR_NAK);
-		}
+		if (tap->txa_flags & IEEE80211_AGGR_SETUP)
+			ampdu_tx_stop(tap);
 	}
 	for (i = 0; i < WME_NUM_TID; i++)
 		ampdu_rx_stop(&ni->ni_rx_ampdu[i]);
@@ -1429,6 +1420,38 @@
 }
 
 static void
+ampdu_tx_setup(struct ieee80211_tx_ampdu *tap)
+{
+	callout_init(&tap->txa_timer, CALLOUT_MPSAFE);
+	tap->txa_flags |= IEEE80211_AGGR_SETUP;
+}
+
+static void
+ampdu_tx_stop(struct ieee80211_tx_ampdu *tap)
+{
+	struct ieee80211_node *ni = tap->txa_ni;
+	struct ieee80211com *ic = ni->ni_ic;
+
+	KASSERT(tap->txa_flags & IEEE80211_AGGR_SETUP,
+	    ("txa_flags 0x%x ac %d", tap->txa_flags, tap->txa_ac));
+
+	/*
+	 * Stop BA stream if setup so driver has a chance
+	 * to reclaim any resources it might have allocated.
+	 */
+	ic->ic_addba_stop(ni, tap);
+	/*
+	 * Stop any pending BAR transmit.
+	 */
+	bar_stop_timer(tap);
+
+	tap->txa_lastsample = 0;
+	tap->txa_avgpps = 0;
+	/* NB: clearing NAK means we may re-send ADDBA */ 
+	tap->txa_flags &= ~(IEEE80211_AGGR_SETUP | IEEE80211_AGGR_NAK);
+}
+
+static void
 addba_timeout(void *arg)
 {
 	struct ieee80211_tx_ampdu *tap = arg;
@@ -1828,8 +1851,7 @@
 	/* XXX locking */
 	if ((tap->txa_flags & IEEE80211_AGGR_SETUP) == 0) {
 		/* do deferred setup of state */
-		callout_init(&tap->txa_timer, CALLOUT_MPSAFE);
-		tap->txa_flags |= IEEE80211_AGGR_SETUP;
+		ampdu_tx_setup(tap);
 	}
 	/* XXX hack for not doing proper locking */
 	tap->txa_flags &= ~IEEE80211_AGGR_NAK;
@@ -1952,7 +1974,6 @@
 		if (status)		/* ACK'd */
 			bar_stop_timer(tap);
 		ic->ic_bar_response(ni, tap, status);
-	} else {
 		/* NB: just let timer expire so we pace requests */
 	}
 }



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