Skip to content

Commit

Permalink
iwlwifi: mvm: add a get lmac id function
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Nathan Errera authored and Kalle Valo committed Oct 8, 2020
1 parent f908477 commit aa4936b
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 20 deletions.
16 changes: 13 additions & 3 deletions drivers/net/wireless/intel/iwlwifi/fw/api/binding.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand All @@ -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.
Expand Down Expand Up @@ -59,10 +59,12 @@
* 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)

Expand Down Expand Up @@ -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

Expand Down
11 changes: 4 additions & 7 deletions drivers/net/wireless/intel/iwlwifi/mvm/binding.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
*
Expand Down Expand Up @@ -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;
}
Expand Down
7 changes: 2 additions & 5 deletions drivers/net/wireless/intel/iwlwifi/mvm/phy-ctxt.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 1 addition & 5 deletions drivers/net/wireless/intel/iwlwifi/mvm/tx.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
Expand Down

0 comments on commit aa4936b

Please sign in to comment.