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
This commit is contained in:
Bjoern A. Zeeb 2020-08-23 21:37:20 +00:00
parent f0d9c77e52
commit 30fdd33ca3
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=364551

View File

@ -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_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_VHT20(c)) {
c->ic_vht_ch_freq1 = c->ic_ieee;
return (1);
}
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)) {
@ -1208,6 +1202,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",
__func__, c->ic_ieee, c->ic_flags);