diff --git a/src/drivers/driver.h b/src/drivers/driver.h index 6e47b862b..33f53af32 100644 --- a/src/drivers/driver.h +++ b/src/drivers/driver.h @@ -351,7 +351,7 @@ struct wpa_driver_scan_params { * Mbps from the support rates element(s) in the Probe Request frames * and not to transmit the frames at any of those rates. */ - u8 p2p_probe; + unsigned int p2p_probe:1; /** * only_new_results - Request driver to report only new results @@ -360,7 +360,15 @@ struct wpa_driver_scan_params { * been detected after this scan request has been started, i.e., to * flush old cached BSS entries. */ - int only_new_results; + unsigned int only_new_results:1; + + /** + * low_priority - Requests driver to use a lower scan priority + * + * This is used to request the driver to use a lower scan priority + * if it supports such a thing. + */ + unsigned int low_priority:1; /* * NOTE: Whenever adding new parameters here, please make sure diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c index aa2cd04af..04f3e602e 100644 --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c @@ -307,6 +307,7 @@ struct wpa_driver_nl80211_data { unsigned int test_use_roc_tx:1; unsigned int ignore_deauth_event:1; unsigned int dfs_vendor_cmd_avail:1; + unsigned int have_low_prio_scan:1; u64 remain_on_chan_cookie; u64 send_action_cookie; @@ -3411,6 +3412,7 @@ struct wiphy_info_data { unsigned int p2p_concurrent:1; unsigned int channel_switch_supported:1; unsigned int set_qos_map_supported:1; + unsigned int have_low_prio_scan:1; }; @@ -3689,6 +3691,9 @@ static void wiphy_info_feature_flags(struct wiphy_info_data *info, if (flags & NL80211_FEATURE_AP_MODE_CHAN_WIDTH_CHANGE) capa->flags |= WPA_DRIVER_FLAGS_HT_2040_COEX; + + if (flags & NL80211_FEATURE_LOW_PRIORITY_SCAN) + info->have_low_prio_scan = 1; } @@ -3981,6 +3986,7 @@ static int wpa_driver_nl80211_capa(struct wpa_driver_nl80211_data *drv) drv->data_tx_status = info.data_tx_status; if (info.set_qos_map_supported) drv->capa.flags |= WPA_DRIVER_FLAGS_QOS_MAPPING; + drv->have_low_prio_scan = info.have_low_prio_scan; /* * If poll command and tx status are supported, mac80211 is new enough @@ -4949,6 +4955,7 @@ nl80211_scan_common(struct wpa_driver_nl80211_data *drv, u8 cmd, { struct nl_msg *msg; size_t i; + u32 scan_flags = 0; msg = nlmsg_alloc(); if (!msg) @@ -5007,10 +5014,18 @@ nl80211_scan_common(struct wpa_driver_nl80211_data *drv, u8 cmd, if (params->only_new_results) { wpa_printf(MSG_DEBUG, "nl80211: Add NL80211_SCAN_FLAG_FLUSH"); - NLA_PUT_U32(msg, NL80211_ATTR_SCAN_FLAGS, - NL80211_SCAN_FLAG_FLUSH); + scan_flags |= NL80211_SCAN_FLAG_FLUSH; } + if (params->low_priority && drv->have_low_prio_scan) { + wpa_printf(MSG_DEBUG, + "nl80211: Add NL80211_SCAN_FLAG_LOW_PRIORITY"); + scan_flags |= NL80211_SCAN_FLAG_LOW_PRIORITY; + } + + if (scan_flags) + NLA_PUT_U32(msg, NL80211_ATTR_SCAN_FLAGS, scan_flags); + return msg; fail: diff --git a/wpa_supplicant/scan.c b/wpa_supplicant/scan.c index aaef3c311..a2b996ff9 100644 --- a/wpa_supplicant/scan.c +++ b/wpa_supplicant/scan.c @@ -1857,6 +1857,7 @@ wpa_scan_clone_params(const struct wpa_driver_scan_params *src) params->filter_rssi = src->filter_rssi; params->p2p_probe = src->p2p_probe; params->only_new_results = src->only_new_results; + params->low_priority = src->low_priority; return params; diff --git a/wpa_supplicant/sme.c b/wpa_supplicant/sme.c index 81a1eded6..1b0439841 100644 --- a/wpa_supplicant/sme.c +++ b/wpa_supplicant/sme.c @@ -1167,6 +1167,7 @@ static void sme_obss_scan_timeout(void *eloop_ctx, void *timeout_ctx) os_memset(¶ms, 0, sizeof(params)); wpa_setband_scan_freqs_list(wpa_s, HOSTAPD_MODE_IEEE80211G, ¶ms); + params.low_priority = 1; wpa_printf(MSG_DEBUG, "SME OBSS: Request an OBSS scan"); if (wpa_supplicant_trigger_scan(wpa_s, ¶ms))