mac80211: implement Operating Mode Notification extended NSS support
authorJohannes Berg <johannes.berg@intel.com>
Thu, 26 Mar 2020 13:09:32 +0000 (15:09 +0200)
committerChristian Lamparter <chunkeey@gmail.com>
Fri, 5 Feb 2021 10:39:41 +0000 (11:39 +0100)
Somehow we missed this for a long time, but similar to the extended
NSS support in VHT capabilities, we need to have this in Operating
Mode notification.

Implement it by
 * parsing the 160/80+80 bit there and setting the bandwidth
   appropriately
 * having callers of ieee80211_get_vht_max_nss() pass in the current
   max NSS value as received in the operating mode notification in
   order to modify it appropriately depending on the extended NSS
   bits.

This updates all drivers that use it, i.e. only iwlwifi/mvm.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20200326150855.098483728cfa.I4e8c25d3288441759c2793247197229f0696a37d@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
include/linux/ieee80211.h

index f9b0ebe65f5456f9f70b65101918279025895357..0aa180a0b6d18ca627d6bf615c06f6340d567f66 100644 (file)
@@ -9,7 +9,7 @@
  * Copyright (c) 2006, Michael Wu <flamingice@sourmilk.net>
  * Copyright (c) 2013 - 2014 Intel Mobile Communications GmbH
  * Copyright (c) 2016 - 2017 Intel Deutschland GmbH
- * Copyright (c) 2018 - 2019 Intel Corporation
+ * Copyright (c) 2018 - 2020 Intel Corporation
  */
 
 #ifndef __LINUX_IEEE80211_H
@@ -861,6 +861,7 @@ enum ieee80211_ht_chanwidth_values {
  * @IEEE80211_OPMODE_NOTIF_CHANWIDTH_40MHZ: 40 MHz channel width
  * @IEEE80211_OPMODE_NOTIF_CHANWIDTH_80MHZ: 80 MHz channel width
  * @IEEE80211_OPMODE_NOTIF_CHANWIDTH_160MHZ: 160 MHz or 80+80 MHz channel width
+ * @IEEE80211_OPMODE_NOTIF_BW_160_80P80: 160 / 80+80 MHz indicator flag
  * @IEEE80211_OPMODE_NOTIF_RX_NSS_MASK: number of spatial streams mask
  *     (the NSS value is the value of this field + 1)
  * @IEEE80211_OPMODE_NOTIF_RX_NSS_SHIFT: number of spatial streams shift
@@ -868,11 +869,12 @@ enum ieee80211_ht_chanwidth_values {
  *     using a beamforming steering matrix
  */
 enum ieee80211_vht_opmode_bits {
-       IEEE80211_OPMODE_NOTIF_CHANWIDTH_MASK   = 3,
+       IEEE80211_OPMODE_NOTIF_CHANWIDTH_MASK   = 0x03,
        IEEE80211_OPMODE_NOTIF_CHANWIDTH_20MHZ  = 0,
        IEEE80211_OPMODE_NOTIF_CHANWIDTH_40MHZ  = 1,
        IEEE80211_OPMODE_NOTIF_CHANWIDTH_80MHZ  = 2,
        IEEE80211_OPMODE_NOTIF_CHANWIDTH_160MHZ = 3,
+       IEEE80211_OPMODE_NOTIF_BW_160_80P80     = 0x04,
        IEEE80211_OPMODE_NOTIF_RX_NSS_MASK      = 0x70,
        IEEE80211_OPMODE_NOTIF_RX_NSS_SHIFT     = 4,
        IEEE80211_OPMODE_NOTIF_RX_NSS_TYPE_BF   = 0x80,
@@ -1750,6 +1752,9 @@ struct ieee80211_mu_edca_param_set {
  * @ext_nss_bw_capable: indicates whether or not the local transmitter
  *     (rate scaling algorithm) can deal with the new logic
  *     (dot11VHTExtendedNSSBWCapable)
+ * @max_vht_nss: current maximum NSS as advertised by the STA in
+ *     operating mode notification, can be 0 in which case the
+ *     capability data will be used to derive this (from MCS support)
  *
  * Due to the VHT Extended NSS Bandwidth Support, the maximum NSS can
  * vary for a given BW/MCS. This function parses the data.
@@ -1758,7 +1763,8 @@ struct ieee80211_mu_edca_param_set {
  */
 int ieee80211_get_vht_max_nss(struct ieee80211_vht_cap *cap,
                              enum ieee80211_vht_chanwidth bw,
-                             int mcs, bool ext_nss_bw_capable);
+                             int mcs, bool ext_nss_bw_capable,
+                             unsigned int max_vht_nss);
 
 /* 802.11ax HE MAC capabilities */
 #define IEEE80211_HE_MAC_CAP0_HTC_HE                           0x01