mac80211: calculate max RX NSS for EHT mode
authorMordechay Goodstein <mordechay.goodstein@intel.com>
Mon, 14 Feb 2022 16:30:04 +0000 (17:30 +0100)
committerJohannes Berg <johannes.berg@intel.com>
Wed, 16 Feb 2022 14:44:28 +0000 (15:44 +0100)
If the station supports EHT mode, calculate the maximum RX NSS
from EHT station capabilities.

Signed-off-by: Mordechay Goodstein <mordechay.goodstein@intel.com>
Link: https://lore.kernel.org/r/20220214173004.cf61972c8919.I54f5a416f0789bf4eefad04703d941b6755f6dd6@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
net/mac80211/vht.c

index 409d2fd..8f16aa9 100644 (file)
@@ -497,13 +497,24 @@ 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;
+       u8 ht_rx_nss = 0, vht_rx_nss = 0, he_rx_nss = 0, eht_rx_nss = 0, rx_nss;
        bool support_160;
 
        /* if we received a notification already don't overwrite it */
        if (sta->sta.rx_nss)
                return;
 
+       if (sta->sta.eht_cap.has_eht) {
+               int i;
+               const u8 *rx_nss_mcs = (void *)&sta->sta.eht_cap.eht_mcs_nss_supp;
+
+               /* get the max nss for EHT over all possible bandwidths and mcs */
+               for (i = 0; i < sizeof(struct ieee80211_eht_mcs_nss_supp); i++)
+                       eht_rx_nss = max_t(u8, eht_rx_nss,
+                                          u8_get_bits(rx_nss_mcs[i],
+                                                      IEEE80211_EHT_MCS_NSS_RX));
+       }
+
        if (sta->sta.he_cap.has_he) {
                int i;
                u8 rx_mcs_80 = 0, rx_mcs_160 = 0;
@@ -569,6 +580,7 @@ void ieee80211_sta_set_rx_nss(struct sta_info *sta)
 
        rx_nss = max(vht_rx_nss, ht_rx_nss);
        rx_nss = max(he_rx_nss, rx_nss);
+       rx_nss = max(eht_rx_nss, rx_nss);
        sta->sta.rx_nss = max_t(u8, 1, rx_nss);
 }