aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2016-06-21 06:34:36 -0400
committerLuca Coelho <luciano.coelho@intel.com>2016-07-06 03:08:25 -0400
commit24ddddf3673b43708c9e7edc576b4d14a81a43e9 (patch)
treed7bc04a96e85e618bcb800b4d76f3b1ccf598ea7 /drivers
parent60dec5233cd8651860e8010c953d116fb0f1ba86 (diff)
iwlwifi: store cipher scheme independent of mac80211
In order to reduce reliance on mac80211 structs in the core iwlwifi code, store the cipher schemes in the format given by the firmware and convert it later, rather than storing it in the mac80211 format. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/intel/iwlwifi/iwl-drv.c16
-rw-r--r--drivers/net/wireless/intel/iwlwifi/iwl-fw.h3
-rw-r--r--drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c19
-rw-r--r--drivers/net/wireless/intel/iwlwifi/mvm/mvm.h1
4 files changed, 20 insertions, 19 deletions
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c b/drivers/net/wireless/intel/iwlwifi/iwl-drv.c
index e2df544cc64e..d675bf0a9e99 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-drv.c
@@ -326,8 +326,6 @@ static int iwl_store_cscheme(struct iwl_fw *fw, const u8 *data, const u32 len)
326 int i, j; 326 int i, j;
327 struct iwl_fw_cscheme_list *l = (struct iwl_fw_cscheme_list *)data; 327 struct iwl_fw_cscheme_list *l = (struct iwl_fw_cscheme_list *)data;
328 struct iwl_fw_cipher_scheme *fwcs; 328 struct iwl_fw_cipher_scheme *fwcs;
329 struct ieee80211_cipher_scheme *cs;
330 u32 cipher;
331 329
332 if (len < sizeof(*l) || 330 if (len < sizeof(*l) ||
333 len < sizeof(l->size) + l->size * sizeof(l->cs[0])) 331 len < sizeof(l->size) + l->size * sizeof(l->cs[0]))
@@ -335,22 +333,12 @@ static int iwl_store_cscheme(struct iwl_fw *fw, const u8 *data, const u32 len)
335 333
336 for (i = 0, j = 0; i < IWL_UCODE_MAX_CS && i < l->size; i++) { 334 for (i = 0, j = 0; i < IWL_UCODE_MAX_CS && i < l->size; i++) {
337 fwcs = &l->cs[j]; 335 fwcs = &l->cs[j];
338 cipher = le32_to_cpu(fwcs->cipher);
339 336
340 /* we skip schemes with zero cipher suite selector */ 337 /* we skip schemes with zero cipher suite selector */
341 if (!cipher) 338 if (!fwcs->cipher)
342 continue; 339 continue;
343 340
344 cs = &fw->cs[j++]; 341 fw->cs[j++] = *fwcs;
345 cs->cipher = cipher;
346 cs->iftype = BIT(NL80211_IFTYPE_STATION);
347 cs->hdr_len = fwcs->hdr_len;
348 cs->pn_len = fwcs->pn_len;
349 cs->pn_off = fwcs->pn_off;
350 cs->key_idx_off = fwcs->key_idx_off;
351 cs->key_idx_mask = fwcs->key_idx_mask;
352 cs->key_idx_shift = fwcs->key_idx_shift;
353 cs->mic_len = fwcs->mic_len;
354 } 342 }
355 343
356 return 0; 344 return 0;
diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-fw.h b/drivers/net/wireless/intel/iwlwifi/iwl-fw.h
index 655ec52a0c03..74ea68d1063c 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-fw.h
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-fw.h
@@ -67,7 +67,6 @@
67#ifndef __iwl_fw_h__ 67#ifndef __iwl_fw_h__
68#define __iwl_fw_h__ 68#define __iwl_fw_h__
69#include <linux/types.h> 69#include <linux/types.h>
70#include <net/mac80211.h>
71 70
72#include "iwl-fw-file.h" 71#include "iwl-fw-file.h"
73#include "iwl-fw-error-dump.h" 72#include "iwl-fw-error-dump.h"
@@ -287,7 +286,7 @@ struct iwl_fw {
287 286
288 enum iwl_fw_type type; 287 enum iwl_fw_type type;
289 288
290 struct ieee80211_cipher_scheme cs[IWL_UCODE_MAX_CS]; 289 struct iwl_fw_cipher_scheme cs[IWL_UCODE_MAX_CS];
291 u8 human_readable[FW_VER_HUMAN_READABLE_SZ]; 290 u8 human_readable[FW_VER_HUMAN_READABLE_SZ];
292 291
293 u32 sdio_adma_addr; 292 u32 sdio_adma_addr;
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
index e44c337e604e..73e49d3a8814 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
@@ -494,10 +494,23 @@ int iwl_mvm_mac_setup_register(struct iwl_mvm *mvm)
494 494
495 /* currently FW API supports only one optional cipher scheme */ 495 /* currently FW API supports only one optional cipher scheme */
496 if (mvm->fw->cs[0].cipher) { 496 if (mvm->fw->cs[0].cipher) {
497 const struct iwl_fw_cipher_scheme *fwcs = &mvm->fw->cs[0];
498 struct ieee80211_cipher_scheme *cs = &mvm->cs[0];
499
497 mvm->hw->n_cipher_schemes = 1; 500 mvm->hw->n_cipher_schemes = 1;
498 mvm->hw->cipher_schemes = &mvm->fw->cs[0]; 501
499 mvm->ciphers[hw->wiphy->n_cipher_suites] = 502 cs->cipher = le32_to_cpu(fwcs->cipher);
500 mvm->fw->cs[0].cipher; 503 cs->iftype = BIT(NL80211_IFTYPE_STATION);
504 cs->hdr_len = fwcs->hdr_len;
505 cs->pn_len = fwcs->pn_len;
506 cs->pn_off = fwcs->pn_off;
507 cs->key_idx_off = fwcs->key_idx_off;
508 cs->key_idx_mask = fwcs->key_idx_mask;
509 cs->key_idx_shift = fwcs->key_idx_shift;
510 cs->mic_len = fwcs->mic_len;
511
512 mvm->hw->cipher_schemes = mvm->cs;
513 mvm->ciphers[hw->wiphy->n_cipher_suites] = cs->cipher;
501 hw->wiphy->n_cipher_suites++; 514 hw->wiphy->n_cipher_suites++;
502 } 515 }
503 516
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
index c440b10b3cde..b4fc86d5d7ef 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
@@ -1012,6 +1012,7 @@ struct iwl_mvm {
1012 struct iwl_mvm_shared_mem_cfg shared_mem_cfg; 1012 struct iwl_mvm_shared_mem_cfg shared_mem_cfg;
1013 1013
1014 u32 ciphers[IWL_MVM_NUM_CIPHERS]; 1014 u32 ciphers[IWL_MVM_NUM_CIPHERS];
1015 struct ieee80211_cipher_scheme cs[IWL_UCODE_MAX_CS];
1015 struct iwl_mvm_tof_data tof_data; 1016 struct iwl_mvm_tof_data tof_data;
1016 1017
1017 struct ieee80211_vif *nan_vif; 1018 struct ieee80211_vif *nan_vif;