P2P: Allow scan operations during p2p_find
Previously, all station mode scan operations were either skipped or delayed while any P2P operation was in progress. To make concurrent operations easier to use, reduce this limitation by allowing a scan operation to be completed in the middle of a p2p_find. In addition, allow station mode association to be completed. When the station mode operation is run to its completion (scan results not acted on, connection to an AP completed, connection failed), resume the p2p_find operation. Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
parent
05a77b3b46
commit
99fcd40409
8 changed files with 111 additions and 10 deletions
|
@ -1027,7 +1027,7 @@ static int _wpa_supplicant_event_scan_results(struct wpa_supplicant *wpa_s,
|
|||
|
||||
#ifdef CONFIG_P2P
|
||||
if (wpa_s->p2p_cb_on_scan_complete && !wpa_s->global->p2p_disabled &&
|
||||
wpa_s->global->p2p != NULL) {
|
||||
wpa_s->global->p2p != NULL && !wpa_s->sta_scan_pending) {
|
||||
wpa_s->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 "
|
||||
|
@ -1035,6 +1035,7 @@ static int _wpa_supplicant_event_scan_results(struct wpa_supplicant *wpa_s,
|
|||
return -1;
|
||||
}
|
||||
}
|
||||
wpa_s->sta_scan_pending = 0;
|
||||
#endif /* CONFIG_P2P */
|
||||
|
||||
scan_res = wpa_supplicant_get_scan_results(wpa_s,
|
||||
|
@ -2321,6 +2322,18 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
|
|||
#ifndef CONFIG_NO_SCAN_PROCESSING
|
||||
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 &&
|
||||
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;
|
||||
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");
|
||||
}
|
||||
}
|
||||
#endif /* CONFIG_P2P */
|
||||
break;
|
||||
#endif /* CONFIG_NO_SCAN_PROCESSING */
|
||||
case EVENT_ASSOCINFO:
|
||||
|
|
|
@ -121,6 +121,7 @@ static int wpas_p2p_scan(void *ctx, enum p2p_scan_type type, int freq,
|
|||
const u8 *req_dev_types, const u8 *dev_id, u16 pw_id)
|
||||
{
|
||||
struct wpa_supplicant *wpa_s = ctx;
|
||||
struct wpa_supplicant *ifs;
|
||||
struct wpa_driver_scan_params params;
|
||||
int ret;
|
||||
struct wpabuf *wps_ie, *ies;
|
||||
|
@ -130,6 +131,18 @@ static int wpas_p2p_scan(void *ctx, enum p2p_scan_type type, int freq,
|
|||
if (wpa_s->global->p2p_disabled || wpa_s->global->p2p == NULL)
|
||||
return -1;
|
||||
|
||||
for (ifs = wpa_s->global->ifaces; ifs; ifs = ifs->next) {
|
||||
if (ifs->sta_scan_pending &&
|
||||
wpas_p2p_in_progress(wpa_s) == 2) {
|
||||
wpa_printf(MSG_DEBUG, "Delaying P2P scan to allow "
|
||||
"pending station mode scan to be "
|
||||
"completed on interface %s", ifs->ifname);
|
||||
wpa_s->p2p_cb_on_scan_complete = 1;
|
||||
wpa_supplicant_req_scan(ifs, 0, 0);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
os_memset(¶ms, 0, sizeof(params));
|
||||
|
||||
/* P2P Wildcard SSID */
|
||||
|
@ -4263,7 +4276,7 @@ void wpas_p2p_completed(struct wpa_supplicant *wpa_s)
|
|||
}
|
||||
|
||||
if (!wpa_s->show_group_started || !ssid)
|
||||
return;
|
||||
goto done;
|
||||
|
||||
wpa_s->show_group_started = 0;
|
||||
|
||||
|
@ -4305,6 +4318,19 @@ void wpas_p2p_completed(struct wpa_supplicant *wpa_s)
|
|||
if (network_id < 0)
|
||||
network_id = ssid->id;
|
||||
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 &&
|
||||
wpa_s->global->p2p != NULL) {
|
||||
wpa_s->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");
|
||||
p2p_increase_search_delay(
|
||||
wpa_s->global->p2p,
|
||||
wpas_p2p_search_delay(wpa_s));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -468,15 +468,18 @@ static void wpa_supplicant_scan(void *eloop_ctx, void *timeout_ctx)
|
|||
|
||||
#ifdef CONFIG_P2P
|
||||
if (wpas_p2p_in_progress(wpa_s)) {
|
||||
if (wpa_s->wpa_state == WPA_SCANNING) {
|
||||
if (wpa_s->sta_scan_pending &&
|
||||
wpas_p2p_in_progress(wpa_s) == 2 &&
|
||||
wpa_s->p2p_cb_on_scan_complete) {
|
||||
wpa_dbg(wpa_s, MSG_DEBUG, "Process pending station "
|
||||
"mode scan during P2P search");
|
||||
} else {
|
||||
wpa_dbg(wpa_s, MSG_DEBUG, "Delay station mode scan "
|
||||
"while P2P operation is in progress");
|
||||
wpa_s->sta_scan_pending = 1;
|
||||
wpa_supplicant_req_scan(wpa_s, 5, 0);
|
||||
} else {
|
||||
wpa_dbg(wpa_s, MSG_DEBUG, "Do not request scan while "
|
||||
"P2P operation is in progress");
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
#endif /* CONFIG_P2P */
|
||||
|
||||
|
|
|
@ -192,6 +192,20 @@ static void wpa_supplicant_timeout(void *eloop_ctx, void *timeout_ctx)
|
|||
* So, wait a second until scanning again.
|
||||
*/
|
||||
wpa_supplicant_req_scan(wpa_s, 1, 0);
|
||||
|
||||
#ifdef CONFIG_P2P
|
||||
if (wpa_s->p2p_cb_on_scan_complete && !wpa_s->global->p2p_disabled &&
|
||||
wpa_s->global->p2p != NULL) {
|
||||
wpa_s->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");
|
||||
p2p_increase_search_delay(
|
||||
wpa_s->global->p2p,
|
||||
wpas_p2p_search_delay(wpa_s));
|
||||
}
|
||||
}
|
||||
#endif /* CONFIG_P2P */
|
||||
}
|
||||
|
||||
|
||||
|
@ -3392,6 +3406,17 @@ void wpas_connection_failed(struct wpa_supplicant *wpa_s, const u8 *bssid)
|
|||
*/
|
||||
wpa_supplicant_req_scan(wpa_s, timeout / 1000,
|
||||
1000 * (timeout % 1000));
|
||||
|
||||
#ifdef CONFIG_P2P
|
||||
if (wpa_s->p2p_cb_on_scan_complete && !wpa_s->global->p2p_disabled &&
|
||||
wpa_s->global->p2p != NULL) {
|
||||
wpa_s->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");
|
||||
}
|
||||
}
|
||||
#endif /* CONFIG_P2P */
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -515,6 +515,7 @@ 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;
|
||||
unsigned int p2p_persistent_group:1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue