Skip to content

Commit

Permalink
iwlwifi: mvm: call ieee80211_scan_completed() even if scan abort fails
Browse files Browse the repository at this point in the history
A scan abort command failure is not that unusual, since we may try to
send it after the scan has actually completed but before we received
the completed notification from the firmware.  The scan abort can also
fail for other reasons, such as a timeout.  In such cases, we should
clear things up so the next scans will work again.  To do so, don't
return immediately in case of failures, but call
ieee80211_scan_completed() and clear the scan_status flags.

Signed-off-by: Luciano Coelho <luciano.coelho@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
  • Loading branch information
Luciano Coelho authored and Emmanuel Grumbach committed Feb 23, 2015
1 parent f5af19d commit 54331db
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions drivers/net/wireless/iwlwifi/mvm/scan.c
Original file line number Diff line number Diff line change
Expand Up @@ -1128,8 +1128,10 @@ int iwl_mvm_scan_offload_stop(struct iwl_mvm *mvm, bool notify)
if (mvm->scan_status == IWL_MVM_SCAN_NONE)
return 0;

if (iwl_mvm_is_radio_killed(mvm))
if (iwl_mvm_is_radio_killed(mvm)) {
ret = 0;
goto out;
}

if (mvm->scan_status != IWL_MVM_SCAN_SCHED &&
(!(mvm->fw->ucode_capa.api[0] & IWL_UCODE_TLV_API_LMAC_SCAN) ||
Expand All @@ -1148,16 +1150,14 @@ int iwl_mvm_scan_offload_stop(struct iwl_mvm *mvm, bool notify)
IWL_DEBUG_SCAN(mvm, "Send stop %sscan failed %d\n",
sched ? "offloaded " : "", ret);
iwl_remove_notification(&mvm->notif_wait, &wait_scan_done);
return ret;
goto out;
}

IWL_DEBUG_SCAN(mvm, "Successfully sent stop %sscan\n",
sched ? "offloaded " : "");

ret = iwl_wait_notification(&mvm->notif_wait, &wait_scan_done, 1 * HZ);
if (ret)
return ret;

out:
/*
* Clear the scan status so the next scan requests will succeed. This
* also ensures the Rx handler doesn't do anything, as the scan was
Expand All @@ -1167,7 +1167,6 @@ int iwl_mvm_scan_offload_stop(struct iwl_mvm *mvm, bool notify)
if (mvm->scan_status == IWL_MVM_SCAN_OS)
iwl_mvm_unref(mvm, IWL_MVM_REF_SCAN);

out:
mvm->scan_status = IWL_MVM_SCAN_NONE;

if (notify) {
Expand All @@ -1177,7 +1176,7 @@ int iwl_mvm_scan_offload_stop(struct iwl_mvm *mvm, bool notify)
ieee80211_scan_completed(mvm->hw, true);
}

return 0;
return ret;
}

static void iwl_mvm_unified_scan_fill_tx_cmd(struct iwl_mvm *mvm,
Expand Down

0 comments on commit 54331db

Please sign in to comment.