iwlwifi: mvm: add support for new version of WOWLAN_TKIP_SETTING_API_S
authorDan Halperin <Dan1.Halperin@intel.com>
Fri, 25 Sep 2020 21:30:45 +0000 (00:30 +0300)
committerLuca Coelho <luciano.coelho@intel.com>
Thu, 1 Oct 2020 18:58:22 +0000 (21:58 +0300)
Add a sta_id (__le32) to the cmd, in order to support CDB protocol.

Signed-off-by: Dan Halperin <Dan1.Halperin@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20200926002540.5edc24ef3907.I68820c8c0946451cf0cca14dda171fa304b1dc43@changeid
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
drivers/net/wireless/intel/iwlwifi/fw/api/d3.h
drivers/net/wireless/intel/iwlwifi/mvm/d3.c

index c4562e1..c44384b 100644 (file)
@@ -8,7 +8,7 @@
  * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
  * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH
  * Copyright(c) 2015 - 2017 Intel Deutschland GmbH
- * Copyright(c) 2018 - 2019 Intel Corporation
+ * Copyright(c) 2018 - 2020 Intel Corporation
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of version 2 of the GNU General Public License as
@@ -31,7 +31,7 @@
  * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
  * Copyright(c) 2013 - 2014 Intel Mobile Communications GmbH
  * Copyright(c) 2015 - 2017 Intel Deutschland GmbH
- * Copyright(c) 2018 - 2019 Intel Corporation
+ * Copyright(c) 2018 - 2020 Intel Corporation
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -469,13 +469,22 @@ struct iwl_p1k_cache {
 
 #define IWL_NUM_RX_P1K_CACHE   2
 
-struct iwl_wowlan_tkip_params_cmd {
+struct iwl_wowlan_tkip_params_cmd_ver_1 {
        struct iwl_mic_keys mic_keys;
        struct iwl_p1k_cache tx;
        struct iwl_p1k_cache rx_uni[IWL_NUM_RX_P1K_CACHE];
        struct iwl_p1k_cache rx_multi[IWL_NUM_RX_P1K_CACHE];
 } __packed; /* WOWLAN_TKIP_SETTING_API_S_VER_1 */
 
+struct iwl_wowlan_tkip_params_cmd {
+       struct iwl_mic_keys mic_keys;
+       struct iwl_p1k_cache tx;
+       struct iwl_p1k_cache rx_uni[IWL_NUM_RX_P1K_CACHE];
+       struct iwl_p1k_cache rx_multi[IWL_NUM_RX_P1K_CACHE];
+       u8     reversed[2];
+       __le32 sta_id;
+} __packed; /* WOWLAN_TKIP_SETTING_API_S_VER_2 */
+
 #define IWL_KCK_MAX_SIZE       32
 #define IWL_KEK_MAX_SIZE       32
 
index bcdd2b3..081d354 100644 (file)
@@ -783,9 +783,26 @@ static int iwl_mvm_wowlan_config_key_params(struct iwl_mvm *mvm,
        if (key_data.use_tkip &&
            !fw_has_api(&mvm->fw->ucode_capa,
                        IWL_UCODE_TLV_API_TKIP_MIC_KEYS)) {
+               int ver = iwl_fw_lookup_cmd_ver(mvm->fw, LONG_GROUP,
+                                               WOWLAN_TKIP_PARAM);
+               int size;
+
+               if (ver == 2) {
+                       size = sizeof(tkip_cmd);
+                       key_data.tkip->sta_id =
+                               cpu_to_le32(mvmvif->ap_sta_id);
+               } else if (ver == 1 || ver == IWL_FW_CMD_VER_UNKNOWN) {
+                       size = sizeof(struct iwl_wowlan_tkip_params_cmd_ver_1);
+               } else {
+                       ret =  -EINVAL;
+                       WARN_ON_ONCE(1);
+                       goto out;
+               }
+
+               /* send relevant data according to CMD version */
                ret = iwl_mvm_send_cmd_pdu(mvm,
                                           WOWLAN_TKIP_PARAM,
-                                          cmd_flags, sizeof(tkip_cmd),
+                                          cmd_flags, size,
                                           &tkip_cmd);
                if (ret)
                        goto out;