Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 13 Jun 2011 06:42:26 +0000 (UTC)
From:      Adrian Chadd <adrian@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-user@freebsd.org
Subject:   svn commit: r223039 - user/adrian/if_ath_tx/sys/dev/ath
Message-ID:  <201106130642.p5D6gQ5T059816@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: adrian
Date: Mon Jun 13 06:42:25 2011
New Revision: 223039
URL: http://svn.freebsd.org/changeset/base/223039

Log:
  Begin fleshing out the AMPDU pending/running logic.
  
  If AMPDU-TX negotiation is pending, packets for that given TID should not
  be transmitted but instead should be queued.
  
  Once the AMPDU-TX request/response has occured, packets should be dequeued.
  
  This is so that the initial negotiated BA start stays valid (hopefully!)
  until the end of the request/response exchange. The transmitter must
  not queue packets with incrementing seqnum's until that ADDBA exchange
  has completed.
  
  Once AMPDU-TX is established, it then doesn't matter if they're sent
  aggregated or not - any seqnum being sent updates the BAW.
  
  If this isn't done, then the sender may TX a packet (say an ARP request)
  between the BA request and BA response. Thus the BA window start negotiated
  as part of the ADDBA exchange doesn't match the seqnum of the first packet
  received after the ADDBA exchange (as the packet in-between has helpfully
  updated it for you), and you end up with a BA window that doesn't match.
  
  This isn't currently important as ampdu TX is still non-functional
  (the ath(4) driver doesn't add sequence numbers and doesn't update
  the BA window); this is just in prepration for that.

Modified:
  user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c

Modified: user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c
==============================================================================
--- user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c	Mon Jun 13 06:38:01 2011	(r223038)
+++ user/adrian/if_ath_tx/sys/dev/ath/if_ath_tx.c	Mon Jun 13 06:42:25 2011	(r223039)
@@ -100,6 +100,13 @@ __FBSDID("$FreeBSD$");
 #include <dev/ath/if_ath_tx.h>
 #include <dev/ath/if_ath_tx_ht.h>
 
+static int ath_tx_ampdu_pending(struct ath_softc *sc, struct ath_node *an,
+    int tid);
+#if 0
+static int ath_tx_ampdu_running(struct ath_softc *sc, struct ath_node *an,
+    int tid);
+#endif
+
 /*
  * Whether to use the 11n rate scenario functions or not
  */
@@ -1529,6 +1536,12 @@ ath_tx_hw_queue(struct ath_softc *sc, st
 	 */
 	for (i = 0; i < IEEE80211_TID_SIZE; i++) {
 		atid = &an->an_tid[i];
+		ATH_NODE_LOCK(an);
+		if (ath_tx_ampdu_pending(sc, an, i)) {
+			ATH_NODE_UNLOCK(an);
+			continue;
+		}
+		ATH_NODE_UNLOCK(an);
 		ath_tx_tid_hw_queue(sc, an, i);
 	}
 }
@@ -1566,8 +1579,7 @@ ath_txq_sched(struct ath_softc *sc)
 		ATH_NODE_UNLOCK(an);
 	}
 	ATH_TXNODE_UNLOCK(sc);
-} 
-
+}
 
 
 /*
@@ -1575,6 +1587,73 @@ ath_txq_sched(struct ath_softc *sc)
  */
 
 /*
+ * Return net80211 TID struct pointer, or NULL for none
+ */
+static struct ieee80211_tx_ampdu *
+ath_tx_get_tx_tid(struct ath_node *an, int tid)
+{
+	struct ieee80211_node *ni = &an->an_node;
+	struct ieee80211_tx_ampdu *tap;
+	int ac;
+
+	if (tid == IEEE80211_NONQOS_TID)
+		return 0;
+
+	ac = TID_TO_WME_AC(tid);
+
+	tap = &ni->ni_tx_ampdu[ac];
+	return tap;
+}
+
+#if 0
+/*
+ * Is AMPDU-TX running?
+ *
+ * The ATH_NODE lock must be held.
+ */
+static int
+ath_tx_ampdu_running(struct ath_softc *sc, struct ath_node *an, int tid)
+{
+	struct ieee80211_tx_ampdu *tap;
+
+	ATH_NODE_LOCK_ASSERT(an);
+
+	tap = ath_tx_get_tx_tid(an, tid);
+	if (tap == NULL)
+		return 0;	/* Not valid; default to not running */
+
+	return (tap->txa_flags & IEEE80211_AGGR_RUNNING);
+}
+#endif
+
+/*
+ * Is AMPDU-TX negotiation pending?
+ *
+ * The ATH_NODE lock must be held.
+ */
+static int
+ath_tx_ampdu_pending(struct ath_softc *sc, struct ath_node *an, int tid)
+{
+	struct ieee80211_tx_ampdu *tap;
+
+	ATH_NODE_LOCK_ASSERT(an);
+
+	tap = ath_tx_get_tx_tid(an, tid);
+	if (tap == NULL)
+		return 0;	/* Not valid; default to not pending */
+
+	return (tap->txa_flags & IEEE80211_AGGR_XCHGPEND);
+}
+
+
+/*
+ * Is AMPDU-TX pending for the given TID?
+ *
+ * The ATH_NODE lock must be held.
+ */
+
+
+/*
  * Method to handle sending an ADDBA request.
  *
  * We tap this so the relevant flags can be set to pause the TID



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