[PATCH] Improve performance of reassociate operation

Peter Qiu zqiu
Thu Mar 6 10:06:04 PST 2014


Perform single-channel single-ssid scan instead of full scan
for reassociate operation. This allows the scan result to come
back in much faster time during reassociate. In ath9k, the scan
took around 12 seconds without the fix, and only 0.1 second with
the fix.

Since for reassociate operation the only SSID we care about is
the one we previously connected to, so it should be good idea to
perform single-channel single-ssid scan for reassociate.

Signed-hostap: Peter Qiu <zqiu at chromium.org>
---
 wpa_supplicant/scan.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/wpa_supplicant/scan.c b/wpa_supplicant/scan.c
index f7eb537..9926e10 100644
--- a/wpa_supplicant/scan.c
+++ b/wpa_supplicant/scan.c
@@ -665,6 +665,30 @@ static void wpa_supplicant_scan(void *eloop_ctx, void *timeout_ctx)
 		 * wildcard SSID.
 		 */
 		ssid = NULL;
+	} else if (wpa_s->reassociate && wpa_s->current_ssid != NULL) {
+		/*
+		 * Perform single-channel single-SSID scan for reassociate
+		 * operation.
+		 */
+		/* Setup SSID */
+		ssid = wpa_s->current_ssid;
+		wpa_hexdump_ascii(MSG_DEBUG, "Scan SSID",
+		                  ssid->ssid, ssid->ssid_len);
+		params.ssids[0].ssid = ssid->ssid;
+		params.ssids[0].ssid_len = ssid->ssid_len;
+		params.num_ssids = 1;
+
+		/*
+		 * Allocate memory for frequency array, allocate one extra
+		 * slot for the zero-terminator.
+		 */
+		params.freqs = (int *)os_malloc(sizeof(int)*2);
+		if (params.freqs == NULL) {
+		        wpa_dbg(wpa_s, MSG_ERROR, "Memory allocation failed");
+		        return;
+		}
+		params.freqs[0] = wpa_s->assoc_freq;
+		params.freqs[1] = 0;
 	} else {
 		struct wpa_ssid *start = ssid, *tssid;
 		int freqs_set = 0;
-- 
1.9.0.279.gdc9e3eb




More information about the Hostap mailing list