nl80211: Use low-priority scan for OBSS scan

Some drivers may support low-priority scans, if they do then
use that for OBSS scanning.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
Johannes Berg 2014-06-04 11:21:40 +02:00 committed by Jouni Malinen
parent 31424fa732
commit 57a8f8af38
4 changed files with 29 additions and 4 deletions

View File

@ -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

View File

@ -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:

View File

@ -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;

View File

@ -1167,6 +1167,7 @@ static void sme_obss_scan_timeout(void *eloop_ctx, void *timeout_ctx)
os_memset(&params, 0, sizeof(params));
wpa_setband_scan_freqs_list(wpa_s, HOSTAPD_MODE_IEEE80211G, &params);
params.low_priority = 1;
wpa_printf(MSG_DEBUG, "SME OBSS: Request an OBSS scan");
if (wpa_supplicant_trigger_scan(wpa_s, &params))