[PATCH] scan: defer scans while PNO is in progress

Ilan Peer ilan.peer
Wed Apr 23 22:45:35 PDT 2014


From: Arik Nemtsov <arik at wizery.com>

Skipping the scan altogether will hurt auto-reconnect. Also move the PNO
check down - the scan might be canceled for other reasons before we
defer it.

Signed-off-by: Arik Nemtsov <arikx.nemtsov at intel.com>
---
 wpa_supplicant/scan.c |   16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/wpa_supplicant/scan.c b/wpa_supplicant/scan.c
index bc0daeb..3d424a4 100644
--- a/wpa_supplicant/scan.c
+++ b/wpa_supplicant/scan.c
@@ -559,11 +559,6 @@ static void wpa_supplicant_scan(void *eloop_ctx, void *timeout_ctx)
 	size_t max_ssids;
 	enum wpa_states prev_state;
 
-	if (wpa_s->pno || wpa_s->pno_sched_pending) {
-		wpa_dbg(wpa_s, MSG_DEBUG, "Skip scan - PNO is in progress");
-		return;
-	}
-
 	if (wpa_s->wpa_state == WPA_INTERFACE_DISABLED) {
 		wpa_dbg(wpa_s, MSG_DEBUG, "Skip scan - interface disabled");
 		return;
@@ -613,6 +608,17 @@ static void wpa_supplicant_scan(void *eloop_ctx, void *timeout_ctx)
 	}
 #endif /* CONFIG_P2P */
 
+	/*
+	 * Don't cancel the scan, defer it. Some scans are used for changing
+	 * modes inside the supplicant (roaming, auto-reconnect, etc).
+	 * Discarding the scan might hurt these processes.
+	 */
+	if (wpa_s->pno || wpa_s->pno_sched_pending) {
+		wpa_dbg(wpa_s, MSG_DEBUG, "Defer scan - PNO is in progress");
+		wpa_supplicant_req_scan(wpa_s, 0, 100000);
+		return;
+	}
+
 	if (wpa_s->conf->ap_scan == 2)
 		max_ssids = 1;
 	else {
-- 
1.7.10.4




More information about the Hostap mailing list