diff options
Diffstat (limited to 'net/mac80211/scan.c')
-rw-r--r-- | net/mac80211/scan.c | 45 |
1 files changed, 26 insertions, 19 deletions
diff --git a/net/mac80211/scan.c b/net/mac80211/scan.c index 669d2e32efb..6f09eca0111 100644 --- a/net/mac80211/scan.c +++ b/net/mac80211/scan.c | |||
@@ -251,8 +251,8 @@ static bool ieee80211_prep_hw_scan(struct ieee80211_local *local) | |||
251 | local->hw_scan_req->n_channels = n_chans; | 251 | local->hw_scan_req->n_channels = n_chans; |
252 | 252 | ||
253 | ielen = ieee80211_build_preq_ies(local, (u8 *)local->hw_scan_req->ie, | 253 | ielen = ieee80211_build_preq_ies(local, (u8 *)local->hw_scan_req->ie, |
254 | req->ie, req->ie_len, band, (u32) -1, | 254 | req->ie, req->ie_len, band, |
255 | 0); | 255 | req->rates[band], 0); |
256 | local->hw_scan_req->ie_len = ielen; | 256 | local->hw_scan_req->ie_len = ielen; |
257 | 257 | ||
258 | return true; | 258 | return true; |
@@ -652,13 +652,15 @@ static void ieee80211_scan_state_send_probe(struct ieee80211_local *local, | |||
652 | { | 652 | { |
653 | int i; | 653 | int i; |
654 | struct ieee80211_sub_if_data *sdata = local->scan_sdata; | 654 | struct ieee80211_sub_if_data *sdata = local->scan_sdata; |
655 | enum ieee80211_band band = local->hw.conf.channel->band; | ||
655 | 656 | ||
656 | for (i = 0; i < local->scan_req->n_ssids; i++) | 657 | for (i = 0; i < local->scan_req->n_ssids; i++) |
657 | ieee80211_send_probe_req( | 658 | ieee80211_send_probe_req( |
658 | sdata, NULL, | 659 | sdata, NULL, |
659 | local->scan_req->ssids[i].ssid, | 660 | local->scan_req->ssids[i].ssid, |
660 | local->scan_req->ssids[i].ssid_len, | 661 | local->scan_req->ssids[i].ssid_len, |
661 | local->scan_req->ie, local->scan_req->ie_len); | 662 | local->scan_req->ie, local->scan_req->ie_len, |
663 | local->scan_req->rates[band], false); | ||
662 | 664 | ||
663 | /* | 665 | /* |
664 | * After sending probe requests, wait for probe responses | 666 | * After sending probe requests, wait for probe responses |
@@ -821,10 +823,8 @@ int ieee80211_request_internal_scan(struct ieee80211_sub_if_data *sdata, | |||
821 | */ | 823 | */ |
822 | void ieee80211_scan_cancel(struct ieee80211_local *local) | 824 | void ieee80211_scan_cancel(struct ieee80211_local *local) |
823 | { | 825 | { |
824 | bool abortscan; | ||
825 | |||
826 | /* | 826 | /* |
827 | * We are only canceling software scan, or deferred scan that was not | 827 | * We are canceling software scan, or deferred scan that was not |
828 | * yet really started (see __ieee80211_start_scan ). | 828 | * yet really started (see __ieee80211_start_scan ). |
829 | * | 829 | * |
830 | * Regarding hardware scan: | 830 | * Regarding hardware scan: |
@@ -836,23 +836,30 @@ void ieee80211_scan_cancel(struct ieee80211_local *local) | |||
836 | * - we can not cancel scan_work since driver can schedule it | 836 | * - we can not cancel scan_work since driver can schedule it |
837 | * by ieee80211_scan_completed(..., true) to finish scan | 837 | * by ieee80211_scan_completed(..., true) to finish scan |
838 | * | 838 | * |
839 | * Hence low lever driver is responsible for canceling HW scan. | 839 | * Hence we only call the cancel_hw_scan() callback, but the low-level |
840 | * driver is still responsible for calling ieee80211_scan_completed() | ||
841 | * after the scan was completed/aborted. | ||
840 | */ | 842 | */ |
841 | 843 | ||
842 | mutex_lock(&local->mtx); | 844 | mutex_lock(&local->mtx); |
843 | abortscan = local->scan_req && !test_bit(SCAN_HW_SCANNING, &local->scanning); | 845 | if (!local->scan_req) |
844 | if (abortscan) { | 846 | goto out; |
845 | /* | 847 | |
846 | * The scan is canceled, but stop work from being pending. | 848 | if (test_bit(SCAN_HW_SCANNING, &local->scanning)) { |
847 | * | 849 | if (local->ops->cancel_hw_scan) |
848 | * If the work is currently running, it must be blocked on | 850 | drv_cancel_hw_scan(local, local->scan_sdata); |
849 | * the mutex, but we'll set scan_sdata = NULL and it'll | 851 | goto out; |
850 | * simply exit once it acquires the mutex. | ||
851 | */ | ||
852 | cancel_delayed_work(&local->scan_work); | ||
853 | /* and clean up */ | ||
854 | __ieee80211_scan_completed(&local->hw, true, false); | ||
855 | } | 852 | } |
853 | |||
854 | /* | ||
855 | * If the work is currently running, it must be blocked on | ||
856 | * the mutex, but we'll set scan_sdata = NULL and it'll | ||
857 | * simply exit once it acquires the mutex. | ||
858 | */ | ||
859 | cancel_delayed_work(&local->scan_work); | ||
860 | /* and clean up */ | ||
861 | __ieee80211_scan_completed(&local->hw, true, false); | ||
862 | out: | ||
856 | mutex_unlock(&local->mtx); | 863 | mutex_unlock(&local->mtx); |
857 | } | 864 | } |
858 | 865 | ||