Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 12 Aug 2008 17:24:05 GMT
From:      Sam Leffler <sam@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 147250 for review
Message-ID:  <200808121724.m7CHO5C7057312@repoman.freebsd.org>

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

Change 147250 by sam@sam_ebb on 2008/08/12 17:24:00

	o change ampdu rx handling so drivers tag frames as ampdu
	  instead of blindly passing QoS data frames received for
	  an 11n/HT sta through the reorder processing
	o add a new mbuf flag bit for flagging frames that need
	  ampdu reorder handling; this is kept separate from the
	  flag bit that indicates a frame has gone through the
	  reorder buffer so we can identify mistakes (and also
	  because we're going to use these bits in the tx path)

Affected files ...

.. //depot/projects/vap/sys/net80211/ieee80211_adhoc.c#14 edit
.. //depot/projects/vap/sys/net80211/ieee80211_freebsd.h#30 edit
.. //depot/projects/vap/sys/net80211/ieee80211_hostap.c#22 edit
.. //depot/projects/vap/sys/net80211/ieee80211_ht.c#35 edit
.. //depot/projects/vap/sys/net80211/ieee80211_sta.c#12 edit
.. //depot/projects/vap/sys/net80211/ieee80211_wds.c#10 edit

Differences ...

==== //depot/projects/vap/sys/net80211/ieee80211_adhoc.c#14 (text+ko) ====

@@ -262,14 +262,14 @@
 	uint8_t *bssid;
 	uint16_t rxseq;
 
-	if (m->m_flags & M_AMPDU) {
+	if (m->m_flags & M_AMPDU_MPDU) {
 		/*
 		 * Fastpath for A-MPDU reorder q resubmission.  Frames
-		 * w/ M_AMPDU marked have already passed through here
-		 * but were received out of order and been held on the
-		 * reorder queue.  When resubmitted they are marked
-		 * with the M_AMPDU flag and we can bypass most of the
-		 * normal processing.
+		 * w/ M_AMPDU_MPDU marked have already passed through
+		 * here but were received out of order and been held on
+		 * the reorder queue.  When resubmitted they are marked
+		 * with the M_AMPDU_MPDU flag and we can bypass most of
+		 * the normal processing.
 		 */
 		wh = mtod(m, struct ieee80211_frame *);
 		type = IEEE80211_FC0_TYPE_DATA;
@@ -406,16 +406,12 @@
 		/* XXX no power-save support */
 
 		/*
-		 * Handle A-MPDU re-ordering.  The station must be
-		 * associated and negotiated HT.  The frame must be
-		 * a QoS frame (not QoS null data) and not previously
-		 * processed for A-MPDU re-ordering.  If the frame is
-		 * to be processed directly then ieee80211_ampdu_reorder
+		 * Handle A-MPDU re-ordering.  If the frame is to be
+		 * processed directly then ieee80211_ampdu_reorder
 		 * will return 0; otherwise it has consumed the mbuf
 		 * and we should do nothing more with it.
 		 */
-		if ((ni->ni_flags & IEEE80211_NODE_HT) &&
-		    subtype == IEEE80211_FC0_SUBTYPE_QOS &&
+		if ((m->m_flags & M_AMPDU) &&
 		    ieee80211_ampdu_reorder(ni, m) != 0) {
 			m = NULL;
 			goto out;

==== //depot/projects/vap/sys/net80211/ieee80211_freebsd.h#30 (text+ko) ====

@@ -246,13 +246,17 @@
 #define	M_MORE_DATA	M_PROTO5		/* more data frames to follow */
 #define	M_FF		M_PROTO6		/* fast frame */
 #define	M_TXCB		M_PROTO7		/* do tx complete callback */
+#define	M_AMPDU_MPDU	M_PROTO8		/* ok for A-MPDU aggregation */
 #define	M_80211_TX \
-	(M_LINK0|M_WDS|M_EAPOL|M_PWR_SAV|M_MORE_DATA|M_FF|M_TXCB)
+	(M_LINK0|M_WDS|M_EAPOL|M_PWR_SAV|M_MORE_DATA|M_FF|M_TXCB|M_AMPDU_MPDU)
 
 /* rx path usage */
-#define	M_AMPDU		M_PROTO1		/* A-MPDU processing done */
+#define	M_AMPDU		M_PROTO1		/* A-MPDU aggregate */
 #define	M_WEP		M_PROTO2		/* WEP done by hardware */
-#define	M_80211_RX	(M_AMPDU|M_WEP)
+#if 0
+#define M_AMPDU_MPDU	M_PROTO8		/* A-MPDU de-aggregation done */
+#endif
+#define	M_80211_RX	(M_AMPDU|M_WEP|M_AMPDU_MPDU)
 /*
  * Store WME access control bits in the vlan tag.
  * This is safe since it's done after the packet is classified

==== //depot/projects/vap/sys/net80211/ieee80211_hostap.c#22 (text+ko) ====

@@ -429,14 +429,14 @@
 	uint8_t *bssid;
 	uint16_t rxseq;
 
-	if (m->m_flags & M_AMPDU) {
+	if (m->m_flags & M_AMPDU_MPDU) {
 		/*
 		 * Fastpath for A-MPDU reorder q resubmission.  Frames
-		 * w/ M_AMPDU marked have already passed through here
-		 * but were received out of order and been held on the
-		 * reorder queue.  When resubmitted they are marked
-		 * with the M_AMPDU flag and we can bypass most of the
-		 * normal processing.
+		 * w/ M_AMPDU_MPDU marked have already passed through
+		 * here but were received out of order and been held on
+		 * the reorder queue.  When resubmitted they are marked
+		 * with the M_AMPDU_MPDU flag and we can bypass most of
+		 * the normal processing.
 		 */
 		wh = mtod(m, struct ieee80211_frame *);
 		type = IEEE80211_FC0_TYPE_DATA;
@@ -616,16 +616,12 @@
 		}
 
 		/*
-		 * Handle A-MPDU re-ordering.  The station must be
-		 * associated and negotiated HT.  The frame must be
-		 * a QoS frame (not QoS null data) and not previously
-		 * processed for A-MPDU re-ordering.  If the frame is
-		 * to be processed directly then ieee80211_ampdu_reorder
+		 * Handle A-MPDU re-ordering.  If the frame is to be
+		 * processed directly then ieee80211_ampdu_reorder
 		 * will return 0; otherwise it has consumed the mbuf
 		 * and we should do nothing more with it.
 		 */
-		if ((ni->ni_flags & IEEE80211_NODE_HT) &&
-		    subtype == IEEE80211_FC0_SUBTYPE_QOS &&
+		if ((m->m_flags & M_AMPDU) &&
 		    ieee80211_ampdu_reorder(ni, m) != 0) {
 			m = NULL;
 			goto out;

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

@@ -335,14 +335,14 @@
 /*
  * Dispatch a frame from the A-MPDU reorder queue.  The
  * frame is fed back into ieee80211_input marked with an
- * M_AMPDU flag so it doesn't come back to us (it also
+ * M_AMPDU_MPDU flag so it doesn't come back to us (it also
  * permits ieee80211_input to optimize re-processing).
  */
 static __inline void
 ampdu_dispatch(struct ieee80211_node *ni, struct mbuf *m)
 {
-	m->m_flags |= M_AMPDU;	/* bypass normal processing */
-	/* NB: rssi, noise, and rstamp are ignored w/ M_AMPDU set */
+	m->m_flags |= M_AMPDU_MPDU;	/* bypass normal processing */
+	/* NB: rssi, noise, and rstamp are ignored w/ M_AMPDU_MPDU set */
 	(void) ieee80211_input(ni, m, 0, 0, 0);
 }
 
@@ -517,12 +517,19 @@
 	uint8_t tid;
 	int off;
 
+	KASSERT((m->m_flags & (M_AMPDU | M_AMPDU_MPDU)) == M_AMPDU,
+	    ("!a-mpdu or already re-ordered, flags 0x%x", m->m_flags));
 	KASSERT(ni->ni_flags & IEEE80211_NODE_HT, ("not an HT sta"));
 
 	/* NB: m_len known to be sufficient */
 	wh = mtod(m, struct ieee80211_qosframe *);
-	KASSERT(wh->i_fc[0] == IEEE80211_FC0_QOSDATA, ("not QoS data"));
-
+	if (wh->i_fc[0] != IEEE80211_FC0_QOSDATA) {
+		/*
+		 * Not QoS data, shouldn't get here but just
+		 * return it to the caller for processing.
+		 */
+		return PROCESS;
+	}
 	if ((wh->i_fc[1] & IEEE80211_FC1_DIR_MASK) == IEEE80211_FC1_DIR_DSTODS)
 		tid = ((struct ieee80211_qosframe_addr4 *)wh)->i_qos[0];
 	else

==== //depot/projects/vap/sys/net80211/ieee80211_sta.c#12 (text+ko) ====

@@ -494,14 +494,14 @@
 	uint8_t *bssid;
 	uint16_t rxseq;
 
-	if (m->m_flags & M_AMPDU) {
+	if (m->m_flags & M_AMPDU_MPDU) {
 		/*
 		 * Fastpath for A-MPDU reorder q resubmission.  Frames
-		 * w/ M_AMPDU marked have already passed through here
-		 * but were received out of order and been held on the
-		 * reorder queue.  When resubmitted they are marked
-		 * with the M_AMPDU flag and we can bypass most of the
-		 * normal processing.
+		 * w/ M_AMPDU_MPDU marked have already passed through
+		 * here but were received out of order and been held on
+		 * the reorder queue.  When resubmitted they are marked
+		 * with the M_AMPDU_MPDU flag and we can bypass most of
+		 * the normal processing.
 		 */
 		wh = mtod(m, struct ieee80211_frame *);
 		type = IEEE80211_FC0_TYPE_DATA;
@@ -595,16 +595,12 @@
 			goto out;		/* XXX */
 		}
 		/*
-		 * Handle A-MPDU re-ordering.  The station must be
-		 * associated and negotiated HT.  The frame must be
-		 * a QoS frame (not QoS null data) and not previously
-		 * processed for A-MPDU re-ordering.  If the frame is
-		 * to be processed directly then ieee80211_ampdu_reorder
+		 * Handle A-MPDU re-ordering.  If the frame is to be
+		 * processed directly then ieee80211_ampdu_reorder
 		 * will return 0; otherwise it has consumed the mbuf
 		 * and we should do nothing more with it.
 		 */
-		if ((ni->ni_flags & IEEE80211_NODE_HT) &&
-		    subtype == IEEE80211_FC0_SUBTYPE_QOS &&
+		if ((m->m_flags & M_AMPDU) &&
 		    (dir == IEEE80211_FC1_DIR_FROMDS ||
 		     dir == IEEE80211_FC1_DIR_DSTODS) &&
 		    ieee80211_ampdu_reorder(ni, m) != 0) {

==== //depot/projects/vap/sys/net80211/ieee80211_wds.c#10 (text+ko) ====

@@ -468,14 +468,14 @@
 	uint8_t dir, type, subtype, qos;
 	uint16_t rxseq;
 
-	if (m->m_flags & M_AMPDU) {
+	if (m->m_flags & M_AMPDU_MPDU) {
 		/*
 		 * Fastpath for A-MPDU reorder q resubmission.  Frames
-		 * w/ M_AMPDU marked have already passed through here
-		 * but were received out of order and been held on the
-		 * reorder queue.  When resubmitted they are marked
-		 * with the M_AMPDU flag and we can bypass most of the
-		 * normal processing.
+		 * w/ M_AMPDU_MPDU marked have already passed through
+		 * here but were received out of order and been held on
+		 * the reorder queue.  When resubmitted they are marked
+		 * with the M_AMPDU_MPDU flag and we can bypass most of
+		 * the normal processing.
 		 */
 		wh = mtod(m, struct ieee80211_frame *);
 		type = IEEE80211_FC0_TYPE_DATA;
@@ -590,16 +590,12 @@
 		if (!IEEE80211_IS_MULTICAST(wh->i_addr1))
 			ni->ni_inact = ni->ni_inact_reload;
 		/*
-		 * Handle A-MPDU re-ordering.  The station must be
-		 * associated and negotiated HT.  The frame must be
-		 * a QoS frame (not QoS null data) and not previously
-		 * processed for A-MPDU re-ordering.  If the frame is
-		 * to be processed directly then ieee80211_ampdu_reorder
+		 * Handle A-MPDU re-ordering.  If the frame is to be
+		 * processed directly then ieee80211_ampdu_reorder
 		 * will return 0; otherwise it has consumed the mbuf
 		 * and we should do nothing more with it.
 		 */
-		if ((ni->ni_flags & IEEE80211_NODE_HT) &&
-		    subtype == IEEE80211_FC0_SUBTYPE_QOS &&
+		if ((m->m_flags & M_AMPDU) &&
 		    ieee80211_ampdu_reorder(ni, m) != 0) {
 			m = NULL;
 			goto out;



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