]> git.baikalelectronics.ru Git - kernel.git/commitdiff
iwlwifi: mvm: add a get lmac id function
authorNathan Errera <nathan.errera@intel.com>
Thu, 8 Oct 2020 15:09:46 +0000 (18:09 +0300)
committerKalle Valo <kvalo@codeaurora.org>
Thu, 8 Oct 2020 17:09:36 +0000 (20:09 +0300)
As some functions need to check which lmac id to use, add
a new function to find the lmac id instead of open coding it
in every function.

Signed-off-by: Nathan Errera <nathan.errera@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Link: https://lore.kernel.org/r/iwlwifi.20201008180656.ac3b43e97aa8.I308f8ed2238e32d5eef9c35ad7962f0e8b9c1902@changeid
drivers/net/wireless/intel/iwlwifi/fw/api/binding.h
drivers/net/wireless/intel/iwlwifi/mvm/binding.c
drivers/net/wireless/intel/iwlwifi/mvm/phy-ctxt.c
drivers/net/wireless/intel/iwlwifi/mvm/tx.c

index 570f19026c915dfb636faca786f220b44977e9f1..6cb22a9a93807bd081df94fa9ae09a4c7cfce7c0 100644 (file)
@@ -5,7 +5,7 @@
  *
  * GPL LICENSE SUMMARY
  *
- * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
+ * Copyright(c) 2012 - 2014, 2020 Intel Corporation. All rights reserved.
  * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
  * Copyright(c) 2016 - 2017 Intel Deutschland GmbH
  *
@@ -27,7 +27,7 @@
  *
  * BSD LICENSE
  *
- * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
+ * Copyright(c) 2012 - 2014, 2020 Intel Corporation. All rights reserved.
  * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
  * Copyright(c) 2016 - 2017 Intel Deutschland GmbH
  * All rights reserved.
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
  *****************************************************************************/
-
 #ifndef __iwl_fw_api_binding_h__
 #define __iwl_fw_api_binding_h__
 
+#include <fw/file.h>
+#include <fw/img.h>
+
 #define MAX_MACS_IN_BINDING    (3)
 #define MAX_BINDINGS           (4)
 
@@ -112,6 +114,14 @@ struct iwl_binding_cmd {
 #define IWL_LMAC_24G_INDEX             0
 #define IWL_LMAC_5G_INDEX              1
 
+static inline u32 iwl_mvm_get_lmac_id(const struct iwl_fw *fw,
+                                     enum nl80211_band band){
+       if (!fw_has_capa(&fw->ucode_capa, IWL_UCODE_TLV_CAPA_CDB_SUPPORT) ||
+           band == NL80211_BAND_2GHZ)
+               return IWL_LMAC_24G_INDEX;
+       return IWL_LMAC_5G_INDEX;
+}
+
 /* The maximal number of fragments in the FW's schedule session */
 #define IWL_MVM_MAX_QUOTA 128
 
index 4094a41580323b03f2149990b1f216bb8e8da889..5e731c57e4f74bcdddea593a5536072b0cf6a4e8 100644 (file)
@@ -5,7 +5,7 @@
  *
  * GPL LICENSE SUMMARY
  *
- * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
+ * Copyright(c) 2012 - 2014, 2020 Intel Corporation. All rights reserved.
  * Copyright(c) 2016 Intel Deutschland GmbH
  *
  * This program is free software; you can redistribute it and/or modify
@@ -26,7 +26,7 @@
  *
  * BSD LICENSE
  *
- * Copyright(c) 2012 - 2014 Intel Corporation. All rights reserved.
+ * Copyright(c) 2012 - 2014, 2020 Intel Corporation. All rights reserved.
  * Copyright(c) 2016 Intel Deutschland GmbH
  * All rights reserved.
  *
@@ -86,11 +86,8 @@ static int iwl_mvm_binding_cmd(struct iwl_mvm *mvm, u32 action,
        if (fw_has_capa(&mvm->fw->ucode_capa,
                        IWL_UCODE_TLV_CAPA_BINDING_CDB_SUPPORT)) {
                size = sizeof(cmd);
-               if (phyctxt->channel->band == NL80211_BAND_2GHZ ||
-                   !iwl_mvm_is_cdb_supported(mvm))
-                       cmd.lmac_id = cpu_to_le32(IWL_LMAC_24G_INDEX);
-               else
-                       cmd.lmac_id = cpu_to_le32(IWL_LMAC_5G_INDEX);
+               cmd.lmac_id = cpu_to_le32(iwl_mvm_get_lmac_id(mvm->fw,
+                                                             phyctxt->channel->band));
        } else {
                size = IWL_BINDING_CMD_SIZE_V1;
        }
index a5da4106ba5a6808d881c8cb9aaeae6accbb32b7..bf2fc44dcb8daf42b1aeca317be1bc759ec8abd2 100644 (file)
@@ -194,11 +194,8 @@ static void iwl_mvm_phy_ctxt_cmd_data(struct iwl_mvm *mvm,
                                      struct cfg80211_chan_def *chandef,
                                      u8 chains_static, u8 chains_dynamic)
 {
-       if (chandef->chan->band == NL80211_BAND_2GHZ ||
-           !iwl_mvm_is_cdb_supported(mvm))
-               cmd->lmac_id = cpu_to_le32(IWL_LMAC_24G_INDEX);
-       else
-               cmd->lmac_id = cpu_to_le32(IWL_LMAC_5G_INDEX);
+       cmd->lmac_id = cpu_to_le32(iwl_mvm_get_lmac_id(mvm->fw,
+                                                      chandef->chan->band));
 
        /* Set the channel info data */
        iwl_mvm_set_chan_info_chandef(mvm, &cmd->ci, chandef);
index 12e5d00ef5cdfcbceb7d68bf64ab8c166cf7679d..fe1c538cd718289abb11486df6146940d729e687 100644 (file)
@@ -793,11 +793,7 @@ unsigned int iwl_mvm_max_amsdu_size(struct iwl_mvm *mvm,
        enum nl80211_band band = mvmsta->vif->bss_conf.chandef.chan->band;
        u8 ac = tid_to_mac80211_ac[tid];
        unsigned int txf;
-       int lmac = IWL_LMAC_24G_INDEX;
-
-       if (iwl_mvm_is_cdb_supported(mvm) &&
-           band == NL80211_BAND_5GHZ)
-               lmac = IWL_LMAC_5G_INDEX;
+       int lmac = iwl_mvm_get_lmac_id(mvm->fw, band);
 
        /* For HE redirect to trigger based fifos */
        if (sta->he_cap.has_he && !WARN_ON(!iwl_mvm_has_new_tx_api(mvm)))