2022-05-16 15:08:15

by Maxime Bizon

[permalink] [raw]
Subject: [RFC][PATCH] mac80211: fix VHT 160Mhz bandwidth when using extended NSS on PHY with NSS ratio


A PHY supporting 160Mhz with a reduced number of NSS may not have any
of the IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK bits set.

For exemple, the QCA9984 is 4x4, but can only do 2x2 VHT160 or
80+80. The corresponding VHT capabilities should be:
- IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK == 0
- Extended NSS BW == 2

If we use that hardware in AP mode, and a 160Mhz 2x2 STA without NSS
restriction connects to it, then that STA will set
IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK to 1.

The usual logic of using bitwise-and with our own capabilities does
not work here, the current code clears the SUPP_CHAN_WIDTH bits and
resolve STA bandwidth to 80Mhz instead of 160Mhz, fix this.

Signed-off-by: Maxime Bizon <[email protected]>
---
net/mac80211/vht.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/net/mac80211/vht.c b/net/mac80211/vht.c
index e856f9092137..7ef93adc4f24 100644
--- a/net/mac80211/vht.c
+++ b/net/mac80211/vht.c
@@ -230,9 +230,11 @@ ieee80211_vht_cap_ie_to_sta_vht_cap(struct ieee80211_sub_if_data *sdata,
sizeof(struct ieee80211_vht_mcs_info));

/* copy EXT_NSS_BW Support value or remove the capability */
- if (ieee80211_hw_check(&sdata->local->hw, SUPPORTS_VHT_EXT_NSS_BW))
+ if (ieee80211_hw_check(&sdata->local->hw, SUPPORTS_VHT_EXT_NSS_BW)) {
+ vht_cap->cap |= cap_info &
+ IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK;
vht_cap->cap |= (cap_info & IEEE80211_VHT_CAP_EXT_NSS_BW_MASK);
- else
+ } else
vht_cap->vht_mcs.tx_highest &=
~cpu_to_le16(IEEE80211_VHT_EXT_NSS_BW_CAPABLE);

--
2.17.1




2022-05-16 23:01:20

by Jeff Johnson

[permalink] [raw]
Subject: Re: [RFC][PATCH] mac80211: fix VHT 160Mhz bandwidth when using extended NSS on PHY with NSS ratio

On 5/16/2022 1:39 AM, Maxime Bizon wrote:
>
> A PHY supporting 160Mhz with a reduced number of NSS may not have any

note correct abbreviation is: MHz
and it is suggested to use a space to separate the value from the units

> of the IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK bits set.
>
> For exemple, the QCA9984 is 4x4, but can only do 2x2 VHT160 or

s/exemple/example/

> 80+80. The corresponding VHT capabilities should be:
> - IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK == 0
> - Extended NSS BW == 2
>
> If we use that hardware in AP mode, and a 160Mhz 2x2 STA without NSS
> restriction connects to it, then that STA will set
> IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK to 1.
>
> The usual logic of using bitwise-and with our own capabilities does
> not work here, the current code clears the SUPP_CHAN_WIDTH bits and
> resolve STA bandwidth to 80Mhz instead of 160Mhz, fix this.
>
> Signed-off-by: Maxime Bizon <[email protected]>
> ---
> net/mac80211/vht.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/net/mac80211/vht.c b/net/mac80211/vht.c
> index e856f9092137..7ef93adc4f24 100644
> --- a/net/mac80211/vht.c
> +++ b/net/mac80211/vht.c
> @@ -230,9 +230,11 @@ ieee80211_vht_cap_ie_to_sta_vht_cap(struct ieee80211_sub_if_data *sdata,
> sizeof(struct ieee80211_vht_mcs_info));
>
> /* copy EXT_NSS_BW Support value or remove the capability */
> - if (ieee80211_hw_check(&sdata->local->hw, SUPPORTS_VHT_EXT_NSS_BW))
> + if (ieee80211_hw_check(&sdata->local->hw, SUPPORTS_VHT_EXT_NSS_BW)) {
> + vht_cap->cap |= cap_info &
> + IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK;
> vht_cap->cap |= (cap_info & IEEE80211_VHT_CAP_EXT_NSS_BW_MASK);
> - else
> + } else

per the coding style when you use braces on any leg of if/else, use them
on all legs

> vht_cap->vht_mcs.tx_highest &=
> ~cpu_to_le16(IEEE80211_VHT_EXT_NSS_BW_CAPABLE);
>


2022-08-16 13:56:10

by Tao J

[permalink] [raw]
Subject: Re: [RFC][PATCH] mac80211: fix VHT 160Mhz bandwidth when using extended NSS on PHY with NSS ratio

Applied on 5.19 and worked.

AP: QCA9984
STA:AX201

Before patch:
iw dev wlan-ax201 link
rx bitrate: 866 MBit/s VHT-MCS 9 160MHz short GI VHT-NSS 1
tx bitrate: 866 MBit/s VHT-MCS 9 80MHz short GI VHT-NSS 2

After patch:
rx bitrate: 866 MBit/s VHT-MCS 9 160MHz short GI VHT-NSS 1
tx bitrate: 866 MBit/s VHT-MCS 9 160MHz short GI VHT-NSS 1

Notice that the tx rate did not change and the NSS reduced from 2 to 1.

But actually it should support VHT-NSS 2 and achieve 1733 MBit/s at least
for rx bitrate (verified this with the same AP/STA using another OS,
and iperf showed 1.2GBit/s). Do you have any idea to fix that?
Although it is beyond the scope of this patch.

with iw 5.19 ax201 showed
VHT RX highest supported: 0 Mbps
VHT TX highest supported: 0 Mbps
VHT extended NSS: supported