Use normal scan before sched_scan if that can speed up connection
When normal scan can speed up operations, use that for the first three scan runs before starting the sched_scan to allow user space sleep more. We do this only if the normal scan has functionality that is suitable for this or if the sched_scan does not have better support for multiple SSIDs. Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
parent
76a5249e52
commit
0b7a25c00f
4 changed files with 37 additions and 9 deletions
|
@ -3335,6 +3335,7 @@ char * wpa_supplicant_ctrl_iface_process(struct wpa_supplicant *wpa_s,
|
|||
} else if (os_strcmp(buf, "LOGOFF") == 0) {
|
||||
eapol_sm_notify_logoff(wpa_s->eapol, TRUE);
|
||||
} else if (os_strcmp(buf, "REASSOCIATE") == 0) {
|
||||
wpa_s->normal_scans = 0;
|
||||
if (wpa_s->wpa_state == WPA_INTERFACE_DISABLED)
|
||||
reply_len = -1;
|
||||
else {
|
||||
|
@ -3343,6 +3344,7 @@ char * wpa_supplicant_ctrl_iface_process(struct wpa_supplicant *wpa_s,
|
|||
wpa_supplicant_req_scan(wpa_s, 0, 0);
|
||||
}
|
||||
} else if (os_strcmp(buf, "RECONNECT") == 0) {
|
||||
wpa_s->normal_scans = 0;
|
||||
if (wpa_s->wpa_state == WPA_INTERFACE_DISABLED)
|
||||
reply_len = -1;
|
||||
else if (wpa_s->disconnected) {
|
||||
|
@ -3584,6 +3586,7 @@ char * wpa_supplicant_ctrl_iface_process(struct wpa_supplicant *wpa_s,
|
|||
wpa_supplicant_deauthenticate(wpa_s,
|
||||
WLAN_REASON_DEAUTH_LEAVING);
|
||||
} else if (os_strcmp(buf, "SCAN") == 0) {
|
||||
wpa_s->normal_scans = 0;
|
||||
if (wpa_s->wpa_state == WPA_INTERFACE_DISABLED)
|
||||
reply_len = -1;
|
||||
else {
|
||||
|
|
|
@ -203,8 +203,10 @@ int wpa_supplicant_trigger_scan(struct wpa_supplicant *wpa_s,
|
|||
if (ret) {
|
||||
wpa_supplicant_notify_scanning(wpa_s, 0);
|
||||
wpas_notify_scan_done(wpa_s, 0);
|
||||
} else
|
||||
} else {
|
||||
wpa_s->scan_runs++;
|
||||
wpa_s->normal_scans++;
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@ -702,6 +704,7 @@ int wpa_supplicant_req_sched_scan(struct wpa_supplicant *wpa_s)
|
|||
int ret;
|
||||
unsigned int max_sched_scan_ssids;
|
||||
int wildcard = 0;
|
||||
int need_ssids;
|
||||
|
||||
if (!wpa_s->sched_scan_supported)
|
||||
return -1;
|
||||
|
@ -718,6 +721,33 @@ int wpa_supplicant_req_sched_scan(struct wpa_supplicant *wpa_s)
|
|||
return 0;
|
||||
}
|
||||
|
||||
need_ssids = 0;
|
||||
for (ssid = wpa_s->conf->ssid; ssid; ssid = ssid->next) {
|
||||
if (!ssid->disabled && !ssid->scan_ssid) {
|
||||
/* Use wildcard SSID to find this network */
|
||||
wildcard = 1;
|
||||
} else if (!ssid->disabled && ssid->ssid_len)
|
||||
need_ssids++;
|
||||
}
|
||||
if (wildcard)
|
||||
need_ssids++;
|
||||
|
||||
if (wpa_s->normal_scans < 3 &&
|
||||
(need_ssids <= wpa_s->max_scan_ssids ||
|
||||
wpa_s->max_scan_ssids >= (int) max_sched_scan_ssids)) {
|
||||
/*
|
||||
* When normal scan can speed up operations, use that for the
|
||||
* first operations before starting the sched_scan to allow
|
||||
* user space sleep more. We do this only if the normal scan
|
||||
* has functionality that is suitable for this or if the
|
||||
* sched_scan does not have better support for multiple SSIDs.
|
||||
*/
|
||||
wpa_dbg(wpa_s, MSG_DEBUG, "Use normal scan instead of "
|
||||
"sched_scan for initial scans (normal_scans=%d)",
|
||||
wpa_s->normal_scans);
|
||||
return -1;
|
||||
}
|
||||
|
||||
os_memset(¶ms, 0, sizeof(params));
|
||||
|
||||
/* If we can't allocate space for the filters, we just don't filter */
|
||||
|
@ -729,14 +759,6 @@ int wpa_supplicant_req_sched_scan(struct wpa_supplicant *wpa_s)
|
|||
wpa_s->wpa_state == WPA_INACTIVE)
|
||||
wpa_supplicant_set_state(wpa_s, WPA_SCANNING);
|
||||
|
||||
for (ssid = wpa_s->conf->ssid; ssid; ssid = ssid->next) {
|
||||
if (!ssid->disabled && !ssid->scan_ssid) {
|
||||
/* Use wildcard SSID to find this network */
|
||||
wildcard = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Find the starting point from which to continue scanning */
|
||||
ssid = wpa_s->conf->ssid;
|
||||
if (wpa_s->prev_sched_ssid) {
|
||||
|
|
|
@ -337,6 +337,7 @@ struct wpa_supplicant {
|
|||
int scan_runs; /* number of scan runs since WPS was started */
|
||||
int *next_scan_freqs;
|
||||
int scan_interval; /* time in sec between scans to find suitable AP */
|
||||
int normal_scans; /* normal scans run before sched_scan */
|
||||
|
||||
unsigned int drv_flags;
|
||||
int max_scan_ssids;
|
||||
|
|
|
@ -88,6 +88,7 @@ int wpas_wps_eapol_cb(struct wpa_supplicant *wpa_s)
|
|||
}
|
||||
wpa_s->after_wps = 5;
|
||||
wpa_s->wps_freq = wpa_s->assoc_freq;
|
||||
wpa_s->normal_scans = 0;
|
||||
wpa_s->reassociate = 1;
|
||||
wpa_supplicant_req_scan(wpa_s, 0, 0);
|
||||
return 1;
|
||||
|
@ -814,6 +815,7 @@ static void wpas_wps_reassoc(struct wpa_supplicant *wpa_s,
|
|||
wpa_s->disconnected = 0;
|
||||
wpa_s->reassociate = 1;
|
||||
wpa_s->scan_runs = 0;
|
||||
wpa_s->normal_scans = 0;
|
||||
wpa_s->wps_success = 0;
|
||||
wpa_s->blacklist_cleared = 0;
|
||||
wpa_supplicant_req_scan(wpa_s, 0, 0);
|
||||
|
|
Loading…
Reference in a new issue