]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Defer scans while PNO is in progress instead of skipping them
authorArik Nemtsov <arik@wizery.com>
Thu, 24 Apr 2014 05:45:35 +0000 (08:45 +0300)
committerJouni Malinen <j@w1.fi>
Sun, 4 Dec 2016 18:27:06 +0000 (20:27 +0200)
Skipping the scan altogether will hurt auto-reconnect. Also move the PNO
check down since the scan might be canceled for other reasons before we
defer it.

Signed-off-by: Arik Nemtsov <arikx.nemtsov@intel.com>
wpa_supplicant/scan.c

index dafd8b500197fcc13d2a4bba42d72b857dfee500..272e633f9a472fbf96be138cd9730ff734d654ce 100644 (file)
@@ -714,11 +714,6 @@ static void wpa_supplicant_scan(void *eloop_ctx, void *timeout_ctx)
        size_t max_ssids;
        int connect_without_scan = 0;
 
-       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;
@@ -779,6 +774,21 @@ static void wpa_supplicant_scan(void *eloop_ctx, void *timeout_ctx)
                return;
        }
 
+       /*
+        * Don't cancel the scan based on ongoing PNO; defer it. Some scans are
+        * used for changing modes inside wpa_supplicant (roaming,
+        * auto-reconnect, etc). Discarding the scan might hurt these processes.
+        * The normal use case for PNO is to suspend the host immediately after
+        * starting PNO, so the periodic 100 ms attempts to run the scan do not
+        * normally happen in practice multiple times, i.e., this is simply
+        * restarting scanning once the host is woken up and PNO stopped.
+        */
+       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 {