From patchwork Wed Jun 4 09:21:40 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Berg X-Patchwork-Id: 355789 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from maxx.maxx.shmoo.com (maxx.shmoo.com [205.134.188.171]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 65B841400AF for ; Wed, 4 Jun 2014 19:22:09 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 338B69D22D; Wed, 4 Jun 2014 05:22:06 -0400 (EDT) X-Virus-Scanned: amavisd-new at maxx.shmoo.com Received: from maxx.maxx.shmoo.com ([127.0.0.1]) by localhost (maxx.shmoo.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Fy3An0QRM5UI; Wed, 4 Jun 2014 05:22:05 -0400 (EDT) Received: from maxx.shmoo.com (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 3A1D29D225; Wed, 4 Jun 2014 05:22:00 -0400 (EDT) X-Original-To: mailman-post+hostap@maxx.shmoo.com Delivered-To: mailman-post+hostap@maxx.shmoo.com Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 14E3B9D225 for ; Wed, 4 Jun 2014 05:21:59 -0400 (EDT) X-Virus-Scanned: amavisd-new at maxx.shmoo.com Received: from maxx.maxx.shmoo.com ([127.0.0.1]) by localhost (maxx.shmoo.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id JSEKxp+oJUAR for ; Wed, 4 Jun 2014 05:21:52 -0400 (EDT) Received: from sipsolutions.net (s3.sipsolutions.net [5.9.151.49]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (Client did not present a certificate) by maxx.maxx.shmoo.com (Postfix) with ESMTPS id 50E249D221 for ; Wed, 4 Jun 2014 05:21:52 -0400 (EDT) Received: by sipsolutions.net with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_CBC_SHA256:128) (Exim 4.82_1-5b7a7c0-XX) (envelope-from ) id 1Ws7OH-0004nv-IA; Wed, 04 Jun 2014 11:21:49 +0200 From: Johannes Berg To: hostap@lists.shmoo.com Subject: [PATCH] driver_nl80211: use low-priority scan for OBSS scan Date: Wed, 4 Jun 2014 11:21:40 +0200 Message-Id: <1401873700-3572-1-git-send-email-johannes@sipsolutions.net> X-Mailer: git-send-email 2.0.0.rc0 Cc: Johannes Berg X-BeenThere: hostap@lists.shmoo.com X-Mailman-Version: 2.1.11 Precedence: list List-Id: HostAP Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: hostap-bounces@lists.shmoo.com Errors-To: hostap-bounces@lists.shmoo.com From: Johannes Berg Some drivers may support low-priority scans, if they do then use that for OBSS scanning. Signed-off-by: Johannes Berg --- src/drivers/driver.h | 12 ++++++++++-- src/drivers/driver_nl80211.c | 17 +++++++++++++++-- wpa_supplicant/scan.c | 1 + wpa_supplicant/sme.c | 1 + 4 files changed, 27 insertions(+), 4 deletions(-) diff --git a/src/drivers/driver.h b/src/drivers/driver.h index 6e47b862b742..33f53af32c5a 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 756865387746..41ff1e21ab0a 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,16 @@ 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; } + 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 4d96e82cdfad..6c1889d3c593 100644 --- a/wpa_supplicant/scan.c +++ b/wpa_supplicant/scan.c @@ -1859,6 +1859,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 9b6667a62b7b..bc357998385d 100644 --- a/wpa_supplicant/sme.c +++ b/wpa_supplicant/sme.c @@ -1166,6 +1166,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))