From 85b6b6b6e122a62136db7a0db9eb50154564b28d Mon Sep 17 00:00:00 2001 From: Sunil Dutt Date: Thu, 2 Feb 2017 18:19:45 +0530 Subject: [PATCH] Serialize scan/p2p-scan if already scheduled on the same interface The current implementation of QCA vendor scan does not handle the simultaneous scan/p2p-scan operations on the same interface due to missing support for tracking multiple scan cookie values. Hence serialize such operations on the same interface for now. Signed-off-by: Jouni Malinen --- wpa_supplicant/wpa_supplicant.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c index 448a59271..11046bb9a 100644 --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c @@ -4367,6 +4367,13 @@ static void radio_work_free(struct wpa_radio_work *work) } +static int radio_work_is_scan(struct wpa_radio_work *work) +{ + return os_strcmp(work->type, "scan") == 0 || + os_strcmp(work->type, "p2p-scan") == 0; +} + + static struct wpa_radio_work * radio_work_get_next_work(struct wpa_radio *radio) { struct wpa_radio_work *active_work = NULL; @@ -4420,6 +4427,17 @@ static struct wpa_radio_work * radio_work_get_next_work(struct wpa_radio *radio) os_strcmp(tmp->type, "sme-connect") == 0) break; + /* Serialize parallel scan and p2p_scan operations on the same + * interface since the driver_nl80211 mechanism for tracking + * scan cookies does not yet have support for this. */ + if (active_work->wpa_s == tmp->wpa_s && + radio_work_is_scan(active_work) && + radio_work_is_scan(tmp)) { + wpa_dbg(active_work->wpa_s, MSG_DEBUG, + "Do not start work '%s' when another work '%s' is already scheduled", + tmp->type, active_work->type); + continue; + } /* * Check that the radio works are distinct and * on different bands.