wifi: iwlwifi: mvm: set HE PHY bandwidth according to band
authorJohannes Berg <johannes.berg@intel.com>
Tue, 22 Nov 2022 20:10:37 +0000 (22:10 +0200)
committerGregory Greenman <gregory.greenman@intel.com>
Mon, 28 Nov 2022 15:53:22 +0000 (17:53 +0200)
The bits are reserved on the opposite bands, so we shouldn't
always send them, only the 2G bit on 2.4 GHz and the 5G bits
on 5/6GHz. Fix that.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Link: https://lore.kernel.org/r/20221122220713.0a075d00c796.Ib4cac0b7f90dfadebceceb1e07c8cdfd7a4138f6@changeid
Signed-off-by: Gregory Greenman <gregory.greenman@intel.com>
drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c

index 2b43fff..e83382d 100644 (file)
@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
 /*
- * Copyright (C) 2005-2014, 2018-2021 Intel Corporation
+ * Copyright (C) 2005-2014, 2018-2022 Intel Corporation
  * Copyright (C) 2013-2015 Intel Mobile Communications GmbH
  * Copyright (C) 2016-2017 Intel Deutschland GmbH
  */
@@ -571,10 +571,6 @@ static const struct ieee80211_sband_iftype_data iwl_he_eht_capa[] = {
                                        IEEE80211_HE_MAC_CAP5_UL_2x996_TONE_RU |
                                        IEEE80211_HE_MAC_CAP5_HE_DYNAMIC_SM_PS |
                                        IEEE80211_HE_MAC_CAP5_HT_VHT_TRIG_FRAME_RX,
-                               .phy_cap_info[0] =
-                                       IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_40MHZ_IN_2G |
-                                       IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_40MHZ_80MHZ_IN_5G |
-                                       IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_160MHZ_IN_5G,
                                .phy_cap_info[1] =
                                        IEEE80211_HE_PHY_CAP1_PREAMBLE_PUNC_RX_MASK |
                                        IEEE80211_HE_PHY_CAP1_DEVICE_CLASS_A |
@@ -716,9 +712,6 @@ static const struct ieee80211_sband_iftype_data iwl_he_eht_capa[] = {
                                        IEEE80211_HE_MAC_CAP1_MULTI_TID_AGG_RX_QOS_8,
                                .mac_cap_info[3] =
                                        IEEE80211_HE_MAC_CAP3_OMI_CONTROL,
-                               .phy_cap_info[0] =
-                                       IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_40MHZ_IN_2G |
-                                       IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_40MHZ_80MHZ_IN_5G,
                                .phy_cap_info[1] =
                                        IEEE80211_HE_PHY_CAP1_LDPC_CODING_IN_PAYLOAD,
                                .phy_cap_info[2] =
@@ -874,9 +867,23 @@ iwl_nvm_fixup_sband_iftd(struct iwl_trans *trans,
                iftype_data->he_cap.he_cap_elem.mac_cap_info[3] |=
                        IEEE80211_HE_MAC_CAP3_MAX_AMPDU_LEN_EXP_EXT_3;
 
-       if (is_ap && iwlwifi_mod_params.nvm_file)
+       switch (sband->band) {
+       case NL80211_BAND_2GHZ:
                iftype_data->he_cap.he_cap_elem.phy_cap_info[0] |=
-                       IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_160MHZ_IN_5G;
+                       IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_40MHZ_IN_2G;
+               break;
+       case NL80211_BAND_6GHZ:
+       case NL80211_BAND_5GHZ:
+               iftype_data->he_cap.he_cap_elem.phy_cap_info[0] |=
+                       IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_40MHZ_80MHZ_IN_5G;
+               if (!is_ap || iwlwifi_mod_params.nvm_file)
+                       iftype_data->he_cap.he_cap_elem.phy_cap_info[0] |=
+                               IEEE80211_HE_PHY_CAP0_CHANNEL_WIDTH_SET_160MHZ_IN_5G;
+               break;
+       default:
+               WARN_ON(1);
+               break;
+       }
 
        if ((tx_chains & rx_chains) == ANT_AB) {
                iftype_data->he_cap.he_cap_elem.phy_cap_info[2] |=