mac80211: remove NSS number of 160MHz if not support 160MHz for HE
authorWen Gong <wgong@codeaurora.org>
Tue, 5 Jan 2021 03:08:39 +0000 (11:08 +0800)
committerJohannes Berg <johannes.berg@intel.com>
Thu, 21 Jan 2021 12:45:13 +0000 (13:45 +0100)
When it does not support 160MHz in HE phy capabilities information,
it should not treat the NSS number of 160MHz as a valid number,
otherwise the final NSS will be set to 0.

Signed-off-by: Wen Gong <wgong@codeaurora.org>
Link: https://lore.kernel.org/r/1609816120-9411-2-git-send-email-wgong@codeaurora.org
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/mac80211/vht.c

index c3ca973737742880d4f0d18af0cb0f495250633e..e856f90921375bf4a52651923f9929c98fcbcc3a 100644 (file)
@@ -484,6 +484,7 @@ enum ieee80211_sta_rx_bandwidth ieee80211_sta_cur_vht_bw(struct sta_info *sta)
 void ieee80211_sta_set_rx_nss(struct sta_info *sta)
 {
        u8 ht_rx_nss = 0, vht_rx_nss = 0, he_rx_nss = 0, rx_nss;
+       bool support_160;
 
        /* if we received a notification already don't overwrite it */
        if (sta->sta.rx_nss)
@@ -514,7 +515,13 @@ void ieee80211_sta_set_rx_nss(struct sta_info *sta)
                        }
                }
 
-               he_rx_nss = min(rx_mcs_80, rx_mcs_160);
+               support_160 = he_cap->he_cap_elem.phy_cap_info[0] &
+                             IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_160MHZ_IN_5G;
+
+               if (support_160)
+                       he_rx_nss = min(rx_mcs_80, rx_mcs_160);
+               else
+                       he_rx_nss = rx_mcs_80;
        }
 
        if (sta->sta.ht_cap.ht_supported) {