Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 3 Dec 2016 02:47:41 +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: r309467 - head/sys/dev/ath
Message-ID:  <201612030247.uB32lfin059449@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: adrian
Date: Sat Dec  3 02:47:41 2016
New Revision: 309467
URL: https://svnweb.freebsd.org/changeset/base/309467

Log:
  [ath] use the correct AMPDU frame limit for the given node, rather than the global config.
  
  This is important in hostap, ibss, (11s at some magical future date, etc)
  where different nodes may have smaller limits.
  
  Oops!
  
  MFC after:	1 week
  Relnotes:	Yes

Modified:
  head/sys/dev/ath/if_ath_tx_ht.c

Modified: head/sys/dev/ath/if_ath_tx_ht.c
==============================================================================
--- head/sys/dev/ath/if_ath_tx_ht.c	Sat Dec  3 02:47:16 2016	(r309466)
+++ head/sys/dev/ath/if_ath_tx_ht.c	Sat Dec  3 02:47:41 2016	(r309467)
@@ -529,6 +529,29 @@ ath_compute_num_delims(struct ath_softc 
 }
 
 /*
+ * XXX TODO: put into net80211
+ */
+static int
+ath_rx_ampdu_to_byte(char a)
+{
+	switch (a) {
+	case IEEE80211_HTCAP_MAXRXAMPDU_16K:
+		return 16384;
+		break;
+	case IEEE80211_HTCAP_MAXRXAMPDU_32K:
+		return 32768;
+		break;
+	case IEEE80211_HTCAP_MAXRXAMPDU_64K:
+		return 65536;
+		break;
+	case IEEE80211_HTCAP_MAXRXAMPDU_8K:
+	default:
+		return 8192;
+		break;
+	}
+}
+
+/*
  * Fetch the aggregation limit.
  *
  * It's the lowest of the four rate series 4ms frame length.
@@ -540,6 +563,8 @@ static int
 ath_get_aggr_limit(struct ath_softc *sc, struct ieee80211_node *ni,
     struct ath_buf *bf)
 {
+	struct ieee80211vap *vap = ni->ni_vap;
+
 #define	MS(_v, _f)	(((_v) & _f) >> _f##_S)
 	int amin = ATH_AGGR_MAXSIZE;
 	int i;
@@ -548,25 +573,15 @@ ath_get_aggr_limit(struct ath_softc *sc,
 	if (sc->sc_aggr_limit > 0 && sc->sc_aggr_limit < ATH_AGGR_MAXSIZE)
 		amin = sc->sc_aggr_limit;
 
+	/* Check the vap configured transmit limit */
+	amin = MIN(amin, ath_rx_ampdu_to_byte(vap->iv_ampdu_limit));
+
 	/*
 	 * Check the HTCAP field for the maximum size the node has
 	 * negotiated.  If it's smaller than what we have, cap it there.
 	 */
-	switch (MS(ni->ni_htparam, IEEE80211_HTCAP_MAXRXAMPDU)) {
-	case IEEE80211_HTCAP_MAXRXAMPDU_16K:
-		amin = MIN(amin, 16384);
-		break;
-	case IEEE80211_HTCAP_MAXRXAMPDU_32K:
-		amin = MIN(amin, 32768);
-		break;
-	case IEEE80211_HTCAP_MAXRXAMPDU_64K:
-		amin = MIN(amin, 65536);
-		break;
-	case IEEE80211_HTCAP_MAXRXAMPDU_8K:
-	default:
-		amin = MIN(amin, 8192);
-		break;
-	}
+	amin = MIN(amin, ath_rx_ampdu_to_byte(MS(ni->ni_htparam,
+	    IEEE80211_HTCAP_MAXRXAMPDU)));
 
 	for (i = 0; i < ATH_RC_NUM; i++) {
 		if (bf->bf_state.bfs_rc[i].tries == 0)



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