P2P: Delay P2P scan when an external scan is in progress
When an external scan is in progress on the same radio, delay the P2P search operation based on configuration parameter p2p_search_delay. The "search_delay" configuration done through p2p_find always takes precedence over this delay value set due to an external scan trigger. Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
This commit is contained in:
parent
f39d6aacbb
commit
7b121af26a
3 changed files with 27 additions and 5 deletions
|
@ -3510,12 +3510,17 @@ int p2p_scan_res_handler(struct p2p_data *p2p, const u8 *bssid, int freq,
|
|||
}
|
||||
|
||||
|
||||
void p2p_scan_res_handled(struct p2p_data *p2p)
|
||||
void p2p_scan_res_handled(struct p2p_data *p2p, unsigned int delay)
|
||||
{
|
||||
if (!p2p->p2p_scan_running) {
|
||||
p2p_dbg(p2p, "p2p_scan was not running, but scan results received");
|
||||
}
|
||||
p2p->p2p_scan_running = 0;
|
||||
|
||||
/* Use this delay only when p2p_find doesn't set it */
|
||||
if (!p2p->search_delay)
|
||||
p2p->search_delay = delay;
|
||||
|
||||
eloop_cancel_timeout(p2p_scan_timeout, p2p, NULL);
|
||||
|
||||
if (p2p_run_after_scan(p2p))
|
||||
|
|
|
@ -1625,6 +1625,7 @@ int p2p_scan_res_handler(struct p2p_data *p2p, const u8 *bssid, int freq,
|
|||
/**
|
||||
* p2p_scan_res_handled - Indicate end of scan results
|
||||
* @p2p: P2P module context from p2p_init()
|
||||
* @delay: Search delay for next scan in ms
|
||||
*
|
||||
* This function is called to indicate that all P2P scan results from a scan
|
||||
* have been reported with zero or more calls to p2p_scan_res_handler(). This
|
||||
|
@ -1632,7 +1633,7 @@ int p2p_scan_res_handler(struct p2p_data *p2p, const u8 *bssid, int freq,
|
|||
* struct p2p_config::p2p_scan() call if none of the p2p_scan_res_handler()
|
||||
* calls stopped iteration.
|
||||
*/
|
||||
void p2p_scan_res_handled(struct p2p_data *p2p);
|
||||
void p2p_scan_res_handled(struct p2p_data *p2p, unsigned int delay);
|
||||
|
||||
enum p2p_send_action_result {
|
||||
P2P_SEND_ACTION_SUCCESS /* Frame was send and acknowledged */,
|
||||
|
|
|
@ -242,6 +242,22 @@ static void wpas_p2p_set_own_freq_preference(struct wpa_supplicant *wpa_s,
|
|||
}
|
||||
|
||||
|
||||
static void wpas_p2p_scan_res_handled(struct wpa_supplicant *wpa_s)
|
||||
{
|
||||
unsigned int delay = wpas_p2p_search_delay(wpa_s);
|
||||
|
||||
/* In case of concurrent P2P and external scans, delay P2P search. */
|
||||
if (wpa_s->radio->external_scan_running) {
|
||||
delay = wpa_s->conf->p2p_search_delay;
|
||||
wpa_printf(MSG_DEBUG,
|
||||
"P2P: Delay next P2P search by %d ms to let externally triggered scan complete",
|
||||
delay);
|
||||
}
|
||||
|
||||
p2p_scan_res_handled(wpa_s->global->p2p, delay);
|
||||
}
|
||||
|
||||
|
||||
static void wpas_p2p_scan_res_handler(struct wpa_supplicant *wpa_s,
|
||||
struct wpa_scan_results *scan_res)
|
||||
{
|
||||
|
@ -287,7 +303,7 @@ static void wpas_p2p_scan_res_handler(struct wpa_supplicant *wpa_s,
|
|||
break;
|
||||
}
|
||||
|
||||
p2p_scan_res_handled(wpa_s->global->p2p);
|
||||
wpas_p2p_scan_res_handled(wpa_s);
|
||||
}
|
||||
|
||||
|
||||
|
@ -305,7 +321,7 @@ static void wpas_p2p_scan_res_fail_handler(struct wpa_supplicant *wpa_s)
|
|||
|
||||
wpa_dbg(wpa_s, MSG_DEBUG,
|
||||
"P2P: Failed to get scan results - try to continue");
|
||||
p2p_scan_res_handled(wpa_s->global->p2p);
|
||||
wpas_p2p_scan_res_handled(wpa_s);
|
||||
}
|
||||
|
||||
|
||||
|
@ -7089,7 +7105,7 @@ static void wpas_p2p_scan_res_ignore_search(struct wpa_supplicant *wpa_s,
|
|||
* Indicate that results have been processed so that the P2P module can
|
||||
* continue pending tasks.
|
||||
*/
|
||||
p2p_scan_res_handled(wpa_s->global->p2p);
|
||||
wpas_p2p_scan_res_handled(wpa_s);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue