From owner-svn-src-all@freebsd.org Mon Mar 5 08:17:03 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 69B06F3C375; Mon, 5 Mar 2018 08:17:03 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1C1766A480; Mon, 5 Mar 2018 08:17:03 +0000 (UTC) (envelope-from eadler@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 12BDA2156E; Mon, 5 Mar 2018 08:17:03 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w258H2IA012017; Mon, 5 Mar 2018 08:17:02 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w258H21T012015; Mon, 5 Mar 2018 08:17:02 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201803050817.w258H21T012015@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Mon, 5 Mar 2018 08:17:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r330457 - stable/11/sys/net80211 X-SVN-Group: stable-11 X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: stable/11/sys/net80211 X-SVN-Commit-Revision: 330457 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Mar 2018 08:17:03 -0000 Author: eadler Date: Mon Mar 5 08:17:02 2018 New Revision: 330457 URL: https://svnweb.freebsd.org/changeset/base/330457 Log: MFC r305895: [net80211] add a HT method to populate HTCAP based on IBSS requirements. IBSS negotiation is a subset of the STA/AP negotiation. We always have a current channel, so base the HT capabilities on the current channel. This is then put into IBSS probe requests to inform peers of our 11n capabilities. Modified: stable/11/sys/net80211/ieee80211_ht.c stable/11/sys/net80211/ieee80211_ht.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/net80211/ieee80211_ht.c ============================================================================== --- stable/11/sys/net80211/ieee80211_ht.c Mon Mar 5 08:14:11 2018 (r330456) +++ stable/11/sys/net80211/ieee80211_ht.c Mon Mar 5 08:17:02 2018 (r330457) @@ -2846,6 +2846,96 @@ ieee80211_add_htcap(uint8_t *frm, struct ieee80211_nod } /* + * Non-associated probe request - add HT capabilities based on + * the current channel configuration. + */ +static uint8_t * +ieee80211_add_htcap_body_ch(uint8_t *frm, struct ieee80211vap *vap, + struct ieee80211_channel *c) +{ +#define ADDSHORT(frm, v) do { \ + frm[0] = (v) & 0xff; \ + frm[1] = (v) >> 8; \ + frm += 2; \ +} while (0) + struct ieee80211com *ic = vap->iv_ic; + uint16_t caps, extcaps; + int rxmax, density; + + /* HT capabilities */ + caps = vap->iv_htcaps & 0xffff; + + /* + * We don't use this in STA mode; only in IBSS mode. + * So in IBSS mode we base our HTCAP flags on the + * given channel. + */ + + /* override 20/40 use based on current channel */ + if (IEEE80211_IS_CHAN_HT40(c)) + caps |= IEEE80211_HTCAP_CHWIDTH40; + else + caps &= ~IEEE80211_HTCAP_CHWIDTH40; + + /* Use the currently configured values */ + rxmax = vap->iv_ampdu_rxmax; + density = vap->iv_ampdu_density; + + /* adjust short GI based on channel and config */ + if ((vap->iv_flags_ht & IEEE80211_FHT_SHORTGI20) == 0) + caps &= ~IEEE80211_HTCAP_SHORTGI20; + if ((vap->iv_flags_ht & IEEE80211_FHT_SHORTGI40) == 0 || + (caps & IEEE80211_HTCAP_CHWIDTH40) == 0) + caps &= ~IEEE80211_HTCAP_SHORTGI40; + ADDSHORT(frm, caps); + + /* HT parameters */ + *frm = SM(rxmax, IEEE80211_HTCAP_MAXRXAMPDU) + | SM(density, IEEE80211_HTCAP_MPDUDENSITY) + ; + frm++; + + /* pre-zero remainder of ie */ + memset(frm, 0, sizeof(struct ieee80211_ie_htcap) - + __offsetof(struct ieee80211_ie_htcap, hc_mcsset)); + + /* supported MCS set */ + /* + * XXX: For sta mode the rate set should be restricted based + * on the AP's capabilities, but ni_htrates isn't setup when + * we're called to form an AssocReq frame so for now we're + * restricted to the device capabilities. + */ + ieee80211_set_mcsset(ic, frm); + + frm += __offsetof(struct ieee80211_ie_htcap, hc_extcap) - + __offsetof(struct ieee80211_ie_htcap, hc_mcsset); + + /* HT extended capabilities */ + extcaps = vap->iv_htextcaps & 0xffff; + + ADDSHORT(frm, extcaps); + + frm += sizeof(struct ieee80211_ie_htcap) - + __offsetof(struct ieee80211_ie_htcap, hc_txbf); + + return frm; +#undef ADDSHORT +} + +/* + * Add 802.11n HT capabilities information element + */ +uint8_t * +ieee80211_add_htcap_ch(uint8_t *frm, struct ieee80211vap *vap, + struct ieee80211_channel *c) +{ + frm[0] = IEEE80211_ELEMID_HTCAP; + frm[1] = sizeof(struct ieee80211_ie_htcap) - 2; + return ieee80211_add_htcap_body_ch(frm + 2, vap, c); +} + +/* * Add Broadcom OUI wrapped standard HTCAP ie; this is * used for compatibility w/ pre-draft implementations. */ Modified: stable/11/sys/net80211/ieee80211_ht.h ============================================================================== --- stable/11/sys/net80211/ieee80211_ht.h Mon Mar 5 08:14:11 2018 (r330456) +++ stable/11/sys/net80211/ieee80211_ht.h Mon Mar 5 08:17:02 2018 (r330457) @@ -210,6 +210,8 @@ void ieee80211_ampdu_stop(struct ieee80211_node *, int ieee80211_send_bar(struct ieee80211_node *, struct ieee80211_tx_ampdu *, ieee80211_seq); uint8_t *ieee80211_add_htcap(uint8_t *, struct ieee80211_node *); +uint8_t *ieee80211_add_htcap_ch(uint8_t *, struct ieee80211vap *, + struct ieee80211_channel *); uint8_t *ieee80211_add_htcap_vendor(uint8_t *, struct ieee80211_node *); uint8_t *ieee80211_add_htinfo(uint8_t *, struct ieee80211_node *); uint8_t *ieee80211_add_htinfo_vendor(uint8_t *, struct ieee80211_node *);