diff options
author | Luca Coelho <luciano.coelho@intel.com> | 2016-03-11 02:20:37 -0500 |
---|---|---|
committer | Emmanuel Grumbach <emmanuel.grumbach@intel.com> | 2016-03-30 09:24:48 -0400 |
commit | 728e825f81b1fe29eb177148fcabfa55a7f4c1bb (patch) | |
tree | 487b5ba41dd509dcbd0c3b7036086cf4bfa52bb6 /drivers/net/wireless/intel/iwlwifi/mvm/scan.c | |
parent | 097129c9e62540122b63cba79c1843a2602bec37 (diff) |
iwlwifi: mvm: add a scan timeout for regular scans
If something goes wrong with the firmware and we never get a scan
complete notification, we stay stuck forever. In order to avoid this
situation, add a timeout and trigger an NMI if it expires before
receiving the notification., so we can clean things up.
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Diffstat (limited to 'drivers/net/wireless/intel/iwlwifi/mvm/scan.c')
-rw-r--r-- | drivers/net/wireless/intel/iwlwifi/mvm/scan.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/scan.c b/drivers/net/wireless/intel/iwlwifi/mvm/scan.c index 25b007cf7db7..c1d1be9c5d01 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/scan.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/scan.c | |||
@@ -70,6 +70,7 @@ | |||
70 | 70 | ||
71 | #include "mvm.h" | 71 | #include "mvm.h" |
72 | #include "fw-api-scan.h" | 72 | #include "fw-api-scan.h" |
73 | #include "iwl-io.h" | ||
73 | 74 | ||
74 | #define IWL_DENSE_EBS_SCAN_RATIO 5 | 75 | #define IWL_DENSE_EBS_SCAN_RATIO 5 |
75 | #define IWL_SPARSE_EBS_SCAN_RATIO 1 | 76 | #define IWL_SPARSE_EBS_SCAN_RATIO 1 |
@@ -398,6 +399,10 @@ void iwl_mvm_rx_lmac_scan_complete_notif(struct iwl_mvm *mvm, | |||
398 | ieee80211_scan_completed(mvm->hw, | 399 | ieee80211_scan_completed(mvm->hw, |
399 | scan_notif->status == IWL_SCAN_OFFLOAD_ABORTED); | 400 | scan_notif->status == IWL_SCAN_OFFLOAD_ABORTED); |
400 | iwl_mvm_unref(mvm, IWL_MVM_REF_SCAN); | 401 | iwl_mvm_unref(mvm, IWL_MVM_REF_SCAN); |
402 | del_timer(&mvm->scan_timer); | ||
403 | } else { | ||
404 | IWL_ERR(mvm, | ||
405 | "got scan complete notification but no scan is running\n"); | ||
401 | } | 406 | } |
402 | 407 | ||
403 | mvm->last_ebs_successful = | 408 | mvm->last_ebs_successful = |
@@ -1217,6 +1222,18 @@ static int iwl_mvm_check_running_scans(struct iwl_mvm *mvm, int type) | |||
1217 | return -EIO; | 1222 | return -EIO; |
1218 | } | 1223 | } |
1219 | 1224 | ||
1225 | #define SCAN_TIMEOUT (16 * HZ) | ||
1226 | |||
1227 | void iwl_mvm_scan_timeout(unsigned long data) | ||
1228 | { | ||
1229 | struct iwl_mvm *mvm = (struct iwl_mvm *)data; | ||
1230 | |||
1231 | IWL_ERR(mvm, "regular scan timed out\n"); | ||
1232 | |||
1233 | del_timer(&mvm->scan_timer); | ||
1234 | iwl_force_nmi(mvm->trans); | ||
1235 | } | ||
1236 | |||
1220 | int iwl_mvm_reg_scan_start(struct iwl_mvm *mvm, struct ieee80211_vif *vif, | 1237 | int iwl_mvm_reg_scan_start(struct iwl_mvm *mvm, struct ieee80211_vif *vif, |
1221 | struct cfg80211_scan_request *req, | 1238 | struct cfg80211_scan_request *req, |
1222 | struct ieee80211_scan_ies *ies) | 1239 | struct ieee80211_scan_ies *ies) |
@@ -1296,6 +1313,8 @@ int iwl_mvm_reg_scan_start(struct iwl_mvm *mvm, struct ieee80211_vif *vif, | |||
1296 | mvm->scan_status |= IWL_MVM_SCAN_REGULAR; | 1313 | mvm->scan_status |= IWL_MVM_SCAN_REGULAR; |
1297 | iwl_mvm_ref(mvm, IWL_MVM_REF_SCAN); | 1314 | iwl_mvm_ref(mvm, IWL_MVM_REF_SCAN); |
1298 | 1315 | ||
1316 | mod_timer(&mvm->scan_timer, jiffies + SCAN_TIMEOUT); | ||
1317 | |||
1299 | return 0; | 1318 | return 0; |
1300 | } | 1319 | } |
1301 | 1320 | ||
@@ -1413,6 +1432,7 @@ void iwl_mvm_rx_umac_scan_complete_notif(struct iwl_mvm *mvm, | |||
1413 | if (mvm->scan_uid_status[uid] == IWL_MVM_SCAN_REGULAR) { | 1432 | if (mvm->scan_uid_status[uid] == IWL_MVM_SCAN_REGULAR) { |
1414 | ieee80211_scan_completed(mvm->hw, aborted); | 1433 | ieee80211_scan_completed(mvm->hw, aborted); |
1415 | iwl_mvm_unref(mvm, IWL_MVM_REF_SCAN); | 1434 | iwl_mvm_unref(mvm, IWL_MVM_REF_SCAN); |
1435 | del_timer(&mvm->scan_timer); | ||
1416 | } else if (mvm->scan_uid_status[uid] == IWL_MVM_SCAN_SCHED) { | 1436 | } else if (mvm->scan_uid_status[uid] == IWL_MVM_SCAN_SCHED) { |
1417 | ieee80211_sched_scan_stopped(mvm->hw); | 1437 | ieee80211_sched_scan_stopped(mvm->hw); |
1418 | mvm->sched_scan_pass_all = SCHED_SCAN_PASS_ALL_DISABLED; | 1438 | mvm->sched_scan_pass_all = SCHED_SCAN_PASS_ALL_DISABLED; |
@@ -1608,6 +1628,7 @@ out: | |||
1608 | * to release the scan reference here. | 1628 | * to release the scan reference here. |
1609 | */ | 1629 | */ |
1610 | iwl_mvm_unref(mvm, IWL_MVM_REF_SCAN); | 1630 | iwl_mvm_unref(mvm, IWL_MVM_REF_SCAN); |
1631 | del_timer(&mvm->scan_timer); | ||
1611 | if (notify) | 1632 | if (notify) |
1612 | ieee80211_scan_completed(mvm->hw, true); | 1633 | ieee80211_scan_completed(mvm->hw, true); |
1613 | } else if (notify) { | 1634 | } else if (notify) { |