aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-drv.c26
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-fw-file.h67
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-fw.h20
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/coex.c22
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/debugfs.c9
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/fw.c4
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/mac80211.c47
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/mvm.h21
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/nvm.c8
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/rs.c10
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/rx.c4
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/scan.c33
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/tx.c4
-rw-r--r--drivers/net/wireless/iwlwifi/mvm/utils.c2
14 files changed, 161 insertions, 116 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-drv.c b/drivers/net/wireless/iwlwifi/iwl-drv.c
index 12566c8cb275..6685259927f8 100644
--- a/drivers/net/wireless/iwlwifi/iwl-drv.c
+++ b/drivers/net/wireless/iwlwifi/iwl-drv.c
@@ -423,13 +423,19 @@ static int iwl_set_ucode_api_flags(struct iwl_drv *drv, const u8 *data,
423{ 423{
424 const struct iwl_ucode_api *ucode_api = (void *)data; 424 const struct iwl_ucode_api *ucode_api = (void *)data;
425 u32 api_index = le32_to_cpu(ucode_api->api_index); 425 u32 api_index = le32_to_cpu(ucode_api->api_index);
426 u32 api_flags = le32_to_cpu(ucode_api->api_flags);
427 int i;
426 428
427 if (api_index >= IWL_API_ARRAY_SIZE) { 429 if (api_index >= IWL_API_MAX_BITS / 32) {
428 IWL_ERR(drv, "api_index larger than supported by driver\n"); 430 IWL_ERR(drv, "api_index larger than supported by driver\n");
429 return -EINVAL; 431 /* don't return an error so we can load FW that has more bits */
432 return 0;
430 } 433 }
431 434
432 capa->api[api_index] = le32_to_cpu(ucode_api->api_flags); 435 for (i = 0; i < 32; i++) {
436 if (api_flags & BIT(i))
437 __set_bit(i + 32 * api_index, capa->_api);
438 }
433 439
434 return 0; 440 return 0;
435} 441}
@@ -439,13 +445,19 @@ static int iwl_set_ucode_capabilities(struct iwl_drv *drv, const u8 *data,
439{ 445{
440 const struct iwl_ucode_capa *ucode_capa = (void *)data; 446 const struct iwl_ucode_capa *ucode_capa = (void *)data;
441 u32 api_index = le32_to_cpu(ucode_capa->api_index); 447 u32 api_index = le32_to_cpu(ucode_capa->api_index);
448 u32 api_flags = le32_to_cpu(ucode_capa->api_capa);
449 int i;
442 450
443 if (api_index >= IWL_CAPABILITIES_ARRAY_SIZE) { 451 if (api_index >= IWL_CAPABILITIES_MAX_BITS / 32) {
444 IWL_ERR(drv, "api_index larger than supported by driver\n"); 452 IWL_ERR(drv, "api_index larger than supported by driver\n");
445 return -EINVAL; 453 /* don't return an error so we can load FW that has more bits */
454 return 0;
446 } 455 }
447 456
448 capa->capa[api_index] = le32_to_cpu(ucode_capa->api_capa); 457 for (i = 0; i < 32; i++) {
458 if (api_flags & BIT(i))
459 __set_bit(i + 32 * api_index, capa->_capa);
460 }
449 461
450 return 0; 462 return 0;
451} 463}
@@ -1148,7 +1160,7 @@ static void iwl_req_fw_callback(const struct firmware *ucode_raw, void *context)
1148 if (err) 1160 if (err)
1149 goto try_again; 1161 goto try_again;
1150 1162
1151 if (drv->fw.ucode_capa.api[0] & IWL_UCODE_TLV_API_NEW_VERSION) 1163 if (fw_has_api(&drv->fw.ucode_capa, IWL_UCODE_TLV_API_NEW_VERSION))
1152 api_ver = drv->fw.ucode_ver; 1164 api_ver = drv->fw.ucode_ver;
1153 else 1165 else
1154 api_ver = IWL_UCODE_API(drv->fw.ucode_ver); 1166 api_ver = IWL_UCODE_API(drv->fw.ucode_ver);
diff --git a/drivers/net/wireless/iwlwifi/iwl-fw-file.h b/drivers/net/wireless/iwlwifi/iwl-fw-file.h
index 5b7c0ae52f93..7efd62908e61 100644
--- a/drivers/net/wireless/iwlwifi/iwl-fw-file.h
+++ b/drivers/net/wireless/iwlwifi/iwl-fw-file.h
@@ -237,6 +237,8 @@ enum iwl_ucode_tlv_flag {
237 IWL_UCODE_TLV_FLAGS_GO_UAPSD = BIT(30), 237 IWL_UCODE_TLV_FLAGS_GO_UAPSD = BIT(30),
238}; 238};
239 239
240typedef unsigned int __bitwise__ iwl_ucode_tlv_api_t;
241
240/** 242/**
241 * enum iwl_ucode_tlv_api - ucode api 243 * enum iwl_ucode_tlv_api - ucode api
242 * @IWL_UCODE_TLV_API_BT_COEX_SPLIT: new API for BT Coex 244 * @IWL_UCODE_TLV_API_BT_COEX_SPLIT: new API for BT Coex
@@ -259,21 +261,23 @@ enum iwl_ucode_tlv_flag {
259 * instead of 3. 261 * instead of 3.
260 */ 262 */
261enum iwl_ucode_tlv_api { 263enum iwl_ucode_tlv_api {
262 IWL_UCODE_TLV_API_BT_COEX_SPLIT = BIT(3), 264 IWL_UCODE_TLV_API_BT_COEX_SPLIT = (__force iwl_ucode_tlv_api_t)3,
263 IWL_UCODE_TLV_API_FRAGMENTED_SCAN = BIT(8), 265 IWL_UCODE_TLV_API_FRAGMENTED_SCAN = (__force iwl_ucode_tlv_api_t)8,
264 IWL_UCODE_TLV_API_WIFI_MCC_UPDATE = BIT(9), 266 IWL_UCODE_TLV_API_WIFI_MCC_UPDATE = (__force iwl_ucode_tlv_api_t)9,
265 IWL_UCODE_TLV_API_HDC_PHASE_0 = BIT(10), 267 IWL_UCODE_TLV_API_HDC_PHASE_0 = (__force iwl_ucode_tlv_api_t)10,
266 IWL_UCODE_TLV_API_TX_POWER_DEV = BIT(11), 268 IWL_UCODE_TLV_API_TX_POWER_DEV = (__force iwl_ucode_tlv_api_t)11,
267 IWL_UCODE_TLV_API_BASIC_DWELL = BIT(13), 269 IWL_UCODE_TLV_API_BASIC_DWELL = (__force iwl_ucode_tlv_api_t)13,
268 IWL_UCODE_TLV_API_SCD_CFG = BIT(15), 270 IWL_UCODE_TLV_API_SCD_CFG = (__force iwl_ucode_tlv_api_t)15,
269 IWL_UCODE_TLV_API_SINGLE_SCAN_EBS = BIT(16), 271 IWL_UCODE_TLV_API_SINGLE_SCAN_EBS = (__force iwl_ucode_tlv_api_t)16,
270 IWL_UCODE_TLV_API_ASYNC_DTM = BIT(17), 272 IWL_UCODE_TLV_API_ASYNC_DTM = (__force iwl_ucode_tlv_api_t)17,
271 IWL_UCODE_TLV_API_LQ_SS_PARAMS = BIT(18), 273 IWL_UCODE_TLV_API_LQ_SS_PARAMS = (__force iwl_ucode_tlv_api_t)18,
272 IWL_UCODE_TLV_API_STATS_V10 = BIT(19), 274 IWL_UCODE_TLV_API_STATS_V10 = (__force iwl_ucode_tlv_api_t)19,
273 IWL_UCODE_TLV_API_NEW_VERSION = BIT(20), 275 IWL_UCODE_TLV_API_NEW_VERSION = (__force iwl_ucode_tlv_api_t)20,
274 IWL_UCODE_TLV_API_EXT_SCAN_PRIORITY = BIT(24), 276 IWL_UCODE_TLV_API_EXT_SCAN_PRIORITY = (__force iwl_ucode_tlv_api_t)24,
275}; 277};
276 278
279typedef unsigned int __bitwise__ iwl_ucode_tlv_capa_t;
280
277/** 281/**
278 * enum iwl_ucode_tlv_capa - ucode capabilities 282 * enum iwl_ucode_tlv_capa - ucode capabilities
279 * @IWL_UCODE_TLV_CAPA_D0I3_SUPPORT: supports D0i3 283 * @IWL_UCODE_TLV_CAPA_D0I3_SUPPORT: supports D0i3
@@ -302,22 +306,22 @@ enum iwl_ucode_tlv_api {
302 * @IWL_UCODE_TLV_CAPA_BT_COEX_RRC: supports BT Coex RRC 306 * @IWL_UCODE_TLV_CAPA_BT_COEX_RRC: supports BT Coex RRC
303 */ 307 */
304enum iwl_ucode_tlv_capa { 308enum iwl_ucode_tlv_capa {
305 IWL_UCODE_TLV_CAPA_D0I3_SUPPORT = BIT(0), 309 IWL_UCODE_TLV_CAPA_D0I3_SUPPORT = (__force iwl_ucode_tlv_capa_t)0,
306 IWL_UCODE_TLV_CAPA_LAR_SUPPORT = BIT(1), 310 IWL_UCODE_TLV_CAPA_LAR_SUPPORT = (__force iwl_ucode_tlv_capa_t)1,
307 IWL_UCODE_TLV_CAPA_UMAC_SCAN = BIT(2), 311 IWL_UCODE_TLV_CAPA_UMAC_SCAN = (__force iwl_ucode_tlv_capa_t)2,
308 IWL_UCODE_TLV_CAPA_BEAMFORMER = BIT(3), 312 IWL_UCODE_TLV_CAPA_BEAMFORMER = (__force iwl_ucode_tlv_capa_t)3,
309 IWL_UCODE_TLV_CAPA_TDLS_SUPPORT = BIT(6), 313 IWL_UCODE_TLV_CAPA_TDLS_SUPPORT = (__force iwl_ucode_tlv_capa_t)6,
310 IWL_UCODE_TLV_CAPA_TXPOWER_INSERTION_SUPPORT = BIT(8), 314 IWL_UCODE_TLV_CAPA_TXPOWER_INSERTION_SUPPORT = (__force iwl_ucode_tlv_capa_t)8,
311 IWL_UCODE_TLV_CAPA_DS_PARAM_SET_IE_SUPPORT = BIT(9), 315 IWL_UCODE_TLV_CAPA_DS_PARAM_SET_IE_SUPPORT = (__force iwl_ucode_tlv_capa_t)9,
312 IWL_UCODE_TLV_CAPA_WFA_TPC_REP_IE_SUPPORT = BIT(10), 316 IWL_UCODE_TLV_CAPA_WFA_TPC_REP_IE_SUPPORT = (__force iwl_ucode_tlv_capa_t)10,
313 IWL_UCODE_TLV_CAPA_QUIET_PERIOD_SUPPORT = BIT(11), 317 IWL_UCODE_TLV_CAPA_QUIET_PERIOD_SUPPORT = (__force iwl_ucode_tlv_capa_t)11,
314 IWL_UCODE_TLV_CAPA_DQA_SUPPORT = BIT(12), 318 IWL_UCODE_TLV_CAPA_DQA_SUPPORT = (__force iwl_ucode_tlv_capa_t)12,
315 IWL_UCODE_TLV_CAPA_TDLS_CHANNEL_SWITCH = BIT(13), 319 IWL_UCODE_TLV_CAPA_TDLS_CHANNEL_SWITCH = (__force iwl_ucode_tlv_capa_t)13,
316 IWL_UCODE_TLV_CAPA_HOTSPOT_SUPPORT = BIT(18), 320 IWL_UCODE_TLV_CAPA_HOTSPOT_SUPPORT = (__force iwl_ucode_tlv_capa_t)18,
317 IWL_UCODE_TLV_CAPA_RADIO_BEACON_STATS = BIT(22), 321 IWL_UCODE_TLV_CAPA_RADIO_BEACON_STATS = (__force iwl_ucode_tlv_capa_t)22,
318 IWL_UCODE_TLV_CAPA_BT_COEX_PLCR = BIT(28), 322 IWL_UCODE_TLV_CAPA_BT_COEX_PLCR = (__force iwl_ucode_tlv_capa_t)28,
319 IWL_UCODE_TLV_CAPA_LAR_MULTI_MCC = BIT(29), 323 IWL_UCODE_TLV_CAPA_LAR_MULTI_MCC = (__force iwl_ucode_tlv_capa_t)29,
320 IWL_UCODE_TLV_CAPA_BT_COEX_RRC = BIT(30), 324 IWL_UCODE_TLV_CAPA_BT_COEX_RRC = (__force iwl_ucode_tlv_capa_t)30,
321}; 325};
322 326
323/* The default calibrate table size if not specified by firmware file */ 327/* The default calibrate table size if not specified by firmware file */
@@ -328,13 +332,14 @@ enum iwl_ucode_tlv_capa {
328/* The default max probe length if not specified by the firmware file */ 332/* The default max probe length if not specified by the firmware file */
329#define IWL_DEFAULT_MAX_PROBE_LENGTH 200 333#define IWL_DEFAULT_MAX_PROBE_LENGTH 200
330 334
335#define IWL_API_MAX_BITS 64
336#define IWL_CAPABILITIES_MAX_BITS 64
337
331/* 338/*
332 * For 16.0 uCode and above, there is no differentiation between sections, 339 * For 16.0 uCode and above, there is no differentiation between sections,
333 * just an offset to the HW address. 340 * just an offset to the HW address.
334 */ 341 */
335#define IWL_UCODE_SECTION_MAX 12 342#define IWL_UCODE_SECTION_MAX 12
336#define IWL_API_ARRAY_SIZE 1
337#define IWL_CAPABILITIES_ARRAY_SIZE 1
338#define CPU1_CPU2_SEPARATOR_SECTION 0xFFFFCCCC 343#define CPU1_CPU2_SEPARATOR_SECTION 0xFFFFCCCC
339 344
340/* uCode version contains 4 values: Major/Minor/API/Serial */ 345/* uCode version contains 4 values: Major/Minor/API/Serial */
diff --git a/drivers/net/wireless/iwlwifi/iwl-fw.h b/drivers/net/wireless/iwlwifi/iwl-fw.h
index cdc7f1edaed9..3e3c9d8b3c37 100644
--- a/drivers/net/wireless/iwlwifi/iwl-fw.h
+++ b/drivers/net/wireless/iwlwifi/iwl-fw.h
@@ -32,7 +32,7 @@
32 * BSD LICENSE 32 * BSD LICENSE
33 * 33 *
34 * Copyright(c) 2005 - 2014 Intel Corporation. All rights reserved. 34 * Copyright(c) 2005 - 2014 Intel Corporation. All rights reserved.
35 * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH 35 * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
36 * All rights reserved. 36 * All rights reserved.
37 * 37 *
38 * Redistribution and use in source and binary forms, with or without 38 * Redistribution and use in source and binary forms, with or without
@@ -105,10 +105,24 @@ struct iwl_ucode_capabilities {
105 u32 n_scan_channels; 105 u32 n_scan_channels;
106 u32 standard_phy_calibration_size; 106 u32 standard_phy_calibration_size;
107 u32 flags; 107 u32 flags;
108 u32 api[IWL_API_ARRAY_SIZE]; 108 unsigned long _api[BITS_TO_LONGS(IWL_API_MAX_BITS)];
109 u32 capa[IWL_CAPABILITIES_ARRAY_SIZE]; 109 unsigned long _capa[BITS_TO_LONGS(IWL_CAPABILITIES_MAX_BITS)];
110}; 110};
111 111
112static inline bool
113fw_has_api(const struct iwl_ucode_capabilities *capabilities,
114 iwl_ucode_tlv_api_t api)
115{
116 return test_bit((__force long)api, capabilities->_api);
117}
118
119static inline bool
120fw_has_capa(const struct iwl_ucode_capabilities *capabilities,
121 iwl_ucode_tlv_capa_t capa)
122{
123 return test_bit((__force long)capa, capabilities->_capa);
124}
125
112/* one for each uCode image (inst/data, init/runtime/wowlan) */ 126/* one for each uCode image (inst/data, init/runtime/wowlan) */
113struct fw_desc { 127struct fw_desc {
114 const void *data; /* vmalloc'ed data */ 128 const void *data; /* vmalloc'ed data */
diff --git a/drivers/net/wireless/iwlwifi/mvm/coex.c b/drivers/net/wireless/iwlwifi/mvm/coex.c
index 662fa9c09624..b4737e296c92 100644
--- a/drivers/net/wireless/iwlwifi/mvm/coex.c
+++ b/drivers/net/wireless/iwlwifi/mvm/coex.c
@@ -411,7 +411,7 @@ int iwl_send_bt_init_conf(struct iwl_mvm *mvm)
411 struct iwl_bt_coex_cmd bt_cmd = {}; 411 struct iwl_bt_coex_cmd bt_cmd = {};
412 u32 mode; 412 u32 mode;
413 413
414 if (!(mvm->fw->ucode_capa.api[0] & IWL_UCODE_TLV_API_BT_COEX_SPLIT)) 414 if (!fw_has_api(&mvm->fw->ucode_capa, IWL_UCODE_TLV_API_BT_COEX_SPLIT))
415 return iwl_send_bt_init_conf_old(mvm); 415 return iwl_send_bt_init_conf_old(mvm);
416 416
417 lockdep_assert_held(&mvm->mutex); 417 lockdep_assert_held(&mvm->mutex);
@@ -732,7 +732,7 @@ int iwl_mvm_rx_bt_coex_notif(struct iwl_mvm *mvm,
732 struct iwl_rx_packet *pkt = rxb_addr(rxb); 732 struct iwl_rx_packet *pkt = rxb_addr(rxb);
733 struct iwl_bt_coex_profile_notif *notif = (void *)pkt->data; 733 struct iwl_bt_coex_profile_notif *notif = (void *)pkt->data;
734 734
735 if (!(mvm->fw->ucode_capa.api[0] & IWL_UCODE_TLV_API_BT_COEX_SPLIT)) 735 if (!fw_has_api(&mvm->fw->ucode_capa, IWL_UCODE_TLV_API_BT_COEX_SPLIT))
736 return iwl_mvm_rx_bt_coex_notif_old(mvm, rxb, dev_cmd); 736 return iwl_mvm_rx_bt_coex_notif_old(mvm, rxb, dev_cmd);
737 737
738 IWL_DEBUG_COEX(mvm, "BT Coex Notification received\n"); 738 IWL_DEBUG_COEX(mvm, "BT Coex Notification received\n");
@@ -762,7 +762,8 @@ void iwl_mvm_bt_rssi_event(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
762 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); 762 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
763 int ret; 763 int ret;
764 764
765 if (!(mvm->fw->ucode_capa.api[0] & IWL_UCODE_TLV_API_BT_COEX_SPLIT)) { 765 if (!fw_has_api(&mvm->fw->ucode_capa,
766 IWL_UCODE_TLV_API_BT_COEX_SPLIT)) {
766 iwl_mvm_bt_rssi_event_old(mvm, vif, rssi_event); 767 iwl_mvm_bt_rssi_event_old(mvm, vif, rssi_event);
767 return; 768 return;
768 } 769 }
@@ -813,7 +814,7 @@ u16 iwl_mvm_coex_agg_time_limit(struct iwl_mvm *mvm,
813 struct iwl_mvm_phy_ctxt *phy_ctxt = mvmvif->phy_ctxt; 814 struct iwl_mvm_phy_ctxt *phy_ctxt = mvmvif->phy_ctxt;
814 enum iwl_bt_coex_lut_type lut_type; 815 enum iwl_bt_coex_lut_type lut_type;
815 816
816 if (!(mvm->fw->ucode_capa.api[0] & IWL_UCODE_TLV_API_BT_COEX_SPLIT)) 817 if (!fw_has_api(&mvm->fw->ucode_capa, IWL_UCODE_TLV_API_BT_COEX_SPLIT))
817 return iwl_mvm_coex_agg_time_limit_old(mvm, sta); 818 return iwl_mvm_coex_agg_time_limit_old(mvm, sta);
818 819
819 if (IWL_COEX_IS_TTC_ON(mvm->last_bt_notif.ttc_rrc_status, phy_ctxt->id)) 820 if (IWL_COEX_IS_TTC_ON(mvm->last_bt_notif.ttc_rrc_status, phy_ctxt->id))
@@ -840,7 +841,7 @@ bool iwl_mvm_bt_coex_is_mimo_allowed(struct iwl_mvm *mvm,
840 struct iwl_mvm_phy_ctxt *phy_ctxt = mvmvif->phy_ctxt; 841 struct iwl_mvm_phy_ctxt *phy_ctxt = mvmvif->phy_ctxt;
841 enum iwl_bt_coex_lut_type lut_type; 842 enum iwl_bt_coex_lut_type lut_type;
842 843
843 if (!(mvm->fw->ucode_capa.api[0] & IWL_UCODE_TLV_API_BT_COEX_SPLIT)) 844 if (!fw_has_api(&mvm->fw->ucode_capa, IWL_UCODE_TLV_API_BT_COEX_SPLIT))
844 return iwl_mvm_bt_coex_is_mimo_allowed_old(mvm, sta); 845 return iwl_mvm_bt_coex_is_mimo_allowed_old(mvm, sta);
845 846
846 if (IWL_COEX_IS_TTC_ON(mvm->last_bt_notif.ttc_rrc_status, phy_ctxt->id)) 847 if (IWL_COEX_IS_TTC_ON(mvm->last_bt_notif.ttc_rrc_status, phy_ctxt->id))
@@ -870,7 +871,7 @@ bool iwl_mvm_bt_coex_is_ant_avail(struct iwl_mvm *mvm, u8 ant)
870 if (ant & mvm->cfg->non_shared_ant) 871 if (ant & mvm->cfg->non_shared_ant)
871 return true; 872 return true;
872 873
873 if (!(mvm->fw->ucode_capa.api[0] & IWL_UCODE_TLV_API_BT_COEX_SPLIT)) 874 if (!fw_has_api(&mvm->fw->ucode_capa, IWL_UCODE_TLV_API_BT_COEX_SPLIT))
874 return iwl_mvm_bt_coex_is_shared_ant_avail_old(mvm); 875 return iwl_mvm_bt_coex_is_shared_ant_avail_old(mvm);
875 876
876 return le32_to_cpu(mvm->last_bt_notif.bt_activity_grading) < 877 return le32_to_cpu(mvm->last_bt_notif.bt_activity_grading) <
@@ -883,7 +884,7 @@ bool iwl_mvm_bt_coex_is_shared_ant_avail(struct iwl_mvm *mvm)
883 if (mvm->cfg->bt_shared_single_ant) 884 if (mvm->cfg->bt_shared_single_ant)
884 return true; 885 return true;
885 886
886 if (!(mvm->fw->ucode_capa.api[0] & IWL_UCODE_TLV_API_BT_COEX_SPLIT)) 887 if (!fw_has_api(&mvm->fw->ucode_capa, IWL_UCODE_TLV_API_BT_COEX_SPLIT))
887 return iwl_mvm_bt_coex_is_shared_ant_avail_old(mvm); 888 return iwl_mvm_bt_coex_is_shared_ant_avail_old(mvm);
888 889
889 return le32_to_cpu(mvm->last_bt_notif.bt_activity_grading) < BT_HIGH_TRAFFIC; 890 return le32_to_cpu(mvm->last_bt_notif.bt_activity_grading) < BT_HIGH_TRAFFIC;
@@ -894,7 +895,7 @@ bool iwl_mvm_bt_coex_is_tpc_allowed(struct iwl_mvm *mvm,
894{ 895{
895 u32 bt_activity = le32_to_cpu(mvm->last_bt_notif.bt_activity_grading); 896 u32 bt_activity = le32_to_cpu(mvm->last_bt_notif.bt_activity_grading);
896 897
897 if (!(mvm->fw->ucode_capa.api[0] & IWL_UCODE_TLV_API_BT_COEX_SPLIT)) 898 if (!fw_has_api(&mvm->fw->ucode_capa, IWL_UCODE_TLV_API_BT_COEX_SPLIT))
898 return iwl_mvm_bt_coex_is_tpc_allowed_old(mvm, band); 899 return iwl_mvm_bt_coex_is_tpc_allowed_old(mvm, band);
899 900
900 if (band != IEEE80211_BAND_2GHZ) 901 if (band != IEEE80211_BAND_2GHZ)
@@ -937,7 +938,8 @@ u8 iwl_mvm_bt_coex_tx_prio(struct iwl_mvm *mvm, struct ieee80211_hdr *hdr,
937 938
938void iwl_mvm_bt_coex_vif_change(struct iwl_mvm *mvm) 939void iwl_mvm_bt_coex_vif_change(struct iwl_mvm *mvm)
939{ 940{
940 if (!(mvm->fw->ucode_capa.api[0] & IWL_UCODE_TLV_API_BT_COEX_SPLIT)) { 941 if (!fw_has_api(&mvm->fw->ucode_capa,
942 IWL_UCODE_TLV_API_BT_COEX_SPLIT)) {
941 iwl_mvm_bt_coex_vif_change_old(mvm); 943 iwl_mvm_bt_coex_vif_change_old(mvm);
942 return; 944 return;
943 } 945 }
@@ -955,7 +957,7 @@ int iwl_mvm_rx_ant_coupling_notif(struct iwl_mvm *mvm,
955 u8 __maybe_unused lower_bound, upper_bound; 957 u8 __maybe_unused lower_bound, upper_bound;
956 u8 lut; 958 u8 lut;
957 959
958 if (!(mvm->fw->ucode_capa.api[0] & IWL_UCODE_TLV_API_BT_COEX_SPLIT)) 960 if (!fw_has_api(&mvm->fw->ucode_capa, IWL_UCODE_TLV_API_BT_COEX_SPLIT))
959 return iwl_mvm_rx_ant_coupling_notif_old(mvm, rxb, dev_cmd); 961 return iwl_mvm_rx_ant_coupling_notif_old(mvm, rxb, dev_cmd);
960 962
961 if (!iwl_mvm_bt_is_plcr_supported(mvm)) 963 if (!iwl_mvm_bt_is_plcr_supported(mvm))
diff --git a/drivers/net/wireless/iwlwifi/mvm/debugfs.c b/drivers/net/wireless/iwlwifi/mvm/debugfs.c
index 8c17b943cc6f..ffb4b5cef275 100644
--- a/drivers/net/wireless/iwlwifi/mvm/debugfs.c
+++ b/drivers/net/wireless/iwlwifi/mvm/debugfs.c
@@ -493,7 +493,8 @@ static ssize_t iwl_dbgfs_bt_notif_read(struct file *file, char __user *user_buf,
493 493
494 mutex_lock(&mvm->mutex); 494 mutex_lock(&mvm->mutex);
495 495
496 if (!(mvm->fw->ucode_capa.api[0] & IWL_UCODE_TLV_API_BT_COEX_SPLIT)) { 496 if (!fw_has_api(&mvm->fw->ucode_capa,
497 IWL_UCODE_TLV_API_BT_COEX_SPLIT)) {
497 struct iwl_bt_coex_profile_notif_old *notif = 498 struct iwl_bt_coex_profile_notif_old *notif =
498 &mvm->last_bt_notif_old; 499 &mvm->last_bt_notif_old;
499 500
@@ -550,7 +551,8 @@ static ssize_t iwl_dbgfs_bt_cmd_read(struct file *file, char __user *user_buf,
550 551
551 mutex_lock(&mvm->mutex); 552 mutex_lock(&mvm->mutex);
552 553
553 if (!(mvm->fw->ucode_capa.api[0] & IWL_UCODE_TLV_API_BT_COEX_SPLIT)) { 554 if (!fw_has_api(&mvm->fw->ucode_capa,
555 IWL_UCODE_TLV_API_BT_COEX_SPLIT)) {
554 struct iwl_bt_coex_ci_cmd_old *cmd = &mvm->last_bt_ci_cmd_old; 556 struct iwl_bt_coex_ci_cmd_old *cmd = &mvm->last_bt_ci_cmd_old;
555 557
556 pos += scnprintf(buf+pos, bufsz-pos, 558 pos += scnprintf(buf+pos, bufsz-pos,
@@ -916,7 +918,8 @@ iwl_dbgfs_scan_ant_rxchain_write(struct iwl_mvm *mvm, char *buf,
916 918
917 if (mvm->scan_rx_ant != scan_rx_ant) { 919 if (mvm->scan_rx_ant != scan_rx_ant) {
918 mvm->scan_rx_ant = scan_rx_ant; 920 mvm->scan_rx_ant = scan_rx_ant;
919 if (mvm->fw->ucode_capa.capa[0] & IWL_UCODE_TLV_CAPA_UMAC_SCAN) 921 if (fw_has_capa(&mvm->fw->ucode_capa,
922 IWL_UCODE_TLV_CAPA_UMAC_SCAN))
920 iwl_mvm_config_scan(mvm); 923 iwl_mvm_config_scan(mvm);
921 } 924 }
922 925
diff --git a/drivers/net/wireless/iwlwifi/mvm/fw.c b/drivers/net/wireless/iwlwifi/mvm/fw.c
index 2f76fb23249a..eb10c5ee4a14 100644
--- a/drivers/net/wireless/iwlwifi/mvm/fw.c
+++ b/drivers/net/wireless/iwlwifi/mvm/fw.c
@@ -623,7 +623,7 @@ static int iwl_mvm_config_ltr(struct iwl_mvm *mvm)
623 if (!mvm->trans->ltr_enabled) 623 if (!mvm->trans->ltr_enabled)
624 return 0; 624 return 0;
625 625
626 if (!(mvm->fw->ucode_capa.api[0] & IWL_UCODE_TLV_API_HDC_PHASE_0)) 626 if (!fw_has_api(&mvm->fw->ucode_capa, IWL_UCODE_TLV_API_HDC_PHASE_0))
627 return iwl_mvm_config_ltr_v1(mvm); 627 return iwl_mvm_config_ltr_v1(mvm);
628 628
629 return iwl_mvm_send_cmd_pdu(mvm, LTR_CONFIG, 0, 629 return iwl_mvm_send_cmd_pdu(mvm, LTR_CONFIG, 0,
@@ -754,7 +754,7 @@ int iwl_mvm_up(struct iwl_mvm *mvm)
754 goto error; 754 goto error;
755 } 755 }
756 756
757 if (mvm->fw->ucode_capa.capa[0] & IWL_UCODE_TLV_CAPA_UMAC_SCAN) { 757 if (fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_UMAC_SCAN)) {
758 ret = iwl_mvm_config_scan(mvm); 758 ret = iwl_mvm_config_scan(mvm);
759 if (ret) 759 if (ret)
760 goto error; 760 goto error;
diff --git a/drivers/net/wireless/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/iwlwifi/mvm/mac80211.c
index 57d75d14fc80..c46c69f2440f 100644
--- a/drivers/net/wireless/iwlwifi/mvm/mac80211.c
+++ b/drivers/net/wireless/iwlwifi/mvm/mac80211.c
@@ -515,7 +515,7 @@ int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm)
515 BUILD_BUG_ON(IWL_MVM_MAX_UMAC_SCANS > HWEIGHT32(IWL_MVM_SCAN_MASK) || 515 BUILD_BUG_ON(IWL_MVM_MAX_UMAC_SCANS > HWEIGHT32(IWL_MVM_SCAN_MASK) ||
516 IWL_MVM_MAX_LMAC_SCANS > HWEIGHT32(IWL_MVM_SCAN_MASK)); 516 IWL_MVM_MAX_LMAC_SCANS > HWEIGHT32(IWL_MVM_SCAN_MASK));
517 517
518 if (mvm->fw->ucode_capa.capa[0] & IWL_UCODE_TLV_CAPA_UMAC_SCAN) 518 if (fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_UMAC_SCAN))
519 mvm->max_scans = IWL_MVM_MAX_UMAC_SCANS; 519 mvm->max_scans = IWL_MVM_MAX_UMAC_SCANS;
520 else 520 else
521 mvm->max_scans = IWL_MVM_MAX_LMAC_SCANS; 521 mvm->max_scans = IWL_MVM_MAX_LMAC_SCANS;
@@ -527,10 +527,10 @@ int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm)
527 hw->wiphy->bands[IEEE80211_BAND_5GHZ] = 527 hw->wiphy->bands[IEEE80211_BAND_5GHZ] =
528 &mvm->nvm_data->bands[IEEE80211_BAND_5GHZ]; 528 &mvm->nvm_data->bands[IEEE80211_BAND_5GHZ];
529 529
530 if ((mvm->fw->ucode_capa.capa[0] & 530 if (fw_has_capa(&mvm->fw->ucode_capa,
531 IWL_UCODE_TLV_CAPA_BEAMFORMER) && 531 IWL_UCODE_TLV_CAPA_BEAMFORMER) &&
532 (mvm->fw->ucode_capa.api[0] & 532 fw_has_api(&mvm->fw->ucode_capa,
533 IWL_UCODE_TLV_API_LQ_SS_PARAMS)) 533 IWL_UCODE_TLV_API_LQ_SS_PARAMS))
534 hw->wiphy->bands[IEEE80211_BAND_5GHZ]->vht_cap.cap |= 534 hw->wiphy->bands[IEEE80211_BAND_5GHZ]->vht_cap.cap |=
535 IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE; 535 IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE;
536 } 536 }
@@ -556,20 +556,20 @@ int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm)
556 NL80211_FEATURE_STATIC_SMPS | 556 NL80211_FEATURE_STATIC_SMPS |
557 NL80211_FEATURE_SUPPORTS_WMM_ADMISSION; 557 NL80211_FEATURE_SUPPORTS_WMM_ADMISSION;
558 558
559 if (mvm->fw->ucode_capa.capa[0] & 559 if (fw_has_capa(&mvm->fw->ucode_capa,
560 IWL_UCODE_TLV_CAPA_TXPOWER_INSERTION_SUPPORT) 560 IWL_UCODE_TLV_CAPA_TXPOWER_INSERTION_SUPPORT))
561 hw->wiphy->features |= NL80211_FEATURE_TX_POWER_INSERTION; 561 hw->wiphy->features |= NL80211_FEATURE_TX_POWER_INSERTION;
562 if (mvm->fw->ucode_capa.capa[0] & 562 if (fw_has_capa(&mvm->fw->ucode_capa,
563 IWL_UCODE_TLV_CAPA_QUIET_PERIOD_SUPPORT) 563 IWL_UCODE_TLV_CAPA_QUIET_PERIOD_SUPPORT))
564 hw->wiphy->features |= NL80211_FEATURE_QUIET; 564 hw->wiphy->features |= NL80211_FEATURE_QUIET;
565 565
566 if (mvm->fw->ucode_capa.capa[0] & 566 if (fw_has_capa(&mvm->fw->ucode_capa,
567 IWL_UCODE_TLV_CAPA_DS_PARAM_SET_IE_SUPPORT) 567 IWL_UCODE_TLV_CAPA_DS_PARAM_SET_IE_SUPPORT))
568 hw->wiphy->features |= 568 hw->wiphy->features |=
569 NL80211_FEATURE_DS_PARAM_SET_IE_IN_PROBES; 569 NL80211_FEATURE_DS_PARAM_SET_IE_IN_PROBES;
570 570
571 if (mvm->fw->ucode_capa.capa[0] & 571 if (fw_has_capa(&mvm->fw->ucode_capa,
572 IWL_UCODE_TLV_CAPA_WFA_TPC_REP_IE_SUPPORT) 572 IWL_UCODE_TLV_CAPA_WFA_TPC_REP_IE_SUPPORT))
573 hw->wiphy->features |= NL80211_FEATURE_WFA_TPC_IE_IN_PROBES; 573 hw->wiphy->features |= NL80211_FEATURE_WFA_TPC_IE_IN_PROBES;
574 574
575 mvm->rts_threshold = IEEE80211_MAX_RTS_THRESHOLD; 575 mvm->rts_threshold = IEEE80211_MAX_RTS_THRESHOLD;
@@ -619,13 +619,14 @@ int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm)
619 if (ret) 619 if (ret)
620 return ret; 620 return ret;
621 621
622 if (mvm->fw->ucode_capa.capa[0] & IWL_UCODE_TLV_CAPA_TDLS_SUPPORT) { 622 if (fw_has_capa(&mvm->fw->ucode_capa,
623 IWL_UCODE_TLV_CAPA_TDLS_SUPPORT)) {
623 IWL_DEBUG_TDLS(mvm, "TDLS supported\n"); 624 IWL_DEBUG_TDLS(mvm, "TDLS supported\n");
624 hw->wiphy->flags |= WIPHY_FLAG_SUPPORTS_TDLS; 625 hw->wiphy->flags |= WIPHY_FLAG_SUPPORTS_TDLS;
625 } 626 }
626 627
627 if (mvm->fw->ucode_capa.capa[0] & 628 if (fw_has_capa(&mvm->fw->ucode_capa,
628 IWL_UCODE_TLV_CAPA_TDLS_CHANNEL_SWITCH) { 629 IWL_UCODE_TLV_CAPA_TDLS_CHANNEL_SWITCH)) {
629 IWL_DEBUG_TDLS(mvm, "TDLS channel switch supported\n"); 630 IWL_DEBUG_TDLS(mvm, "TDLS channel switch supported\n");
630 hw->wiphy->features |= NL80211_FEATURE_TDLS_CHANNEL_SWITCH; 631 hw->wiphy->features |= NL80211_FEATURE_TDLS_CHANNEL_SWITCH;
631 } 632 }
@@ -1500,7 +1501,7 @@ void __iwl_mvm_mac_stop(struct iwl_mvm *mvm)
1500 /* We shouldn't have any UIDs still set. Loop over all the UIDs to 1501 /* We shouldn't have any UIDs still set. Loop over all the UIDs to
1501 * make sure there's nothing left there and warn if any is found. 1502 * make sure there's nothing left there and warn if any is found.
1502 */ 1503 */
1503 if (mvm->fw->ucode_capa.capa[0] & IWL_UCODE_TLV_CAPA_UMAC_SCAN) { 1504 if (fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_UMAC_SCAN)) {
1504 int i; 1505 int i;
1505 1506
1506 for (i = 0; i < mvm->max_scans; i++) { 1507 for (i = 0; i < mvm->max_scans; i++) {
@@ -1572,7 +1573,7 @@ static int iwl_mvm_set_tx_power(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
1572 .pwr_restriction = cpu_to_le16(8 * tx_power), 1573 .pwr_restriction = cpu_to_le16(8 * tx_power),
1573 }; 1574 };
1574 1575
1575 if (!(mvm->fw->ucode_capa.api[0] & IWL_UCODE_TLV_API_TX_POWER_DEV)) 1576 if (!fw_has_api(&mvm->fw->ucode_capa, IWL_UCODE_TLV_API_TX_POWER_DEV))
1576 return iwl_mvm_set_tx_power_old(mvm, vif, tx_power); 1577 return iwl_mvm_set_tx_power_old(mvm, vif, tx_power);
1577 1578
1578 if (tx_power == IWL_DEFAULT_MAX_TX_POWER) 1579 if (tx_power == IWL_DEFAULT_MAX_TX_POWER)
@@ -3102,8 +3103,8 @@ static int iwl_mvm_roc(struct ieee80211_hw *hw,
3102 3103
3103 switch (vif->type) { 3104 switch (vif->type) {
3104 case NL80211_IFTYPE_STATION: 3105 case NL80211_IFTYPE_STATION:
3105 if (mvm->fw->ucode_capa.capa[0] & 3106 if (fw_has_capa(&mvm->fw->ucode_capa,
3106 IWL_UCODE_TLV_CAPA_HOTSPOT_SUPPORT) { 3107 IWL_UCODE_TLV_CAPA_HOTSPOT_SUPPORT)) {
3107 /* Use aux roc framework (HS20) */ 3108 /* Use aux roc framework (HS20) */
3108 ret = iwl_mvm_send_aux_roc_cmd(mvm, channel, 3109 ret = iwl_mvm_send_aux_roc_cmd(mvm, channel,
3109 vif, duration); 3110 vif, duration);
@@ -3895,7 +3896,7 @@ static int iwl_mvm_mac_get_survey(struct ieee80211_hw *hw, int idx,
3895 if (idx != 0) 3896 if (idx != 0)
3896 return -ENOENT; 3897 return -ENOENT;
3897 3898
3898 if (!(mvm->fw->ucode_capa.capa[0] & 3899 if (fw_has_capa(&mvm->fw->ucode_capa,
3899 IWL_UCODE_TLV_CAPA_RADIO_BEACON_STATS)) 3900 IWL_UCODE_TLV_CAPA_RADIO_BEACON_STATS))
3900 return -ENOENT; 3901 return -ENOENT;
3901 3902
@@ -3942,8 +3943,8 @@ static void iwl_mvm_mac_sta_statistics(struct ieee80211_hw *hw,
3942 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); 3943 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
3943 struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta); 3944 struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta);
3944 3945
3945 if (!(mvm->fw->ucode_capa.capa[0] & 3946 if (fw_has_capa(&mvm->fw->ucode_capa,
3946 IWL_UCODE_TLV_CAPA_RADIO_BEACON_STATS)) 3947 IWL_UCODE_TLV_CAPA_RADIO_BEACON_STATS))
3947 return; 3948 return;
3948 3949
3949 /* if beacon filtering isn't on mac80211 does it anyway */ 3950 /* if beacon filtering isn't on mac80211 does it anyway */
diff --git a/drivers/net/wireless/iwlwifi/mvm/mvm.h b/drivers/net/wireless/iwlwifi/mvm/mvm.h
index 0173ad15ed46..255cde41d8b0 100644
--- a/drivers/net/wireless/iwlwifi/mvm/mvm.h
+++ b/drivers/net/wireless/iwlwifi/mvm/mvm.h
@@ -889,14 +889,15 @@ static inline bool iwl_mvm_is_d0i3_supported(struct iwl_mvm *mvm)
889 return mvm->trans->cfg->d0i3 && 889 return mvm->trans->cfg->d0i3 &&
890 mvm->trans->d0i3_mode != IWL_D0I3_MODE_OFF && 890 mvm->trans->d0i3_mode != IWL_D0I3_MODE_OFF &&
891 !iwlwifi_mod_params.d0i3_disable && 891 !iwlwifi_mod_params.d0i3_disable &&
892 (mvm->fw->ucode_capa.capa[0] & IWL_UCODE_TLV_CAPA_D0I3_SUPPORT); 892 fw_has_capa(&mvm->fw->ucode_capa,
893 IWL_UCODE_TLV_CAPA_D0I3_SUPPORT);
893} 894}
894 895
895static inline bool iwl_mvm_is_lar_supported(struct iwl_mvm *mvm) 896static inline bool iwl_mvm_is_lar_supported(struct iwl_mvm *mvm)
896{ 897{
897 bool nvm_lar = mvm->nvm_data->lar_enabled; 898 bool nvm_lar = mvm->nvm_data->lar_enabled;
898 bool tlv_lar = mvm->fw->ucode_capa.capa[0] & 899 bool tlv_lar = fw_has_capa(&mvm->fw->ucode_capa,
899 IWL_UCODE_TLV_CAPA_LAR_SUPPORT; 900 IWL_UCODE_TLV_CAPA_LAR_SUPPORT);
900 901
901 if (iwlwifi_mod_params.lar_disable) 902 if (iwlwifi_mod_params.lar_disable)
902 return false; 903 return false;
@@ -913,24 +914,28 @@ static inline bool iwl_mvm_is_lar_supported(struct iwl_mvm *mvm)
913 914
914static inline bool iwl_mvm_is_wifi_mcc_supported(struct iwl_mvm *mvm) 915static inline bool iwl_mvm_is_wifi_mcc_supported(struct iwl_mvm *mvm)
915{ 916{
916 return mvm->fw->ucode_capa.api[0] & IWL_UCODE_TLV_API_WIFI_MCC_UPDATE || 917 return fw_has_api(&mvm->fw->ucode_capa,
917 mvm->fw->ucode_capa.capa[0] & IWL_UCODE_TLV_CAPA_LAR_MULTI_MCC; 918 IWL_UCODE_TLV_API_WIFI_MCC_UPDATE) ||
919 fw_has_capa(&mvm->fw->ucode_capa,
920 IWL_UCODE_TLV_CAPA_LAR_MULTI_MCC);
918} 921}
919 922
920static inline bool iwl_mvm_is_scd_cfg_supported(struct iwl_mvm *mvm) 923static inline bool iwl_mvm_is_scd_cfg_supported(struct iwl_mvm *mvm)
921{ 924{
922 return mvm->fw->ucode_capa.api[0] & IWL_UCODE_TLV_API_SCD_CFG; 925 return fw_has_api(&mvm->fw->ucode_capa, IWL_UCODE_TLV_API_SCD_CFG);
923} 926}
924 927
925static inline bool iwl_mvm_bt_is_plcr_supported(struct iwl_mvm *mvm) 928static inline bool iwl_mvm_bt_is_plcr_supported(struct iwl_mvm *mvm)
926{ 929{
927 return (mvm->fw->ucode_capa.capa[0] & IWL_UCODE_TLV_CAPA_BT_COEX_PLCR) && 930 return fw_has_capa(&mvm->fw->ucode_capa,
931 IWL_UCODE_TLV_CAPA_BT_COEX_PLCR) &&
928 IWL_MVM_BT_COEX_CORUNNING; 932 IWL_MVM_BT_COEX_CORUNNING;
929} 933}
930 934
931static inline bool iwl_mvm_bt_is_rrc_supported(struct iwl_mvm *mvm) 935static inline bool iwl_mvm_bt_is_rrc_supported(struct iwl_mvm *mvm)
932{ 936{
933 return (mvm->fw->ucode_capa.capa[0] & IWL_UCODE_TLV_CAPA_BT_COEX_RRC) && 937 return fw_has_capa(&mvm->fw->ucode_capa,
938 IWL_UCODE_TLV_CAPA_BT_COEX_RRC) &&
934 IWL_MVM_BT_COEX_RRC; 939 IWL_MVM_BT_COEX_RRC;
935} 940}
936 941
diff --git a/drivers/net/wireless/iwlwifi/mvm/nvm.c b/drivers/net/wireless/iwlwifi/mvm/nvm.c
index 47014241bc3c..2a6be350704a 100644
--- a/drivers/net/wireless/iwlwifi/mvm/nvm.c
+++ b/drivers/net/wireless/iwlwifi/mvm/nvm.c
@@ -316,8 +316,8 @@ iwl_parse_nvm_sections(struct iwl_mvm *mvm)
316 phy_sku = (const __le16 *)sections[NVM_SECTION_TYPE_PHY_SKU].data; 316 phy_sku = (const __le16 *)sections[NVM_SECTION_TYPE_PHY_SKU].data;
317 317
318 lar_enabled = !iwlwifi_mod_params.lar_disable && 318 lar_enabled = !iwlwifi_mod_params.lar_disable &&
319 (mvm->fw->ucode_capa.capa[0] & 319 fw_has_capa(&mvm->fw->ucode_capa,
320 IWL_UCODE_TLV_CAPA_LAR_SUPPORT); 320 IWL_UCODE_TLV_CAPA_LAR_SUPPORT);
321 321
322 return iwl_parse_nvm_data(mvm->trans->dev, mvm->cfg, hw, sw, calib, 322 return iwl_parse_nvm_data(mvm->trans->dev, mvm->cfg, hw, sw, calib,
323 regulatory, mac_override, phy_sku, 323 regulatory, mac_override, phy_sku,
@@ -792,8 +792,8 @@ int iwl_mvm_init_mcc(struct iwl_mvm *mvm)
792 char mcc[3]; 792 char mcc[3];
793 793
794 if (mvm->cfg->device_family == IWL_DEVICE_FAMILY_8000) { 794 if (mvm->cfg->device_family == IWL_DEVICE_FAMILY_8000) {
795 tlv_lar = mvm->fw->ucode_capa.capa[0] & 795 tlv_lar = fw_has_capa(&mvm->fw->ucode_capa,
796 IWL_UCODE_TLV_CAPA_LAR_SUPPORT; 796 IWL_UCODE_TLV_CAPA_LAR_SUPPORT);
797 nvm_lar = mvm->nvm_data->lar_enabled; 797 nvm_lar = mvm->nvm_data->lar_enabled;
798 if (tlv_lar != nvm_lar) 798 if (tlv_lar != nvm_lar)
799 IWL_INFO(mvm, 799 IWL_INFO(mvm,
diff --git a/drivers/net/wireless/iwlwifi/mvm/rs.c b/drivers/net/wireless/iwlwifi/mvm/rs.c
index ae9965647771..daff1d0a8e4a 100644
--- a/drivers/net/wireless/iwlwifi/mvm/rs.c
+++ b/drivers/net/wireless/iwlwifi/mvm/rs.c
@@ -1127,8 +1127,8 @@ void iwl_mvm_rs_tx_status(struct iwl_mvm *mvm, struct ieee80211_sta *sta,
1127 u32 tx_resp_hwrate = (uintptr_t)info->status.status_driver_data[1]; 1127 u32 tx_resp_hwrate = (uintptr_t)info->status.status_driver_data[1];
1128 struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta); 1128 struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta);
1129 struct iwl_lq_sta *lq_sta = &mvmsta->lq_sta; 1129 struct iwl_lq_sta *lq_sta = &mvmsta->lq_sta;
1130 bool allow_ant_mismatch = mvm->fw->ucode_capa.api[0] & 1130 bool allow_ant_mismatch = fw_has_api(&mvm->fw->ucode_capa,
1131 IWL_UCODE_TLV_API_LQ_SS_PARAMS; 1131 IWL_UCODE_TLV_API_LQ_SS_PARAMS);
1132 1132
1133 /* Treat uninitialized rate scaling data same as non-existing. */ 1133 /* Treat uninitialized rate scaling data same as non-existing. */
1134 if (!lq_sta) { 1134 if (!lq_sta) {
@@ -2714,7 +2714,7 @@ static void rs_vht_init(struct iwl_mvm *mvm,
2714 (vht_cap->cap & IEEE80211_VHT_CAP_RXSTBC_MASK)) 2714 (vht_cap->cap & IEEE80211_VHT_CAP_RXSTBC_MASK))
2715 lq_sta->stbc_capable = true; 2715 lq_sta->stbc_capable = true;
2716 2716
2717 if ((mvm->fw->ucode_capa.capa[0] & IWL_UCODE_TLV_CAPA_BEAMFORMER) && 2717 if (fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_BEAMFORMER) &&
2718 (num_of_ant(iwl_mvm_get_valid_tx_ant(mvm)) > 1) && 2718 (num_of_ant(iwl_mvm_get_valid_tx_ant(mvm)) > 1) &&
2719 (vht_cap->cap & IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE)) 2719 (vht_cap->cap & IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE))
2720 lq_sta->bfer_capable = true; 2720 lq_sta->bfer_capable = true;
@@ -2998,7 +2998,7 @@ static void rs_build_rates_table(struct iwl_mvm *mvm,
2998 valid_tx_ant = iwl_mvm_get_valid_tx_ant(mvm); 2998 valid_tx_ant = iwl_mvm_get_valid_tx_ant(mvm);
2999 2999
3000 /* TODO: remove old API when min FW API hits 14 */ 3000 /* TODO: remove old API when min FW API hits 14 */
3001 if (!(mvm->fw->ucode_capa.api[0] & IWL_UCODE_TLV_API_LQ_SS_PARAMS) && 3001 if (!fw_has_api(&mvm->fw->ucode_capa, IWL_UCODE_TLV_API_LQ_SS_PARAMS) &&
3002 rs_stbc_allow(mvm, sta, lq_sta)) 3002 rs_stbc_allow(mvm, sta, lq_sta))
3003 rate.stbc = true; 3003 rate.stbc = true;
3004 3004
@@ -3212,7 +3212,7 @@ static void rs_fill_lq_cmd(struct iwl_mvm *mvm,
3212 3212
3213 rs_build_rates_table(mvm, sta, lq_sta, initial_rate); 3213 rs_build_rates_table(mvm, sta, lq_sta, initial_rate);
3214 3214
3215 if (mvm->fw->ucode_capa.api[0] & IWL_UCODE_TLV_API_LQ_SS_PARAMS) 3215 if (fw_has_api(&mvm->fw->ucode_capa, IWL_UCODE_TLV_API_LQ_SS_PARAMS))
3216 rs_set_lq_ss_params(mvm, sta, lq_sta, initial_rate); 3216 rs_set_lq_ss_params(mvm, sta, lq_sta, initial_rate);
3217 3217
3218 mvmsta = iwl_mvm_sta_from_mac80211(sta); 3218 mvmsta = iwl_mvm_sta_from_mac80211(sta);
diff --git a/drivers/net/wireless/iwlwifi/mvm/rx.c b/drivers/net/wireless/iwlwifi/mvm/rx.c
index d6314ddf57b5..8f1d93b7a13a 100644
--- a/drivers/net/wireless/iwlwifi/mvm/rx.c
+++ b/drivers/net/wireless/iwlwifi/mvm/rx.c
@@ -570,7 +570,7 @@ void iwl_mvm_handle_rx_statistics(struct iwl_mvm *mvm,
570 }; 570 };
571 u32 temperature; 571 u32 temperature;
572 572
573 if (mvm->fw->ucode_capa.api[0] & IWL_UCODE_TLV_API_STATS_V10) { 573 if (fw_has_api(&mvm->fw->ucode_capa, IWL_UCODE_TLV_API_STATS_V10)) {
574 struct iwl_notif_statistics_v10 *stats = (void *)&pkt->data; 574 struct iwl_notif_statistics_v10 *stats = (void *)&pkt->data;
575 575
576 if (iwl_rx_packet_payload_len(pkt) != v10_len) 576 if (iwl_rx_packet_payload_len(pkt) != v10_len)
@@ -610,7 +610,7 @@ void iwl_mvm_handle_rx_statistics(struct iwl_mvm *mvm,
610 /* Only handle rx statistics temperature changes if async temp 610 /* Only handle rx statistics temperature changes if async temp
611 * notifications are not supported 611 * notifications are not supported
612 */ 612 */
613 if (!(mvm->fw->ucode_capa.api[0] & IWL_UCODE_TLV_API_ASYNC_DTM)) 613 if (!fw_has_api(&mvm->fw->ucode_capa, IWL_UCODE_TLV_API_ASYNC_DTM))
614 iwl_mvm_tt_temp_changed(mvm, temperature); 614 iwl_mvm_tt_temp_changed(mvm, temperature);
615 615
616 ieee80211_iterate_active_interfaces(mvm->hw, 616 ieee80211_iterate_active_interfaces(mvm->hw,
diff --git a/drivers/net/wireless/iwlwifi/mvm/scan.c b/drivers/net/wireless/iwlwifi/mvm/scan.c
index 794109e617a1..5de144968723 100644
--- a/drivers/net/wireless/iwlwifi/mvm/scan.c
+++ b/drivers/net/wireless/iwlwifi/mvm/scan.c
@@ -160,7 +160,7 @@ iwl_mvm_scan_rate_n_flags(struct iwl_mvm *mvm, enum ieee80211_band band,
160static u16 iwl_mvm_get_active_dwell(struct iwl_mvm *mvm, 160static u16 iwl_mvm_get_active_dwell(struct iwl_mvm *mvm,
161 enum ieee80211_band band, int n_ssids) 161 enum ieee80211_band band, int n_ssids)
162{ 162{
163 if (mvm->fw->ucode_capa.api[0] & IWL_UCODE_TLV_API_BASIC_DWELL) 163 if (fw_has_api(&mvm->fw->ucode_capa, IWL_UCODE_TLV_API_BASIC_DWELL))
164 return 10; 164 return 10;
165 if (band == IEEE80211_BAND_2GHZ) 165 if (band == IEEE80211_BAND_2GHZ)
166 return 20 + 3 * (n_ssids + 1); 166 return 20 + 3 * (n_ssids + 1);
@@ -170,7 +170,7 @@ static u16 iwl_mvm_get_active_dwell(struct iwl_mvm *mvm,
170static u16 iwl_mvm_get_passive_dwell(struct iwl_mvm *mvm, 170static u16 iwl_mvm_get_passive_dwell(struct iwl_mvm *mvm,
171 enum ieee80211_band band) 171 enum ieee80211_band band)
172{ 172{
173 if (mvm->fw->ucode_capa.api[0] & IWL_UCODE_TLV_API_BASIC_DWELL) 173 if (fw_has_api(&mvm->fw->ucode_capa, IWL_UCODE_TLV_API_BASIC_DWELL))
174 return 110; 174 return 110;
175 return band == IEEE80211_BAND_2GHZ ? 100 + 20 : 100 + 10; 175 return band == IEEE80211_BAND_2GHZ ? 100 + 20 : 100 + 10;
176} 176}
@@ -205,8 +205,9 @@ static void iwl_mvm_scan_calc_dwell(struct iwl_mvm *mvm,
205 params->max_out_time = 120; 205 params->max_out_time = 120;
206 206
207 if (iwl_mvm_low_latency(mvm)) { 207 if (iwl_mvm_low_latency(mvm)) {
208 if (mvm->fw->ucode_capa.api[0] & 208 if (fw_has_api(&mvm->fw->ucode_capa,
209 IWL_UCODE_TLV_API_FRAGMENTED_SCAN) { 209 IWL_UCODE_TLV_API_FRAGMENTED_SCAN)) {
210
210 params->suspend_time = 105; 211 params->suspend_time = 105;
211 /* 212 /*
212 * If there is more than one active interface make 213 * If there is more than one active interface make
@@ -220,8 +221,9 @@ static void iwl_mvm_scan_calc_dwell(struct iwl_mvm *mvm,
220 } 221 }
221 } 222 }
222 223
223 if (frag_passive_dwell && (mvm->fw->ucode_capa.api[0] & 224 if (frag_passive_dwell &&
224 IWL_UCODE_TLV_API_FRAGMENTED_SCAN)) { 225 fw_has_api(&mvm->fw->ucode_capa,
226 IWL_UCODE_TLV_API_FRAGMENTED_SCAN)) {
225 /* 227 /*
226 * P2P device scan should not be fragmented to avoid negative 228 * P2P device scan should not be fragmented to avoid negative
227 * impact on P2P device discovery. Configure max_out_time to be 229 * impact on P2P device discovery. Configure max_out_time to be
@@ -273,8 +275,8 @@ not_bound:
273static inline bool iwl_mvm_rrm_scan_needed(struct iwl_mvm *mvm) 275static inline bool iwl_mvm_rrm_scan_needed(struct iwl_mvm *mvm)
274{ 276{
275 /* require rrm scan whenever the fw supports it */ 277 /* require rrm scan whenever the fw supports it */
276 return mvm->fw->ucode_capa.capa[0] & 278 return fw_has_capa(&mvm->fw->ucode_capa,
277 IWL_UCODE_TLV_CAPA_DS_PARAM_SET_IE_SUPPORT; 279 IWL_UCODE_TLV_CAPA_DS_PARAM_SET_IE_SUPPORT);
278} 280}
279 281
280static int iwl_mvm_max_scan_ie_fw_cmd_room(struct iwl_mvm *mvm) 282static int iwl_mvm_max_scan_ie_fw_cmd_room(struct iwl_mvm *mvm)
@@ -732,7 +734,8 @@ iwl_mvm_build_scan_probe(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
732static __le32 iwl_mvm_scan_priority(struct iwl_mvm *mvm, 734static __le32 iwl_mvm_scan_priority(struct iwl_mvm *mvm,
733 enum iwl_scan_priority_ext prio) 735 enum iwl_scan_priority_ext prio)
734{ 736{
735 if (mvm->fw->ucode_capa.api[0] & IWL_UCODE_TLV_API_EXT_SCAN_PRIORITY) 737 if (fw_has_api(&mvm->fw->ucode_capa,
738 IWL_UCODE_TLV_API_EXT_SCAN_PRIORITY))
736 return cpu_to_le32(prio); 739 return cpu_to_le32(prio);
737 740
738 if (prio <= IWL_SCAN_PRIORITY_EXT_2) 741 if (prio <= IWL_SCAN_PRIORITY_EXT_2)
@@ -785,7 +788,7 @@ static inline bool iwl_mvm_scan_use_ebs(struct iwl_mvm *mvm,
785 return ((capa->flags & IWL_UCODE_TLV_FLAGS_EBS_SUPPORT) && 788 return ((capa->flags & IWL_UCODE_TLV_FLAGS_EBS_SUPPORT) &&
786 mvm->last_ebs_successful && 789 mvm->last_ebs_successful &&
787 (n_iterations > 1 || 790 (n_iterations > 1 ||
788 (capa->api[0] & IWL_UCODE_TLV_API_SINGLE_SCAN_EBS)) && 791 fw_has_api(capa, IWL_UCODE_TLV_API_SINGLE_SCAN_EBS)) &&
789 vif->type != NL80211_IFTYPE_P2P_DEVICE); 792 vif->type != NL80211_IFTYPE_P2P_DEVICE);
790} 793}
791 794
@@ -1233,7 +1236,7 @@ int iwl_mvm_reg_scan_start(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
1233 1236
1234 iwl_mvm_build_scan_probe(mvm, vif, ies, &params); 1237 iwl_mvm_build_scan_probe(mvm, vif, ies, &params);
1235 1238
1236 if (mvm->fw->ucode_capa.capa[0] & IWL_UCODE_TLV_CAPA_UMAC_SCAN) { 1239 if (fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_UMAC_SCAN)) {
1237 hcmd.id = SCAN_REQ_UMAC; 1240 hcmd.id = SCAN_REQ_UMAC;
1238 ret = iwl_mvm_scan_umac(mvm, vif, &params, 1241 ret = iwl_mvm_scan_umac(mvm, vif, &params,
1239 IWL_MVM_SCAN_REGULAR); 1242 IWL_MVM_SCAN_REGULAR);
@@ -1341,7 +1344,7 @@ int iwl_mvm_sched_scan_start(struct iwl_mvm *mvm,
1341 1344
1342 iwl_mvm_build_scan_probe(mvm, vif, ies, &params); 1345 iwl_mvm_build_scan_probe(mvm, vif, ies, &params);
1343 1346
1344 if (mvm->fw->ucode_capa.capa[0] & IWL_UCODE_TLV_CAPA_UMAC_SCAN) { 1347 if (fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_UMAC_SCAN)) {
1345 hcmd.id = SCAN_REQ_UMAC; 1348 hcmd.id = SCAN_REQ_UMAC;
1346 ret = iwl_mvm_scan_umac(mvm, vif, &params, IWL_MVM_SCAN_SCHED); 1349 ret = iwl_mvm_scan_umac(mvm, vif, &params, IWL_MVM_SCAN_SCHED);
1347 } else { 1350 } else {
@@ -1468,7 +1471,7 @@ static int iwl_mvm_scan_stop_wait(struct iwl_mvm *mvm, int type)
1468 1471
1469 IWL_DEBUG_SCAN(mvm, "Preparing to stop scan, type %x\n", type); 1472 IWL_DEBUG_SCAN(mvm, "Preparing to stop scan, type %x\n", type);
1470 1473
1471 if (mvm->fw->ucode_capa.capa[0] & IWL_UCODE_TLV_CAPA_UMAC_SCAN) 1474 if (fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_UMAC_SCAN))
1472 ret = iwl_mvm_umac_scan_abort(mvm, type); 1475 ret = iwl_mvm_umac_scan_abort(mvm, type);
1473 else 1476 else
1474 ret = iwl_mvm_lmac_scan_abort(mvm); 1477 ret = iwl_mvm_lmac_scan_abort(mvm);
@@ -1486,7 +1489,7 @@ static int iwl_mvm_scan_stop_wait(struct iwl_mvm *mvm, int type)
1486 1489
1487int iwl_mvm_scan_size(struct iwl_mvm *mvm) 1490int iwl_mvm_scan_size(struct iwl_mvm *mvm)
1488{ 1491{
1489 if (mvm->fw->ucode_capa.capa[0] & IWL_UCODE_TLV_CAPA_UMAC_SCAN) 1492 if (fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_UMAC_SCAN))
1490 return sizeof(struct iwl_scan_req_umac) + 1493 return sizeof(struct iwl_scan_req_umac) +
1491 sizeof(struct iwl_scan_channel_cfg_umac) * 1494 sizeof(struct iwl_scan_channel_cfg_umac) *
1492 mvm->fw->ucode_capa.n_scan_channels + 1495 mvm->fw->ucode_capa.n_scan_channels +
@@ -1504,7 +1507,7 @@ int iwl_mvm_scan_size(struct iwl_mvm *mvm)
1504 */ 1507 */
1505void iwl_mvm_report_scan_aborted(struct iwl_mvm *mvm) 1508void iwl_mvm_report_scan_aborted(struct iwl_mvm *mvm)
1506{ 1509{
1507 if (mvm->fw->ucode_capa.capa[0] & IWL_UCODE_TLV_CAPA_UMAC_SCAN) { 1510 if (fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_UMAC_SCAN)) {
1508 int uid, i; 1511 int uid, i;
1509 1512
1510 uid = iwl_mvm_scan_uid_by_status(mvm, IWL_MVM_SCAN_REGULAR); 1513 uid = iwl_mvm_scan_uid_by_status(mvm, IWL_MVM_SCAN_REGULAR);
diff --git a/drivers/net/wireless/iwlwifi/mvm/tx.c b/drivers/net/wireless/iwlwifi/mvm/tx.c
index 57e0cbb35f37..7ba7a118ff5c 100644
--- a/drivers/net/wireless/iwlwifi/mvm/tx.c
+++ b/drivers/net/wireless/iwlwifi/mvm/tx.c
@@ -171,8 +171,8 @@ void iwl_mvm_set_tx_cmd(struct iwl_mvm *mvm, struct sk_buff *skb,
171 !is_multicast_ether_addr(ieee80211_get_DA(hdr))) 171 !is_multicast_ether_addr(ieee80211_get_DA(hdr)))
172 tx_flags |= TX_CMD_FLG_PROT_REQUIRE; 172 tx_flags |= TX_CMD_FLG_PROT_REQUIRE;
173 173
174 if ((mvm->fw->ucode_capa.capa[0] & 174 if (fw_has_capa(&mvm->fw->ucode_capa,
175 IWL_UCODE_TLV_CAPA_TXPOWER_INSERTION_SUPPORT) && 175 IWL_UCODE_TLV_CAPA_TXPOWER_INSERTION_SUPPORT) &&
176 ieee80211_action_contains_tpc(skb)) 176 ieee80211_action_contains_tpc(skb))
177 tx_flags |= TX_CMD_FLG_WRITE_TX_POWER; 177 tx_flags |= TX_CMD_FLG_WRITE_TX_POWER;
178 178
diff --git a/drivers/net/wireless/iwlwifi/mvm/utils.c b/drivers/net/wireless/iwlwifi/mvm/utils.c
index bc55a8b82db6..03f8e06dded7 100644
--- a/drivers/net/wireless/iwlwifi/mvm/utils.c
+++ b/drivers/net/wireless/iwlwifi/mvm/utils.c
@@ -584,7 +584,7 @@ void iwl_mvm_dump_nic_error_log(struct iwl_mvm *mvm)
584 struct iwl_error_event_table table; 584 struct iwl_error_event_table table;
585 u32 base; 585 u32 base;
586 586
587 if (!(mvm->fw->ucode_capa.api[0] & IWL_UCODE_TLV_API_NEW_VERSION)) { 587 if (!fw_has_api(&mvm->fw->ucode_capa, IWL_UCODE_TLV_API_NEW_VERSION)) {
588 iwl_mvm_dump_nic_error_log_old(mvm); 588 iwl_mvm_dump_nic_error_log_old(mvm);
589 return; 589 return;
590 } 590 }