Commit 6f4dcc76 authored by Luciano Coelho's avatar Luciano Coelho Committed by Emmanuel Grumbach

iwlwifi: mvm: move all UMAC scan flags setting into the relevant function

Clean the code a little by moving all the flags into the right
function.  Additionally, rename the function, since "common" is now
irrelevant.
Signed-off-by: default avatarLuciano Coelho <luciano.coelho@intel.com>
Signed-off-by: default avatarEmmanuel Grumbach <emmanuel.grumbach@intel.com>
parent 7ea76dc8
......@@ -831,6 +831,11 @@ static inline bool iwl_mvm_scan_use_ebs(struct iwl_mvm *mvm, int n_iterations)
(capa->api[0] & IWL_UCODE_TLV_API_SINGLE_SCAN_EBS)));
}
static int iwl_mvm_scan_total_iterations(struct iwl_mvm_scan_params *params)
{
return params->schedule[0].iterations + params->schedule[1].iterations;
}
static int iwl_mvm_scan_lmac(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
struct iwl_mvm_scan_params *params)
{
......@@ -839,8 +844,7 @@ static int iwl_mvm_scan_lmac(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
(void *)(cmd->data + sizeof(struct iwl_scan_channel_cfg_lmac) *
mvm->fw->ucode_capa.n_scan_channels);
u32 flags = 0, ssid_bitmap = 0;
int n_iterations = params->schedule[0].iterations +
params->schedule[1].iterations;
int n_iterations = iwl_mvm_scan_total_iterations(params);
lockdep_assert_held(&mvm->mutex);
......@@ -1143,24 +1147,31 @@ iwl_mvm_umac_scan_cfg_channels(struct iwl_mvm *mvm,
}
}
static u32 iwl_mvm_scan_umac_common_flags(struct iwl_mvm *mvm, int n_ssids,
struct cfg80211_ssid *ssids,
int fragmented)
static u32 iwl_mvm_scan_umac_flags(struct iwl_mvm *mvm,
struct iwl_mvm_scan_params *params)
{
int flags = 0;
if (n_ssids == 0)
if (params->n_ssids == 0)
flags = IWL_UMAC_SCAN_GEN_FLAGS_PASSIVE;
if (n_ssids == 1 && ssids[0].ssid_len != 0)
if (params->n_ssids == 1 && params->ssids[0].ssid_len != 0)
flags |= IWL_UMAC_SCAN_GEN_FLAGS_PRE_CONNECT;
if (fragmented)
if (params->passive_fragmented)
flags |= IWL_UMAC_SCAN_GEN_FLAGS_FRAGMENTED;
if (iwl_mvm_rrm_scan_needed(mvm))
flags |= IWL_UMAC_SCAN_GEN_FLAGS_RRM_ENABLED;
if (params->pass_all)
flags |= IWL_UMAC_SCAN_GEN_FLAGS_PASS_ALL;
else
flags |= IWL_UMAC_SCAN_GEN_FLAGS_MATCH;
if (iwl_mvm_scan_total_iterations(params) > 1)
flags |= IWL_UMAC_SCAN_GEN_FLAGS_PERIODIC;
return flags;
}
......@@ -1171,10 +1182,9 @@ static int iwl_mvm_scan_umac(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
struct iwl_scan_req_umac_tail *sec_part = (void *)&cmd->data +
sizeof(struct iwl_scan_channel_cfg_umac) *
mvm->fw->ucode_capa.n_scan_channels;
u32 uid, flags;
u32 uid;
u32 ssid_bitmap = 0;
int n_iterations = params->schedule[0].iterations +
params->schedule[1].iterations;
int n_iterations = iwl_mvm_scan_total_iterations(params);
int uid_idx;
lockdep_assert_held(&mvm->mutex);
......@@ -1185,28 +1195,18 @@ static int iwl_mvm_scan_umac(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
iwl_mvm_build_generic_umac_scan_cmd(mvm, cmd, params);
flags = iwl_mvm_scan_umac_common_flags(mvm, params->n_ssids,
params->ssids,
params->passive_fragmented);
if (n_iterations == 1) {
cmd->ooc_priority = cpu_to_le32(IWL_SCAN_PRIORITY_HIGH);
uid = iwl_generate_scan_uid(mvm, IWL_UMAC_SCAN_UID_REG_SCAN);
} else {
cmd->ooc_priority = cpu_to_le32(IWL_SCAN_PRIORITY_LOW);
uid = iwl_generate_scan_uid(mvm, IWL_UMAC_SCAN_UID_SCHED_SCAN);
flags |= IWL_UMAC_SCAN_GEN_FLAGS_PERIODIC;
}
mvm->scan_uid[uid_idx] = uid;
cmd->uid = cpu_to_le32(uid);
if (params->pass_all)
flags |= IWL_UMAC_SCAN_GEN_FLAGS_PASS_ALL;
else
flags |= IWL_UMAC_SCAN_GEN_FLAGS_MATCH;
cmd->general_flags = cpu_to_le32(flags);
cmd->general_flags = cpu_to_le32(iwl_mvm_scan_umac_flags(mvm, params));
if (iwl_mvm_scan_use_ebs(mvm, n_iterations))
cmd->channel_flags = IWL_SCAN_CHANNEL_FLAG_EBS |
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment