Patchwork [1/1] STA: Handle legacy scan interruption of schedscan

login
register
mail settings
Submitter Jithu Jance
Date Oct. 17, 2013, 6:26 a.m.
Message ID <20131017062602.GA8111@jithu@broadcom.com>
Download mbox | patch
Permalink /patch/284099/
State Accepted
Headers show

Comments

Jithu Jance - Oct. 17, 2013, 6:26 a.m.
Following scenarios have been addressed. Please see whether
the changes are fine.
 a) While starting from PNO start context the scheduled
    scan was not setting the flag wpa_s->scanning.
 b) While schedscan is in progress and a legacy scan comes
    on the cli/socket the sched scan is cancelled and normal scan
    is allowed to continue. However, sometimes schedscan cancelled
    event comes a bit delayed and we get an "Already scanning" Error
    and scan command gets dropped. Instead, the incoming scan req is
    rescheduled.

Signed-hostap: Jithu Jance <jithu@broadcom.com>
---
 wpa_supplicant/ctrl_iface.c |    5 +++--
 wpa_supplicant/scan.c       |   14 ++++++++++++--
 wpa_supplicant/scan.h       |    4 ++++
 3 files changed, 19 insertions(+), 4 deletions(-)

--
1.7.9.5
Jouni Malinen - Nov. 18, 2013, 1:11 p.m.
On Thu, Oct 17, 2013 at 11:56:02AM +0530, Jithu Jance wrote:
> Following scenarios have been addressed. Please see whether
> the changes are fine.
>  a) While starting from PNO start context the scheduled
>     scan was not setting the flag wpa_s->scanning.
>  b) While schedscan is in progress and a legacy scan comes
>     on the cli/socket the sched scan is cancelled and normal scan
>     is allowed to continue. However, sometimes schedscan cancelled
>     event comes a bit delayed and we get an "Already scanning" Error
>     and scan command gets dropped. Instead, the incoming scan req is
>     rescheduled.

Thanks, applied.

Patch

diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c
index 0f893f7..e993973 100644
--- a/wpa_supplicant/ctrl_iface.c
+++ b/wpa_supplicant/ctrl_iface.c
@@ -111,7 +111,8 @@  static int pno_start(struct wpa_supplicant *wpa_s)
 	interval = wpa_s->conf->sched_scan_interval ?
 		wpa_s->conf->sched_scan_interval : 10;

-	ret = wpa_drv_sched_scan(wpa_s, &params, interval * 1000);
+	ret = wpa_supplicant_start_sched_scan(wpa_s, &params,
+		interval);
 	os_free(params.filter_ssids);
 	if (ret == 0)
 		wpa_s->pno = 1;
@@ -125,7 +126,7 @@  static int pno_stop(struct wpa_supplicant *wpa_s)

 	if (wpa_s->pno) {
 		wpa_s->pno = 0;
-		ret = wpa_drv_stop_sched_scan(wpa_s);
+		ret = wpa_supplicant_stop_sched_scan(wpa_s);
 	}

 	if (wpa_s->wpa_state == WPA_SCANNING)
diff --git a/wpa_supplicant/scan.c b/wpa_supplicant/scan.c
index be826db..0074cf3 100644
--- a/wpa_supplicant/scan.c
+++ b/wpa_supplicant/scan.c
@@ -260,7 +260,7 @@  wpa_supplicant_sched_scan_timeout(void *eloop_ctx, void *timeout_ctx)
 }


-static int
+int
 wpa_supplicant_start_sched_scan(struct wpa_supplicant *wpa_s,
 				struct wpa_driver_scan_params *params,
 				int interval)
@@ -278,7 +278,8 @@  wpa_supplicant_start_sched_scan(struct wpa_supplicant *wpa_s,
 }


-static int wpa_supplicant_stop_sched_scan(struct wpa_supplicant *wpa_s)
+int
+wpa_supplicant_stop_sched_scan(struct wpa_supplicant *wpa_s)
 {
 	int ret;

@@ -566,6 +567,15 @@  static void wpa_supplicant_scan(void *eloop_ctx, void *timeout_ctx)
 		return;
 	}

+	if (wpa_s->scanning) {
+		/* If we are already in scanning state, we shall reschedule the
+		 *  the incomming scan request
+		 */
+		wpa_dbg(wpa_s, MSG_DEBUG, "Already scanning - Reschedule the "
+			"incoming scan req");
+		wpa_supplicant_req_scan(wpa_s, 1, 0);
+		return;
+	}
 	if (!wpa_supplicant_enabled_networks(wpa_s) &&
 	    wpa_s->scan_req == NORMAL_SCAN_REQ) {
 		wpa_dbg(wpa_s, MSG_DEBUG, "No enabled networks - do not scan");
diff --git a/wpa_supplicant/scan.h b/wpa_supplicant/scan.h
index 66581a9..f6910ae 100644
--- a/wpa_supplicant/scan.h
+++ b/wpa_supplicant/scan.h
@@ -39,5 +39,9 @@  void wpa_supplicant_update_scan_int(struct wpa_supplicant *wpa_s, int sec);
 void scan_only_handler(struct wpa_supplicant *wpa_s,
 		       struct wpa_scan_results *scan_res);
 int wpas_scan_scheduled(struct wpa_supplicant *wpa_s);
+int wpa_supplicant_start_sched_scan(struct wpa_supplicant *wpa_s,
+	struct wpa_driver_scan_params *params, int interval);
+int
+wpa_supplicant_stop_sched_scan(struct wpa_supplicant *wpa_s);

 #endif /* SCAN_H */