From owner-svn-src-all@freebsd.org Sun Aug 23 21:37:21 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 11F833CC0BC; Sun, 23 Aug 2020 21:37:21 +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 4BZT9r6dpQz4ZBd; Sun, 23 Aug 2020 21:37:20 +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 C6F0FE004; Sun, 23 Aug 2020 21:37:20 +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 07NLbKXO066885; Sun, 23 Aug 2020 21:37:20 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 07NLbKC6066884; Sun, 23 Aug 2020 21:37:20 GMT (envelope-from bz@FreeBSD.org) Message-Id: <202008232137.07NLbKC6066884@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Sun, 23 Aug 2020 21:37:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r364551 - head/sys/net80211 X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: head/sys/net80211 X-SVN-Commit-Revision: 364551 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: Sun, 23 Aug 2020 21:37:21 -0000 Author: bz Date: Sun Aug 23 21:37:20 2020 New Revision: 364551 URL: https://svnweb.freebsd.org/changeset/base/364551 Log: net80211: set_vht_extchan() reverse order to always return best In set_vht_extchan() the checks are performed in the order of VHT20/40/80. That means if a channel has a lower and higheer VHT flag set we would return the lower first. We normally do not set more than one VHT flag so this change is supposed to be a NOP but follows the logical thinking order of returning the best first. Also we nowhere assert a single VHT flag so make sure we'll not be stuck with VHT20 when we could do more. While here add the debugging printfs for VHT160 and VHT80P80 which still need doing once we deal with a driver at that level. Reviewed by: adrian, gnn MFC after: 2 weeks Sponsored by: Rubicon Communications, LLC (d/b/a "Netgate") Differential Revision: https://reviews.freebsd.org/D26088 Modified: head/sys/net80211/ieee80211.c Modified: head/sys/net80211/ieee80211.c ============================================================================== --- head/sys/net80211/ieee80211.c Sun Aug 23 21:35:23 2020 (r364550) +++ head/sys/net80211/ieee80211.c Sun Aug 23 21:37:20 2020 (r364551) @@ -1168,23 +1168,17 @@ set_vht_extchan(struct ieee80211_channel *c) { int i; - if (! IEEE80211_IS_CHAN_VHT(c)) { + if (! IEEE80211_IS_CHAN_VHT(c)) return (0); - } - if (IEEE80211_IS_CHAN_VHT20(c)) { - c->ic_vht_ch_freq1 = c->ic_ieee; - return (1); + if (IEEE80211_IS_CHAN_VHT80P80(c)) { + printf("%s: TODO VHT80+80 channel (ieee=%d, flags=0x%08x)\n", + __func__, c->ic_ieee, c->ic_flags); } - if (IEEE80211_IS_CHAN_VHT40(c)) { - if (IEEE80211_IS_CHAN_HT40U(c)) - c->ic_vht_ch_freq1 = c->ic_ieee + 2; - else if (IEEE80211_IS_CHAN_HT40D(c)) - c->ic_vht_ch_freq1 = c->ic_ieee - 2; - else - return (0); - return (1); + if (IEEE80211_IS_CHAN_VHT160(c)) { + printf("%s: TODO VHT160 channel (ieee=%d, flags=0x%08x)\n", + __func__, c->ic_ieee, c->ic_flags); } if (IEEE80211_IS_CHAN_VHT80(c)) { @@ -1206,6 +1200,21 @@ set_vht_extchan(struct ieee80211_channel *c) } } return (0); + } + + if (IEEE80211_IS_CHAN_VHT40(c)) { + if (IEEE80211_IS_CHAN_HT40U(c)) + c->ic_vht_ch_freq1 = c->ic_ieee + 2; + else if (IEEE80211_IS_CHAN_HT40D(c)) + c->ic_vht_ch_freq1 = c->ic_ieee - 2; + else + return (0); + return (1); + } + + if (IEEE80211_IS_CHAN_VHT20(c)) { + c->ic_vht_ch_freq1 = c->ic_ieee; + return (1); } printf("%s: unknown VHT channel type (ieee=%d, flags=0x%08x)\n",