iwlwifi: advertise broadcast TWT support
authorShaul Triebitz <shaul.triebitz@intel.com>
Thu, 17 Jun 2021 07:08:49 +0000 (10:08 +0300)
committerLuca Coelho <luciano.coelho@intel.com>
Tue, 22 Jun 2021 12:47:02 +0000 (15:47 +0300)
If the firmware supports broadcast TWT (know by TLV),
add the broadcast TWT HE MAC capability.

Signed-off-by: Shaul Triebitz <shaul.triebitz@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210617100544.80fee3171b53.Idfb69643f4044ec26865d023d0c2a1d6466694aa@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
drivers/net/wireless/intel/iwlwifi/fw/file.h
drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c

index f9c5cf5..d189e5d 100644 (file)
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
 /*
- * Copyright (C) 2008-2014, 2018-2020 Intel Corporation
+ * Copyright (C) 2008-2014, 2018-2021 Intel Corporation
  * Copyright (C) 2013-2015 Intel Mobile Communications GmbH
  * Copyright (C) 2016-2017 Intel Deutschland GmbH
  */
@@ -411,6 +411,7 @@ enum iwl_ucode_tlv_capa {
        IWL_UCODE_TLV_CAPA_PROTECTED_TWT                = (__force iwl_ucode_tlv_capa_t)56,
        IWL_UCODE_TLV_CAPA_FW_RESET_HANDSHAKE           = (__force iwl_ucode_tlv_capa_t)57,
        IWL_UCODE_TLV_CAPA_PASSIVE_6GHZ_SCAN            = (__force iwl_ucode_tlv_capa_t)58,
+       IWL_UCODE_TLV_CAPA_BROADCAST_TWT                = (__force iwl_ucode_tlv_capa_t)60,
 
        /* set 2 */
        IWL_UCODE_TLV_CAPA_EXTENDED_DTS_MEASURE         = (__force iwl_ucode_tlv_capa_t)64,
index bff6533..850648e 100644 (file)
@@ -722,7 +722,8 @@ static void
 iwl_nvm_fixup_sband_iftd(struct iwl_trans *trans,
                         struct ieee80211_supported_band *sband,
                         struct ieee80211_sband_iftype_data *iftype_data,
-                        u8 tx_chains, u8 rx_chains)
+                        u8 tx_chains, u8 rx_chains,
+                        const struct iwl_fw *fw)
 {
        bool is_ap = iftype_data->types_mask & BIT(NL80211_IFTYPE_AP);
 
@@ -769,12 +770,17 @@ iwl_nvm_fixup_sband_iftd(struct iwl_trans *trans,
                                IEEE80211_HE_PHY_CAP9_RX_1024_QAM_LESS_THAN_242_TONE_RU;
                break;
        }
+
+       if (fw_has_capa(&fw->ucode_capa, IWL_UCODE_TLV_CAPA_BROADCAST_TWT))
+               iftype_data->he_cap.he_cap_elem.mac_cap_info[2] |=
+                       IEEE80211_HE_MAC_CAP2_BCAST_TWT;
 }
 
 static void iwl_init_he_hw_capab(struct iwl_trans *trans,
                                 struct iwl_nvm_data *data,
                                 struct ieee80211_supported_band *sband,
-                                u8 tx_chains, u8 rx_chains)
+                                u8 tx_chains, u8 rx_chains,
+                                const struct iwl_fw *fw)
 {
        struct ieee80211_sband_iftype_data *iftype_data;
        int i;
@@ -806,7 +812,7 @@ static void iwl_init_he_hw_capab(struct iwl_trans *trans,
 
        for (i = 0; i < sband->n_iftype_data; i++)
                iwl_nvm_fixup_sband_iftd(trans, sband, &iftype_data[i],
-                                        tx_chains, rx_chains);
+                                        tx_chains, rx_chains, fw);
 
        iwl_init_he_6ghz_capa(trans, data, sband, tx_chains, rx_chains);
 }
@@ -814,7 +820,8 @@ static void iwl_init_he_hw_capab(struct iwl_trans *trans,
 static void iwl_init_sbands(struct iwl_trans *trans,
                            struct iwl_nvm_data *data,
                            const void *nvm_ch_flags, u8 tx_chains,
-                           u8 rx_chains, u32 sbands_flags, bool v4)
+                           u8 rx_chains, u32 sbands_flags, bool v4,
+                           const struct iwl_fw *fw)
 {
        struct device *dev = trans->dev;
        const struct iwl_cfg *cfg = trans->cfg;
@@ -834,7 +841,8 @@ static void iwl_init_sbands(struct iwl_trans *trans,
                             tx_chains, rx_chains);
 
        if (data->sku_cap_11ax_enable && !iwlwifi_mod_params.disable_11ax)
-               iwl_init_he_hw_capab(trans, data, sband, tx_chains, rx_chains);
+               iwl_init_he_hw_capab(trans, data, sband, tx_chains, rx_chains,
+                                    fw);
 
        sband = &data->bands[NL80211_BAND_5GHZ];
        sband->band = NL80211_BAND_5GHZ;
@@ -849,7 +857,8 @@ static void iwl_init_sbands(struct iwl_trans *trans,
                                      tx_chains, rx_chains);
 
        if (data->sku_cap_11ax_enable && !iwlwifi_mod_params.disable_11ax)
-               iwl_init_he_hw_capab(trans, data, sband, tx_chains, rx_chains);
+               iwl_init_he_hw_capab(trans, data, sband, tx_chains, rx_chains,
+                                    fw);
 
        /* 6GHz band. */
        sband = &data->bands[NL80211_BAND_6GHZ];
@@ -861,7 +870,8 @@ static void iwl_init_sbands(struct iwl_trans *trans,
                                          NL80211_BAND_6GHZ);
 
        if (data->sku_cap_11ax_enable && !iwlwifi_mod_params.disable_11ax)
-               iwl_init_he_hw_capab(trans, data, sband, tx_chains, rx_chains);
+               iwl_init_he_hw_capab(trans, data, sband, tx_chains, rx_chains,
+                                    fw);
        else
                sband->n_channels = 0;
        if (n_channels != n_used)
@@ -1172,7 +1182,7 @@ iwl_parse_nvm_data(struct iwl_trans *trans, const struct iwl_cfg *cfg,
                sbands_flags |= IWL_NVM_SBANDS_FLAGS_NO_WIDE_IN_5GHZ;
 
        iwl_init_sbands(trans, data, ch_section, tx_chains, rx_chains,
-                       sbands_flags, false);
+                       sbands_flags, false, fw);
        data->calib_version = 255;
 
        return data;
@@ -1679,7 +1689,7 @@ struct iwl_nvm_data *iwl_get_nvm(struct iwl_trans *trans,
                        channel_profile,
                        nvm->valid_tx_ant & fw->valid_tx_ant,
                        nvm->valid_rx_ant & fw->valid_rx_ant,
-                       sbands_flags, v4);
+                       sbands_flags, v4, fw);
 
        iwl_free_resp(&hcmd);
        return nvm;