提交 94631b56 编写于 作者: J Johannes Berg 提交者: Luca Coelho

iwlwifi: mvm: clean up scan state on failure

We keep the scan status per UID in scan_uid_status field when the
iwl_mvm_build_scan_cmd() function is called. If we error out after
this, e.g. due to FW restart being in progress, we're not cleaning
up properly, and can run into warnings later.

Clean up internal variables when starting fails after calling the
iwl_mvm_build_scan_cmd() function.
Signed-off-by: NJohannes Berg <johannes.berg@intel.com>
Signed-off-by: NLuca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20201209231352.970421a2f753.Id62b2da8a0ccccbb114407db82ca485d07749d39@changeidSigned-off-by: NLuca Coelho <luciano.coelho@intel.com>
上级 2f7a04c7
......@@ -2146,8 +2146,10 @@ static int iwl_mvm_scan_umac(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
ret = iwl_mvm_fill_scan_sched_params(params, tail_v2->schedule,
&tail_v2->delay);
if (ret)
if (ret) {
mvm->scan_uid_status[uid] = 0;
return ret;
}
if (iwl_mvm_is_scan_ext_chan_supported(mvm)) {
tail_v2->preq = params->preq;
......@@ -2458,7 +2460,7 @@ static int iwl_mvm_build_scan_cmd(struct iwl_mvm *mvm,
struct iwl_mvm_scan_params *params,
int type)
{
int uid, i;
int uid, i, err;
u8 scan_ver;
lockdep_assert_held(&mvm->mutex);
......@@ -2490,7 +2492,11 @@ static int iwl_mvm_build_scan_cmd(struct iwl_mvm *mvm,
return ver_handler->handler(mvm, vif, params, type, uid);
}
return iwl_mvm_scan_umac(mvm, vif, params, type, uid);
err = iwl_mvm_scan_umac(mvm, vif, params, type, uid);
if (err)
return err;
return uid;
}
int iwl_mvm_reg_scan_start(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
......@@ -2503,7 +2509,7 @@ int iwl_mvm_reg_scan_start(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
.dataflags = { IWL_HCMD_DFL_NOCOPY, },
};
struct iwl_mvm_scan_params params = {};
int ret;
int ret, uid;
struct cfg80211_sched_scan_plan scan_plan = { .iterations = 1 };
lockdep_assert_held(&mvm->mutex);
......@@ -2550,11 +2556,11 @@ int iwl_mvm_reg_scan_start(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
iwl_mvm_build_scan_probe(mvm, vif, ies, &params);
ret = iwl_mvm_build_scan_cmd(mvm, vif, &hcmd, &params,
uid = iwl_mvm_build_scan_cmd(mvm, vif, &hcmd, &params,
IWL_MVM_SCAN_REGULAR);
if (ret)
return ret;
if (uid < 0)
return uid;
iwl_mvm_pause_tcm(mvm, false);
......@@ -2566,6 +2572,7 @@ int iwl_mvm_reg_scan_start(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
*/
IWL_ERR(mvm, "Scan failed! ret %d\n", ret);
iwl_mvm_resume_tcm(mvm);
mvm->scan_uid_status[uid] = 0;
return ret;
}
......@@ -2591,7 +2598,7 @@ int iwl_mvm_sched_scan_start(struct iwl_mvm *mvm,
.dataflags = { IWL_HCMD_DFL_NOCOPY, },
};
struct iwl_mvm_scan_params params = {};
int ret;
int ret, uid;
int i, j;
bool non_psc_included = false;
......@@ -2683,12 +2690,12 @@ int iwl_mvm_sched_scan_start(struct iwl_mvm *mvm,
return -ENOBUFS;
}
ret = iwl_mvm_build_scan_cmd(mvm, vif, &hcmd, &params, type);
uid = iwl_mvm_build_scan_cmd(mvm, vif, &hcmd, &params, type);
if (non_psc_included)
kfree(params.channels);
if (ret)
return ret;
if (uid < 0)
return uid;
ret = iwl_mvm_send_cmd(mvm, &hcmd);
if (!ret) {
......@@ -2701,6 +2708,8 @@ int iwl_mvm_sched_scan_start(struct iwl_mvm *mvm,
* should try to send the command again with different params.
*/
IWL_ERR(mvm, "Sched scan failed! ret %d\n", ret);
mvm->scan_uid_status[uid] = 0;
mvm->sched_scan_pass_all = SCHED_SCAN_PASS_ALL_DISABLED;
}
return ret;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册