Commit 434f3c1b authored by Luciano Coelho's avatar Luciano Coelho Committed by Emmanuel Grumbach

iwlwifi: mvm: remove code that stops multiple UMAC scans of a type

We can only have one scan per type at the same time, so the code that
tries to stop several scans of a type is unnecessary.  Remove that to
reduce code complexity.
Signed-off-by: default avatarLuciano Coelho <luciano.coelho@intel.com>
Reviewed-by: default avatarJohannes Berg <johannes.berg@intel.com>
Signed-off-by: default avatarEmmanuel Grumbach <emmanuel.grumbach@intel.com>
parent 6185af2a
...@@ -898,13 +898,6 @@ static int iwl_mvm_scan_lmac(struct iwl_mvm *mvm, struct ieee80211_vif *vif, ...@@ -898,13 +898,6 @@ static int iwl_mvm_scan_lmac(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
return 0; return 0;
} }
/* UMAC scan API */
struct iwl_umac_scan_done {
struct iwl_mvm *mvm;
int type;
};
static int rate_to_scan_rate_flag(unsigned int rate) static int rate_to_scan_rate_flag(unsigned int rate)
{ {
static const int rate_to_scan_rate[IWL_RATE_COUNT] = { static const int rate_to_scan_rate[IWL_RATE_COUNT] = {
...@@ -1443,76 +1436,51 @@ int iwl_mvm_rx_umac_scan_iter_complete_notif(struct iwl_mvm *mvm, ...@@ -1443,76 +1436,51 @@ int iwl_mvm_rx_umac_scan_iter_complete_notif(struct iwl_mvm *mvm,
return 0; return 0;
} }
static bool iwl_scan_umac_done_check(struct iwl_notif_wait_data *notif_wait, static int iwl_mvm_umac_scan_abort(struct iwl_mvm *mvm, int type)
struct iwl_rx_packet *pkt, void *data)
{
struct iwl_umac_scan_done *scan_done = data;
struct iwl_umac_scan_complete *notif = (void *)pkt->data;
u32 uid = __le32_to_cpu(notif->uid);
if (WARN_ON(pkt->hdr.cmd != SCAN_COMPLETE_UMAC))
return false;
if (scan_done->mvm->scan_uid_status[uid] == 0)
return false;
/*
* Clear scan uid of scans that was aborted from above and completed
* in FW so the RX handler does nothing. Set last_ebs_successful here if
* needed.
*/
scan_done->mvm->scan_uid_status[uid] = 0;
if (notif->ebs_status)
scan_done->mvm->last_ebs_successful = false;
return iwl_mvm_scan_uid_by_status(scan_done->mvm, scan_done->type) < 0;
}
static int iwl_umac_scan_abort_one(struct iwl_mvm *mvm, u32 uid)
{ {
struct iwl_umac_scan_abort cmd = { struct iwl_umac_scan_abort cmd = {
.hdr.size = cpu_to_le16(sizeof(struct iwl_umac_scan_abort) - .hdr.size = cpu_to_le16(sizeof(struct iwl_umac_scan_abort) -
sizeof(struct iwl_mvm_umac_cmd_hdr)), sizeof(struct iwl_mvm_umac_cmd_hdr)),
.uid = cpu_to_le32(uid),
}; };
int uid, ret;
lockdep_assert_held(&mvm->mutex); lockdep_assert_held(&mvm->mutex);
/* We should always get a valid index here, because we already
* checked that this type of scan was running in the generic
* code.
*/
uid = iwl_mvm_scan_uid_by_status(mvm, type);
if (WARN_ON_ONCE(uid < 0))
return uid;
cmd.uid = cpu_to_le32(uid);
IWL_DEBUG_SCAN(mvm, "Sending scan abort, uid %u\n", uid); IWL_DEBUG_SCAN(mvm, "Sending scan abort, uid %u\n", uid);
return iwl_mvm_send_cmd_pdu(mvm, SCAN_ABORT_UMAC, 0, sizeof(cmd), &cmd); ret = iwl_mvm_send_cmd_pdu(mvm, SCAN_ABORT_UMAC, 0, sizeof(cmd), &cmd);
if (!ret)
mvm->scan_uid_status[uid] = 0;
return ret;
} }
static int iwl_mvm_umac_scan_stop(struct iwl_mvm *mvm, int type) static int iwl_mvm_umac_scan_stop(struct iwl_mvm *mvm, int type)
{ {
struct iwl_notification_wait wait_scan_done; struct iwl_notification_wait wait_scan_done;
static const u8 scan_done_notif[] = { SCAN_COMPLETE_UMAC, }; static const u8 scan_done_notif[] = { SCAN_COMPLETE_UMAC, };
struct iwl_umac_scan_done scan_done = { int ret;
.mvm = mvm,
.type = type,
};
int i, ret = -EIO;
iwl_init_notification_wait(&mvm->notif_wait, &wait_scan_done, iwl_init_notification_wait(&mvm->notif_wait, &wait_scan_done,
scan_done_notif, scan_done_notif,
ARRAY_SIZE(scan_done_notif), ARRAY_SIZE(scan_done_notif),
iwl_scan_umac_done_check, &scan_done); NULL, NULL);
IWL_DEBUG_SCAN(mvm, "Preparing to stop scan, type %x\n", type); IWL_DEBUG_SCAN(mvm, "Preparing to stop scan, type %x\n", type);
for (i = 0; i < mvm->max_scans; i++) { ret = iwl_mvm_umac_scan_abort(mvm, type);
if (mvm->scan_uid_status[i] == type) {
int err;
err = iwl_umac_scan_abort_one(mvm, i);
if (!err)
ret = 0;
}
}
if (ret) { if (ret) {
IWL_DEBUG_SCAN(mvm, "Couldn't stop scan\n"); IWL_DEBUG_SCAN(mvm, "couldn't stop scan type %d\n", type);
iwl_remove_notification(&mvm->notif_wait, &wait_scan_done); iwl_remove_notification(&mvm->notif_wait, &wait_scan_done);
return ret; return ret;
} }
......
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