From 707210ff0ee4678b32f8022259ee27a33b5d614c Mon Sep 17 00:00:00 2001 From: Adrian Chadd Date: Sat, 3 Dec 2016 02:47:41 +0000 Subject: [PATCH] [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 --- sys/dev/ath/if_ath_tx_ht.c | 45 +++++++++++++++++++++++++------------- 1 file changed, 30 insertions(+), 15 deletions(-) diff --git a/sys/dev/ath/if_ath_tx_ht.c b/sys/dev/ath/if_ath_tx_ht.c index d4b0961f4d9..5226d4d52ad 100644 --- a/sys/dev/ath/if_ath_tx_ht.c +++ b/sys/dev/ath/if_ath_tx_ht.c @@ -528,6 +528,29 @@ ath_compute_num_delims(struct ath_softc *sc, struct ath_buf *first_bf, #undef MS } +/* + * 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. * @@ -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, struct ieee80211_node *ni, 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)