From owner-svn-src-all@freebsd.org Mon Aug 17 13:04:19 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DF2303B22B0; Mon, 17 Aug 2020 13:04:19 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BVZ4g5bddz4g8x; Mon, 17 Aug 2020 13:04:19 +0000 (UTC) (envelope-from bz@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 A35C12141E; Mon, 17 Aug 2020 13:04:19 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 07HD4JLl065611; Mon, 17 Aug 2020 13:04:19 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07HD4Ieh065607; Mon, 17 Aug 2020 13:04:18 GMT (envelope-from bz@FreeBSD.org) Message-Id: <202008171304.07HD4Ieh065607@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Mon, 17 Aug 2020 13:04:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364303 - in head: sbin/ifconfig sys/net80211 X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: in head: sbin/ifconfig sys/net80211 X-SVN-Commit-Revision: 364303 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.33 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, 17 Aug 2020 13:04:19 -0000 Author: bz Date: Mon Aug 17 13:04:18 2020 New Revision: 364303 URL: https://svnweb.freebsd.org/changeset/base/364303 Log: 80211: consistently order 160 and 80+80 For flags and checks the order goes VHT160 and then VHT80P80 unless checks are in reverse order ("more comes first") in which case we deal with VHT80P80 first. The one reverse order to pick out is where we check channel prefernences. While it may seem that VHT160 is better, finding two "free" channels (VHT 80+80) is more likely so we do prefer that. While dealing with VHT160 and VHT80P80 add extra clauses previously missing or marked TODO in a few places. Reviewed by: adrian, gnn MFC after: 2 weeks Sponsored by: Rubicon Communications, LLC (d/b/a "Netgate") Differential Revision: https://reviews.freebsd.org/D26002 Modified: head/sbin/ifconfig/ifieee80211.c head/sys/net80211/_ieee80211.h head/sys/net80211/ieee80211.c head/sys/net80211/ieee80211_vht.c Modified: head/sbin/ifconfig/ifieee80211.c ============================================================================== --- head/sbin/ifconfig/ifieee80211.c Mon Aug 17 13:02:01 2020 (r364302) +++ head/sbin/ifconfig/ifieee80211.c Mon Aug 17 13:04:18 2020 (r364303) @@ -2176,8 +2176,6 @@ regdomain_addchans(struct ieee80211req_chaninfo *ci, /* * VHT first - HT is a subset. - * - * XXX TODO: VHT80P80, VHT160 is not yet done. */ if (flags & IEEE80211_CHAN_VHT) { if ((chanFlags & IEEE80211_CHAN_VHT20) && @@ -2201,7 +2199,20 @@ regdomain_addchans(struct ieee80211req_chaninfo *ci, "VHT80 channel\n", freq); continue; } - + if ((chanFlags & IEEE80211_CHAN_VHT160) && + (flags & IEEE80211_CHAN_VHT160) == 0) { + if (verbose) + printf("%u: skip, not a " + "VHT160 channel\n", freq); + continue; + } + if ((chanFlags & IEEE80211_CHAN_VHT80P80) && + (flags & IEEE80211_CHAN_VHT80P80) == 0) { + if (verbose) + printf("%u: skip, not a " + "VHT80+80 channel\n", freq); + continue; + } flags &= ~IEEE80211_CHAN_VHT; flags |= chanFlags & IEEE80211_CHAN_VHT; } @@ -3958,8 +3969,11 @@ get_chaninfo(const struct ieee80211_channel *c, int pr if (IEEE80211_IS_CHAN_TURBO(c)) strlcat(buf, " Turbo", bsize); if (precise) { - /* XXX should make VHT80U, VHT80D */ - if (IEEE80211_IS_CHAN_VHT80(c) && + if (IEEE80211_IS_CHAN_VHT80P80(c)) + strlcat(buf, " vht/80p80", bsize); + else if (IEEE80211_IS_CHAN_VHT160(c)) + strlcat(buf, " vht/160", bsize); + else if (IEEE80211_IS_CHAN_VHT80(c) && IEEE80211_IS_CHAN_HT40D(c)) strlcat(buf, " vht/80-", bsize); else if (IEEE80211_IS_CHAN_VHT80(c) && @@ -4013,10 +4027,11 @@ print_chaninfo(const struct ieee80211_channel *c, int static int chanpref(const struct ieee80211_channel *c) { + + if (IEEE80211_IS_CHAN_VHT80P80(c)) + return 90; if (IEEE80211_IS_CHAN_VHT160(c)) return 80; - if (IEEE80211_IS_CHAN_VHT80P80(c)) - return 75; if (IEEE80211_IS_CHAN_VHT80(c)) return 70; if (IEEE80211_IS_CHAN_VHT40(c)) Modified: head/sys/net80211/_ieee80211.h ============================================================================== --- head/sys/net80211/_ieee80211.h Mon Aug 17 13:02:01 2020 (r364302) +++ head/sys/net80211/_ieee80211.h Mon Aug 17 13:04:18 2020 (r364303) @@ -157,7 +157,7 @@ struct ieee80211_channel { /* * Note: for VHT operation we will need significantly more than * IEEE80211_CHAN_MAX channels because of the combinations of - * VHT20, VHT40, VHT80, VHT80+80 and VHT160. + * VHT20, VHT40, VHT80, VHT160, and VHT80+80. */ #define IEEE80211_CHAN_MAX 1024 #define IEEE80211_CHAN_BYTES howmany(IEEE80211_CHAN_MAX, NBBY) @@ -194,8 +194,8 @@ struct ieee80211_channel { #define IEEE80211_CHAN_VHT40U 0x02000000 /* VHT40 channel, ext above */ #define IEEE80211_CHAN_VHT40D 0x04000000 /* VHT40 channel, ext below */ #define IEEE80211_CHAN_VHT80 0x08000000 /* VHT80 channel */ -#define IEEE80211_CHAN_VHT80P80 0x10000000 /* VHT80+80 channel */ -#define IEEE80211_CHAN_VHT160 0x20000000 /* VHT160 channel */ +#define IEEE80211_CHAN_VHT160 0x10000000 /* VHT160 channel */ +#define IEEE80211_CHAN_VHT80P80 0x20000000 /* VHT80+80 channel */ /* XXX note: 0x80000000 is used in src/sbin/ifconfig/ifieee80211.c :( */ #define IEEE80211_CHAN_HT40 (IEEE80211_CHAN_HT40U | IEEE80211_CHAN_HT40D) @@ -203,14 +203,14 @@ struct ieee80211_channel { #define IEEE80211_CHAN_VHT40 (IEEE80211_CHAN_VHT40U | IEEE80211_CHAN_VHT40D) #define IEEE80211_CHAN_VHT (IEEE80211_CHAN_VHT20 | IEEE80211_CHAN_VHT40 \ - | IEEE80211_CHAN_VHT80 | IEEE80211_CHAN_VHT80P80 \ - | IEEE80211_CHAN_VHT160) + | IEEE80211_CHAN_VHT80 | IEEE80211_CHAN_VHT160 \ + | IEEE80211_CHAN_VHT80P80) #define IEEE80211_CHAN_BITS \ "\20\1PRIV0\2PRIV2\3PRIV3\4PRIV4\5TURBO\6CCK\7OFDM\0102GHZ\0115GHZ" \ "\12PASSIVE\13DYN\14GFSK\15GSM\16STURBO\17HALF\20QUARTER\21HT20" \ "\22HT40U\23HT40D\24DFS\0254MSXMIT\26NOADHOC\27NOHOSTAP\03011D" \ - "\031VHT20\032VHT40U\033VHT40D\034VHT80\035VHT80P80\036VHT160" + "\031VHT20\032VHT40U\033VHT40D\034VHT80\035VHT160\036VHT80P80" /* * Useful combinations of channel characteristics. @@ -337,10 +337,10 @@ struct ieee80211_channel { ((_c)->ic_flags & IEEE80211_CHAN_VHT) != 0) #define IEEE80211_IS_CHAN_VHT80(_c) \ (((_c)->ic_flags & IEEE80211_CHAN_VHT80) != 0) -#define IEEE80211_IS_CHAN_VHT80P80(_c) \ - (((_c)->ic_flags & IEEE80211_CHAN_VHT80P80) != 0) #define IEEE80211_IS_CHAN_VHT160(_c) \ (((_c)->ic_flags & IEEE80211_CHAN_VHT160) != 0) +#define IEEE80211_IS_CHAN_VHT80P80(_c) \ + (((_c)->ic_flags & IEEE80211_CHAN_VHT80P80) != 0) #define IEEE80211_CHAN2IEEE(_c) (_c)->ic_ieee Modified: head/sys/net80211/ieee80211.c ============================================================================== --- head/sys/net80211/ieee80211.c Mon Aug 17 13:02:01 2020 (r364302) +++ head/sys/net80211/ieee80211.c Mon Aug 17 13:04:18 2020 (r364303) @@ -1367,8 +1367,8 @@ getflags_5ghz(const uint8_t bands[], uint32_t flags[], IEEE80211_CHAN_HT40D | IEEE80211_CHAN_VHT80; } - /* XXX VHT80+80 */ /* XXX VHT160 */ + /* XXX VHT80+80 */ flags[nmodes] = 0; } @@ -1555,6 +1555,9 @@ add_chanlist(struct ieee80211_channel chans[], int max * check used for (V)HT40. */ is_vht = !! (flags[j] & IEEE80211_CHAN_VHT); + + /* XXX TODO FIXME VHT80P80. */ + /* XXX TODO FIXME VHT160. */ /* * Test for VHT80. Modified: head/sys/net80211/ieee80211_vht.c ============================================================================== --- head/sys/net80211/ieee80211_vht.c Mon Aug 17 13:02:01 2020 (r364302) +++ head/sys/net80211/ieee80211_vht.c Mon Aug 17 13:04:18 2020 (r364303) @@ -211,10 +211,10 @@ ieee80211_vht_announce(struct ieee80211com *ic) /* Channel width */ ic_printf(ic, "[VHT] Channel Widths: 20MHz, 40MHz, 80MHz"); - if (MS(ic->ic_vhtcaps, IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_MASK) == 2) - printf(" 80+80MHz"); if (MS(ic->ic_vhtcaps, IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_MASK) >= 1) printf(" 160MHz"); + if (MS(ic->ic_vhtcaps, IEEE80211_VHTCAP_SUPP_CHAN_WIDTH_MASK) == 2) + printf(" 80+80MHz"); printf("\n"); /* Features */