[RFC 3/4] wpa_s: use sched_scan in driver init

Luciano Coelho coelho
Wed Sep 21 04:07:22 PDT 2011


This patch uses sched_scan, if available, when the driver is
initialized.  It also adds a couple of cancel operations where
appropriate.

Signed-off-by: Luciano Coelho <coelho at ti.com>
---
 wpa_supplicant/events.c         |    8 ++++++--
 wpa_supplicant/sme.c            |    1 +
 wpa_supplicant/wpa_supplicant.c |    6 +++++-
 3 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c
index 4a95069..0787a00 100644
--- a/wpa_supplicant/events.c
+++ b/wpa_supplicant/events.c
@@ -986,10 +986,14 @@ static int _wpa_supplicant_event_scan_results(struct wpa_supplicant *wpa_s,
 				 */
 				timeout_sec = 0;
 				timeout_usec = 250000;
+				wpa_supplicant_req_new_scan(wpa_s, timeout_sec,
+							    timeout_usec);
+				return 0;
 			}
 #endif /* CONFIG_P2P */
-			wpa_supplicant_req_new_scan(wpa_s, timeout_sec,
-						    timeout_usec);
+			if(wpa_supplicant_req_sched_scan(wpa_s))
+				wpa_supplicant_req_new_scan(wpa_s, timeout_sec,
+							    timeout_usec);
 		}
 	}
 	return 0;
diff --git a/wpa_supplicant/sme.c b/wpa_supplicant/sme.c
index dbf385e..4cb5062 100644
--- a/wpa_supplicant/sme.c
+++ b/wpa_supplicant/sme.c
@@ -237,6 +237,7 @@ void sme_authenticate(struct wpa_supplicant *wpa_s,
 	}
 #endif /* CONFIG_P2P */
 
+	wpa_supplicant_cancel_sched_scan(wpa_s);
 	wpa_supplicant_cancel_scan(wpa_s);
 
 	wpa_msg(wpa_s, MSG_INFO, "SME: Trying to authenticate with " MACSTR
diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
index 1376498..d591758 100644
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -1152,6 +1152,7 @@ void wpa_supplicant_associate(struct wpa_supplicant *wpa_s,
 			wpa_ssid_txt(ssid->ssid, ssid->ssid_len));
 		os_memset(wpa_s->pending_bssid, 0, ETH_ALEN);
 	}
+	wpa_supplicant_cancel_sched_scan(wpa_s);
 	wpa_supplicant_cancel_scan(wpa_s);
 
 	/* Starting new association, so clear the possibly used WPA IE from the
@@ -2047,7 +2048,10 @@ int wpa_supplicant_driver_init(struct wpa_supplicant *wpa_s)
 
 	wpa_s->prev_scan_ssid = WILDCARD_SSID_SCAN;
 	if (wpa_supplicant_enabled_networks(wpa_s->conf)) {
-		wpa_supplicant_req_scan(wpa_s, interface_count, 100000);
+		int ret;
+		ret = wpa_supplicant_req_sched_scan(wpa_s);
+		if (ret)
+			wpa_supplicant_req_scan(wpa_s, interface_count, 100000);
 		interface_count++;
 	} else
 		wpa_supplicant_set_state(wpa_s, WPA_INACTIVE);
-- 
1.7.1




More information about the Hostap mailing list