diff options
author | Jouni Malinen <j@w1.fi> | 2012-09-14 12:53:47 -0700 |
---|---|---|
committer | Dmitry Shmidt <dimitrysh@google.com> | 2012-09-14 12:53:47 -0700 |
commit | dc7b71324df9788e194745e8ab9386a4619a623a (patch) | |
tree | 7f33e5e58731bd22a8d3eae95747e694ae225c52 | |
parent | 5887a9d552f3d9d612011daba073e076daab5b2a (diff) | |
download | external_wpa_supplicant_8-dc7b71324df9788e194745e8ab9386a4619a623a.zip external_wpa_supplicant_8-dc7b71324df9788e194745e8ab9386a4619a623a.tar.gz external_wpa_supplicant_8-dc7b71324df9788e194745e8ab9386a4619a623a.tar.bz2 |
P2P: Move p2p_cb_on_scan_complete to global context
Since we have a global P2P module, the flag to trigger scan completion
events to it needs to be in similar context. The previous design
maintained this separately for each virtual interface and if P2P module
did not run its scan operation on the virtual interface that completed
the scan, P2P module would not be allowed to restart operations
properly.
Change-Id: I1b5a55c03aede15bbe0ac70dcbe0011a90f69b20
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
-rw-r--r-- | wpa_supplicant/events.c | 9 | ||||
-rw-r--r-- | wpa_supplicant/p2p_supplicant.c | 43 | ||||
-rw-r--r-- | wpa_supplicant/scan.c | 2 | ||||
-rw-r--r-- | wpa_supplicant/wpa_supplicant.c | 8 | ||||
-rw-r--r-- | wpa_supplicant/wpa_supplicant_i.h | 2 |
5 files changed, 17 insertions, 47 deletions
diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c index b304c09..093ab0d 100644 --- a/wpa_supplicant/events.c +++ b/wpa_supplicant/events.c @@ -1057,9 +1057,10 @@ static int _wpa_supplicant_event_scan_results(struct wpa_supplicant *wpa_s, wpa_supplicant_notify_scanning(wpa_s, 0); #ifdef CONFIG_P2P - if (wpa_s->p2p_cb_on_scan_complete && !wpa_s->global->p2p_disabled && + if (wpa_s->global->p2p_cb_on_scan_complete && + !wpa_s->global->p2p_disabled && wpa_s->global->p2p != NULL && !wpa_s->sta_scan_pending) { - wpa_s->p2p_cb_on_scan_complete = 0; + wpa_s->global->p2p_cb_on_scan_complete = 0; if (p2p_other_scan_completed(wpa_s->global->p2p) == 1) { wpa_dbg(wpa_s, MSG_DEBUG, "P2P: Pending P2P operation " "stopped scan processing"); @@ -2455,11 +2456,11 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event, case EVENT_SCAN_RESULTS: wpa_supplicant_event_scan_results(wpa_s, data); #ifdef CONFIG_P2P - if (wpa_s->p2p_cb_on_scan_complete && !wpa_s->global->p2p_disabled && + if (wpa_s->global->p2p_cb_on_scan_complete && !wpa_s->global->p2p_disabled && wpa_s->global->p2p != NULL && wpa_s->wpa_state != WPA_AUTHENTICATING && wpa_s->wpa_state != WPA_ASSOCIATING) { - wpa_s->p2p_cb_on_scan_complete = 0; + wpa_s->global->p2p_cb_on_scan_complete = 0; if (p2p_other_scan_completed(wpa_s->global->p2p) == 1) { wpa_dbg(wpa_s, MSG_DEBUG, "P2P: Pending P2P operation " "continued after scan result processing"); diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c index 76f50c7..1b26ddf 100644 --- a/wpa_supplicant/p2p_supplicant.c +++ b/wpa_supplicant/p2p_supplicant.c @@ -78,9 +78,7 @@ enum p2p_group_removal_reason { #endif }; -#ifdef ANDROID_P2P -static int wpas_global_scan_in_progress(struct wpa_supplicant *wpa_s); -#endif + static void wpas_p2p_long_listen_timeout(void *eloop_ctx, void *timeout_ctx); static struct wpa_supplicant * wpas_p2p_get_group_iface(struct wpa_supplicant *wpa_s, int addr_allocated, @@ -100,22 +98,6 @@ static void wpas_p2p_set_group_idle_timeout(struct wpa_supplicant *wpa_s); static void wpas_p2p_fallback_to_go_neg(struct wpa_supplicant *wpa_s, int group_added); -#ifdef ANDROID_P2P -static int wpas_global_scan_in_progress(struct wpa_supplicant *wpa_s) -{ - struct wpa_supplicant *iface = NULL; - - for (iface = wpa_s->global->ifaces; iface; iface = iface->next) { - if(iface->scanning || iface->wpa_state == WPA_SCANNING) { - wpa_printf(MSG_DEBUG, "P2P: Scan in progress on %s," - "defer P2P SEARCH", iface->ifname); - return 1; - } - } - - return 0; -} -#endif static void wpas_p2p_scan_res_handler(struct wpa_supplicant *wpa_s, struct wpa_scan_results *scan_res) @@ -162,23 +144,10 @@ static int wpas_p2p_scan(void *ctx, enum p2p_scan_type type, int freq, wpa_printf(MSG_DEBUG, "Delaying P2P scan to allow " "pending station mode scan to be " "completed on interface %s", ifs->ifname); -#ifdef ANDROID_P2P - ifs->p2p_cb_on_scan_complete = 1; -#else - wpa_s->p2p_cb_on_scan_complete = 1; -#endif + wpa_s->global->p2p_cb_on_scan_complete = 1; wpa_supplicant_req_scan(ifs, 0, 0); return 1; } -#ifdef ANDROID_P2P - else if(ifs->scanning) { - wpa_printf(MSG_DEBUG, "Wait for the STA scan" - "to be " - "completed on interface %s", ifs->ifname); - ifs->p2p_cb_on_scan_complete = 1; - return 1; - } -#endif } os_memset(¶ms, 0, sizeof(params)); @@ -234,7 +203,7 @@ static int wpas_p2p_scan(void *ctx, enum p2p_scan_type type, int freq, if (ret) { if (wpa_s->scanning || wpa_s->scan_res_handler == wpas_p2p_scan_res_handler) { - wpa_s->p2p_cb_on_scan_complete = 1; + wpa_s->global->p2p_cb_on_scan_complete = 1; ret = 1; } } else @@ -4287,7 +4256,7 @@ void wpas_p2p_stop_find(struct wpa_supplicant *wpa_s) wpa_s->p2p_long_listen = 0; eloop_cancel_timeout(wpas_p2p_long_listen_timeout, wpa_s, NULL); eloop_cancel_timeout(wpas_p2p_join_scan, wpa_s, NULL); - wpa_s->p2p_cb_on_scan_complete = 0; + wpa_s->global->p2p_cb_on_scan_complete = 0; if (wpa_s->drv_flags & WPA_DRIVER_FLAGS_P2P_MGMT) { wpa_drv_p2p_stop_find(wpa_s); @@ -4620,9 +4589,9 @@ void wpas_p2p_completed(struct wpa_supplicant *wpa_s) wpas_notify_p2p_group_started(wpa_s, ssid, network_id, 1); done: - if (wpa_s->p2p_cb_on_scan_complete && !wpa_s->global->p2p_disabled && + if (wpa_s->global->p2p_cb_on_scan_complete && !wpa_s->global->p2p_disabled && wpa_s->global->p2p != NULL) { - wpa_s->p2p_cb_on_scan_complete = 0; + wpa_s->global->p2p_cb_on_scan_complete = 0; if (p2p_other_scan_completed(wpa_s->global->p2p) == 1) { wpa_dbg(wpa_s, MSG_DEBUG, "P2P: Pending P2P operation " "continued after successful connection"); diff --git a/wpa_supplicant/scan.c b/wpa_supplicant/scan.c index 8c548b3..bf55f5e 100644 --- a/wpa_supplicant/scan.c +++ b/wpa_supplicant/scan.c @@ -484,7 +484,7 @@ static void wpa_supplicant_scan(void *eloop_ctx, void *timeout_ctx) if (wpas_p2p_in_progress(wpa_s)) { if (wpa_s->sta_scan_pending && wpas_p2p_in_progress(wpa_s) == 2 && - wpa_s->p2p_cb_on_scan_complete) { + wpa_s->global->p2p_cb_on_scan_complete) { wpa_dbg(wpa_s, MSG_DEBUG, "Process pending station " "mode scan during P2P search"); } else { diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c index 8730e0f..49830d6 100644 --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c @@ -200,9 +200,9 @@ static void wpa_supplicant_timeout(void *eloop_ctx, void *timeout_ctx) wpa_supplicant_req_scan(wpa_s, 1, 0); #ifdef CONFIG_P2P - if (wpa_s->p2p_cb_on_scan_complete && !wpa_s->global->p2p_disabled && + if (wpa_s->global->p2p_cb_on_scan_complete && !wpa_s->global->p2p_disabled && wpa_s->global->p2p != NULL) { - wpa_s->p2p_cb_on_scan_complete = 0; + wpa_s->global->p2p_cb_on_scan_complete = 0; if (p2p_other_scan_completed(wpa_s->global->p2p) == 1) { wpa_dbg(wpa_s, MSG_DEBUG, "P2P: Pending P2P operation " "continued after timed out authentication"); @@ -3471,9 +3471,9 @@ void wpas_connection_failed(struct wpa_supplicant *wpa_s, const u8 *bssid) 1000 * (timeout % 1000)); #ifdef CONFIG_P2P - if (wpa_s->p2p_cb_on_scan_complete && !wpa_s->global->p2p_disabled && + if (wpa_s->global->p2p_cb_on_scan_complete && !wpa_s->global->p2p_disabled && wpa_s->global->p2p != NULL) { - wpa_s->p2p_cb_on_scan_complete = 0; + wpa_s->global->p2p_cb_on_scan_complete = 0; if (p2p_other_scan_completed(wpa_s->global->p2p) == 1) { wpa_dbg(wpa_s, MSG_DEBUG, "P2P: Pending P2P operation " "continued after failed association"); diff --git a/wpa_supplicant/wpa_supplicant_i.h b/wpa_supplicant/wpa_supplicant_i.h index 0bc2880..55f3d88 100644 --- a/wpa_supplicant/wpa_supplicant_i.h +++ b/wpa_supplicant/wpa_supplicant_i.h @@ -239,6 +239,7 @@ struct wpa_global { WPA_CONC_PREF_STA, WPA_CONC_PREF_P2P } conc_pref; + unsigned int p2p_cb_on_scan_complete:1; #ifdef CONFIG_WIFI_DISPLAY int wifi_display; @@ -541,7 +542,6 @@ struct wpa_supplicant { */ char cross_connect_uplink[100]; - unsigned int p2p_cb_on_scan_complete:1; unsigned int sta_scan_pending:1; unsigned int p2p_auto_join:1; unsigned int p2p_auto_pd:1; |