Browse Source

Abort an ongoing scan before connect

Connect radio work is sometimes delayed for a considerable duration if
there is an ongoing scan radio work. To avoid these delays abort the
ongoing scan on that interface before queuing a connect request. Upon a
scan done indication from the driver, connect radio work will be
scheduled.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
Kanchanapally, Vidyullatha 9 years ago
parent
commit
4ead7cfd5d
4 changed files with 16 additions and 0 deletions
  1. 11 0
      wpa_supplicant/scan.c
  2. 1 0
      wpa_supplicant/scan.h
  3. 2 0
      wpa_supplicant/sme.c
  4. 2 0
      wpa_supplicant/wpa_supplicant.c

+ 11 - 0
wpa_supplicant/scan.c

@@ -2465,3 +2465,14 @@ int wpas_mac_addr_rand_scan_set(struct wpa_supplicant *wpa_s,
 	wpa_s->mac_addr_rand_enable |= type;
 	wpa_s->mac_addr_rand_enable |= type;
 	return 0;
 	return 0;
 }
 }
+
+
+int wpas_abort_ongoing_scan(struct wpa_supplicant *wpa_s)
+{
+	if (wpa_s->scan_work && wpa_s->own_scan_running) {
+		wpa_dbg(wpa_s, MSG_DEBUG, "Abort an ongoing scan");
+		return wpa_drv_abort_scan(wpa_s);
+	}
+
+	return 0;
+}

+ 1 - 0
wpa_supplicant/scan.h

@@ -54,5 +54,6 @@ void wpas_mac_addr_rand_scan_clear(struct wpa_supplicant *wpa_s,
 int wpas_mac_addr_rand_scan_set(struct wpa_supplicant *wpa_s,
 int wpas_mac_addr_rand_scan_set(struct wpa_supplicant *wpa_s,
 				unsigned int type, const u8 *addr,
 				unsigned int type, const u8 *addr,
 				const u8 *mask);
 				const u8 *mask);
+int wpas_abort_ongoing_scan(struct wpa_supplicant *wpa_s);
 
 
 #endif /* SCAN_H */
 #endif /* SCAN_H */

+ 2 - 0
wpa_supplicant/sme.c

@@ -632,6 +632,8 @@ void sme_authenticate(struct wpa_supplicant *wpa_s,
 		radio_remove_works(wpa_s, "sme-connect", 0);
 		radio_remove_works(wpa_s, "sme-connect", 0);
 	}
 	}
 
 
+	wpas_abort_ongoing_scan(wpa_s);
+
 	cwork = os_zalloc(sizeof(*cwork));
 	cwork = os_zalloc(sizeof(*cwork));
 	if (cwork == NULL)
 	if (cwork == NULL)
 		return;
 		return;

+ 2 - 0
wpa_supplicant/wpa_supplicant.c

@@ -1706,6 +1706,8 @@ void wpa_supplicant_associate(struct wpa_supplicant *wpa_s,
 		return;
 		return;
 	}
 	}
 
 
+	wpas_abort_ongoing_scan(wpa_s);
+
 	cwork = os_zalloc(sizeof(*cwork));
 	cwork = os_zalloc(sizeof(*cwork));
 	if (cwork == NULL)
 	if (cwork == NULL)
 		return;
 		return;