aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless
diff options
context:
space:
mode:
authorNaftali Goldstein <naftali.goldstein@intel.com>2018-06-12 02:08:40 -0400
committerLuca Coelho <luciano.coelho@intel.com>2018-10-06 03:25:50 -0400
commite7eeee08434873c2f781dc1afaa42b03a014b95d (patch)
treec22a66d672efea2fc1c3703784c80d90af41d3c0 /drivers/net/wireless
parentf38efdb29389cc3ac6a466896a01f0fbdb14f4c7 (diff)
iwlwifi: nvm: get num of hw addresses from firmware
With NICs that don't read the NVM directly and instead rely on getting the relevant data from the firmware, the number of reserved MAC addresses was not added to the API. This caused the driver to assume there is only one address which results in all interfaces getting the same address. Update the API to fix this. While at it, fix-up the comments with firmware api names to actually match what we have in the firmware. Fixes: e9e1ba3dbf00 ("iwlwifi: mvm: support getting nvm data from firmware") Signed-off-by: Naftali Goldstein <naftali.goldstein@intel.com> Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r--drivers/net/wireless/intel/iwlwifi/fw/api/nvm-reg.h14
-rw-r--r--drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c10
2 files changed, 16 insertions, 8 deletions
diff --git a/drivers/net/wireless/intel/iwlwifi/fw/api/nvm-reg.h b/drivers/net/wireless/intel/iwlwifi/fw/api/nvm-reg.h
index 6c5338364794..d22c1eefba6a 100644
--- a/drivers/net/wireless/intel/iwlwifi/fw/api/nvm-reg.h
+++ b/drivers/net/wireless/intel/iwlwifi/fw/api/nvm-reg.h
@@ -165,7 +165,7 @@ struct iwl_nvm_access_resp {
165 */ 165 */
166struct iwl_nvm_get_info { 166struct iwl_nvm_get_info {
167 __le32 reserved; 167 __le32 reserved;
168} __packed; /* GRP_REGULATORY_NVM_GET_INFO_CMD_S_VER_1 */ 168} __packed; /* REGULATORY_NVM_GET_INFO_CMD_API_S_VER_1 */
169 169
170/** 170/**
171 * enum iwl_nvm_info_general_flags - flags in NVM_GET_INFO resp 171 * enum iwl_nvm_info_general_flags - flags in NVM_GET_INFO resp
@@ -180,14 +180,14 @@ enum iwl_nvm_info_general_flags {
180 * @flags: bit 0: 1 - empty, 0 - non-empty 180 * @flags: bit 0: 1 - empty, 0 - non-empty
181 * @nvm_version: nvm version 181 * @nvm_version: nvm version
182 * @board_type: board type 182 * @board_type: board type
183 * @reserved: reserved 183 * @n_hw_addrs: number of reserved MAC addresses
184 */ 184 */
185struct iwl_nvm_get_info_general { 185struct iwl_nvm_get_info_general {
186 __le32 flags; 186 __le32 flags;
187 __le16 nvm_version; 187 __le16 nvm_version;
188 u8 board_type; 188 u8 board_type;
189 u8 reserved; 189 u8 n_hw_addrs;
190} __packed; /* GRP_REGULATORY_NVM_GET_INFO_GENERAL_S_VER_1 */ 190} __packed; /* REGULATORY_NVM_GET_INFO_GENERAL_S_VER_2 */
191 191
192/** 192/**
193 * enum iwl_nvm_mac_sku_flags - flags in &iwl_nvm_get_info_sku 193 * enum iwl_nvm_mac_sku_flags - flags in &iwl_nvm_get_info_sku
@@ -231,7 +231,7 @@ struct iwl_nvm_get_info_sku {
231struct iwl_nvm_get_info_phy { 231struct iwl_nvm_get_info_phy {
232 __le32 tx_chains; 232 __le32 tx_chains;
233 __le32 rx_chains; 233 __le32 rx_chains;
234} __packed; /* GRP_REGULATORY_NVM_GET_INFO_PHY_SKU_SECTION_S_VER_1 */ 234} __packed; /* REGULATORY_NVM_GET_INFO_PHY_SKU_SECTION_S_VER_1 */
235 235
236#define IWL_NUM_CHANNELS (51) 236#define IWL_NUM_CHANNELS (51)
237 237
@@ -245,7 +245,7 @@ struct iwl_nvm_get_info_regulatory {
245 __le32 lar_enabled; 245 __le32 lar_enabled;
246 __le16 channel_profile[IWL_NUM_CHANNELS]; 246 __le16 channel_profile[IWL_NUM_CHANNELS];
247 __le16 reserved; 247 __le16 reserved;
248} __packed; /* GRP_REGULATORY_NVM_GET_INFO_REGULATORY_S_VER_1 */ 248} __packed; /* REGULATORY_NVM_GET_INFO_REGULATORY_S_VER_1 */
249 249
250/** 250/**
251 * struct iwl_nvm_get_info_rsp - response to get NVM data 251 * struct iwl_nvm_get_info_rsp - response to get NVM data
@@ -259,7 +259,7 @@ struct iwl_nvm_get_info_rsp {
259 struct iwl_nvm_get_info_sku mac_sku; 259 struct iwl_nvm_get_info_sku mac_sku;
260 struct iwl_nvm_get_info_phy phy_sku; 260 struct iwl_nvm_get_info_phy phy_sku;
261 struct iwl_nvm_get_info_regulatory regulatory; 261 struct iwl_nvm_get_info_regulatory regulatory;
262} __packed; /* GRP_REGULATORY_NVM_GET_INFO_CMD_RSP_S_VER_2 */ 262} __packed; /* REGULATORY_NVM_GET_INFO_RSP_API_S_VER_3 */
263 263
264/** 264/**
265 * struct iwl_nvm_access_complete_cmd - NVM_ACCESS commands are completed 265 * struct iwl_nvm_access_complete_cmd - NVM_ACCESS commands are completed
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c b/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c
index ec300d388694..96e101d79662 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-nvm-parse.c
@@ -1335,6 +1335,7 @@ struct iwl_nvm_data *iwl_get_nvm(struct iwl_trans *trans,
1335 bool lar_fw_supported = !iwlwifi_mod_params.lar_disable && 1335 bool lar_fw_supported = !iwlwifi_mod_params.lar_disable &&
1336 fw_has_capa(&fw->ucode_capa, 1336 fw_has_capa(&fw->ucode_capa,
1337 IWL_UCODE_TLV_CAPA_LAR_SUPPORT); 1337 IWL_UCODE_TLV_CAPA_LAR_SUPPORT);
1338 bool empty_otp;
1338 u32 mac_flags; 1339 u32 mac_flags;
1339 u32 sbands_flags = 0; 1340 u32 sbands_flags = 0;
1340 1341
@@ -1350,7 +1351,9 @@ struct iwl_nvm_data *iwl_get_nvm(struct iwl_trans *trans,
1350 } 1351 }
1351 1352
1352 rsp = (void *)hcmd.resp_pkt->data; 1353 rsp = (void *)hcmd.resp_pkt->data;
1353 if (le32_to_cpu(rsp->general.flags) & NVM_GENERAL_FLAGS_EMPTY_OTP) 1354 empty_otp = !!(le32_to_cpu(rsp->general.flags) &
1355 NVM_GENERAL_FLAGS_EMPTY_OTP);
1356 if (empty_otp)
1354 IWL_INFO(trans, "OTP is empty\n"); 1357 IWL_INFO(trans, "OTP is empty\n");
1355 1358
1356 nvm = kzalloc(sizeof(*nvm) + 1359 nvm = kzalloc(sizeof(*nvm) +
@@ -1374,6 +1377,11 @@ struct iwl_nvm_data *iwl_get_nvm(struct iwl_trans *trans,
1374 1377
1375 /* Initialize general data */ 1378 /* Initialize general data */
1376 nvm->nvm_version = le16_to_cpu(rsp->general.nvm_version); 1379 nvm->nvm_version = le16_to_cpu(rsp->general.nvm_version);
1380 nvm->n_hw_addrs = rsp->general.n_hw_addrs;
1381 if (nvm->n_hw_addrs == 0)
1382 IWL_WARN(trans,
1383 "Firmware declares no reserved mac addresses. OTP is empty: %d\n",
1384 empty_otp);
1377 1385
1378 /* Initialize MAC sku data */ 1386 /* Initialize MAC sku data */
1379 mac_flags = le32_to_cpu(rsp->mac_sku.mac_sku_flags); 1387 mac_flags = le32_to_cpu(rsp->mac_sku.mac_sku_flags);