From owner-svn-src-head@freebsd.org Sat Dec 3 02:47:43 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1B2AAC63487; Sat, 3 Dec 2016 02:47:43 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C68C19A6; Sat, 3 Dec 2016 02:47:42 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uB32lflw059450; Sat, 3 Dec 2016 02:47:41 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uB32lfin059449; Sat, 3 Dec 2016 02:47:41 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201612030247.uB32lfin059449@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Sat, 3 Dec 2016 02:47:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r309467 - head/sys/dev/ath X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Dec 2016 02:47:43 -0000 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)