From patchwork Tue Apr 24 13:08:37 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rajkumar Manoharan X-Patchwork-Id: 154675 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 DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "maxx.shmoo.com", Issuer "CA Cert Signing Authority" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 78198B6FBB for ; Tue, 24 Apr 2012 23:08:46 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 3D1CC9D241; Tue, 24 Apr 2012 09:08:41 -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 kIzlLrA1UdJl; Tue, 24 Apr 2012 09:08:40 -0400 (EDT) Received: from maxx.shmoo.com (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id CCF1D9D25E; Tue, 24 Apr 2012 09:08:22 -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 375139D248 for ; Tue, 24 Apr 2012 09:08:21 -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 k2w-g4INMCzH for ; Tue, 24 Apr 2012 09:08:16 -0400 (EDT) Received: from wolverine01.qualcomm.com (wolverine01.qualcomm.com [199.106.114.254]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "wolverine01.qualcomm.com", Issuer "VeriSign Class 3 Secure Server CA" (not verified)) by maxx.maxx.shmoo.com (Postfix) with ESMTPS id 372619D25E for ; Tue, 24 Apr 2012 09:08:02 -0400 (EDT) X-IronPort-AV: E=McAfee;i="5400,1158,6690"; a="184418418" Received: from ironmsg04-r.qualcomm.com ([172.30.46.18]) by wolverine01.qualcomm.com with ESMTP; 24 Apr 2012 06:08:01 -0700 X-IronPort-AV: E=Sophos;i="4.75,470,1330934400"; d="scan'208";a="304463008" Received: from nasanexhc05.na.qualcomm.com ([172.30.48.2]) by Ironmsg04-R.qualcomm.com with ESMTP/TLS/AES128-SHA; 24 Apr 2012 06:08:01 -0700 Received: from qcmail1.qualcomm.com (172.30.48.1) by qcmail1.qualcomm.com (172.30.48.2) with Microsoft SMTP Server (TLS) id 14.2.283.3; Tue, 24 Apr 2012 06:07:59 -0700 Received: by qcmail1.qualcomm.com (sSMTP sendmail emulation); Tue, 24 Apr 2012 18:38:53 +0530 From: Rajkumar Manoharan To: Subject: [PATCH 3/3] wpa_supplicant: Add support to handle OBSS scan request Date: Tue, 24 Apr 2012 18:38:37 +0530 Message-ID: <1335272917-7503-3-git-send-email-rmanohar@qca.qualcomm.com> X-Mailer: git-send-email 1.7.10 In-Reply-To: <1335272917-7503-1-git-send-email-rmanohar@qca.qualcomm.com> References: <1335272917-7503-1-git-send-email-rmanohar@qca.qualcomm.com> MIME-Version: 1.0 X-Originating-IP: [172.30.48.1] Cc: hostap@lists.shmoo.com X-BeenThere: hostap@lists.shmoo.com X-Mailman-Version: 2.1.9 Precedence: list List-Id: HostAP Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: hostap-bounces@lists.shmoo.com Errors-To: hostap-bounces@lists.shmoo.com Parse the OBSS scan parameter from beacon IE and schedule periodic scan to generate 2040 coexistence channel report. This patch decodes Scan Interval alone from the OBSS Scan parameter IE and triggers scan on timeout. Signed-off-by: Rajkumar Manoharan --- wpa_supplicant/bss.h | 3 +++ wpa_supplicant/events.c | 9 ++++----- wpa_supplicant/sme.c | 40 +++++++++++++++++++++++++++++++++++++++ wpa_supplicant/sme.h | 4 ++++ wpa_supplicant/wpa_supplicant.c | 2 ++ 5 files changed, 53 insertions(+), 5 deletions(-) diff --git a/wpa_supplicant/bss.h b/wpa_supplicant/bss.h index 37ca72c..d1c8e8f 100644 --- a/wpa_supplicant/bss.h +++ b/wpa_supplicant/bss.h @@ -36,6 +36,7 @@ struct wpa_scan_res; * @level: signal level * @tsf: Timestamp of last Beacon/Probe Response frame * @last_update: Time of the last update (i.e., Beacon or Probe Response RX) + * @obss_scan_int: OBSS scan interval in seconds (host byte order) * @ie_len: length of the following IE field in octets (from Probe Response) * @beacon_ie_len: length of the following Beacon IE field in octets * @@ -69,6 +70,8 @@ struct wpa_bss { struct wpabuf *anqp_3gpp; struct wpabuf *anqp_domain_name; #endif /* CONFIG_INTERWORKING */ + u8 sched_obss_scan; + u16 obss_scan_int; size_t ie_len; size_t beacon_ie_len; /* followed by ie_len octets of IEs */ diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c index a0bd903..4960bba 100644 --- a/wpa_supplicant/events.c +++ b/wpa_supplicant/events.c @@ -1096,11 +1096,10 @@ static int _wpa_supplicant_event_scan_results(struct wpa_supplicant *wpa_s, selected = wpa_supplicant_pick_network(wpa_s, scan_res, &ssid); - /* - * TODO: This should be done at the completion of OBSS scan operations - * which may or may not be identical to other scans.. - */ - sme_proc_40mhz_intolerant(wpa_s); + if (wpa_s->current_bss && wpa_s->current_bss->sched_obss_scan) { + wpa_s->current_bss->sched_obss_scan = 0; + sme_proc_40mhz_intolerant(wpa_s); + } if (selected) { int skip; diff --git a/wpa_supplicant/sme.c b/wpa_supplicant/sme.c index 07f5d3e..5e06390 100644 --- a/wpa_supplicant/sme.c +++ b/wpa_supplicant/sme.c @@ -760,6 +760,46 @@ void sme_proc_40mhz_intolerant(struct wpa_supplicant *wpa_s) num_channels, num_intol); } +static void sme_obss_scan_timeout(void *eloop_ctx, void *timeout_ctx) +{ + struct wpa_supplicant *wpa_s = eloop_ctx; + struct wpa_driver_scan_params params; + + if (!wpa_s->current_bss) { + wpa_printf(MSG_DEBUG, "SME OBSS: Ignore Scan Request\n"); + return; + } + + os_memset(¶ms, 0, sizeof(params)); + wpa_printf(MSG_DEBUG, "SME OBSS: Request a OBSS scan"); + + if (wpa_supplicant_trigger_scan(wpa_s, ¶ms)) + wpa_printf(MSG_DEBUG, "SME OBSS: Failed to trigger scan"); + else + wpa_s->current_bss->sched_obss_scan = 1; + + eloop_register_timeout(wpa_s->current_bss->obss_scan_int, 0, + sme_obss_scan_timeout, wpa_s, NULL); +} + +void sme_sched_obss_scan(struct wpa_supplicant *wpa_s) +{ + const u8 *ie; + + if (wpa_s->wpa_state != WPA_COMPLETED) + return; + + ie = wpa_bss_get_ie(wpa_s->current_bss, + WLAN_EID_OVERLAPPING_BSS_SCAN_PARAMS); + if (!ie || (ie[1] != 14)) + return; + + wpa_s->current_bss->obss_scan_int = WPA_GET_LE16(ie + 6); + wpa_printf(MSG_DEBUG, "SME: OBSS Scan Interval %d\n", + wpa_s->current_bss->obss_scan_int); + eloop_register_timeout(wpa_s->current_bss->obss_scan_int, 0, + sme_obss_scan_timeout, wpa_s, NULL); +} #ifdef CONFIG_IEEE80211W static const unsigned int sa_query_max_timeout = 1000; diff --git a/wpa_supplicant/sme.h b/wpa_supplicant/sme.h index f735832..ef6c091 100644 --- a/wpa_supplicant/sme.h +++ b/wpa_supplicant/sme.h @@ -37,6 +37,7 @@ void sme_deinit(struct wpa_supplicant *wpa_s); void sme_proc_40mhz_intolerant(struct wpa_supplicant *wpa_s); +void sme_sched_obss_scan(struct wpa_supplicant *wpa_s); #else /* CONFIG_SME */ static inline void sme_authenticate(struct wpa_supplicant *wpa_s, @@ -101,6 +102,9 @@ static inline void sme_proc_40mhz_intolerant(struct wpa_supplicant *wpa_s) { } +static inline void sme_sched_obss_scan(struct wpa_supplicant *wpa_s) +{ +} #endif /* CONFIG_SME */ #endif /* SME_H */ diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c index c5a7115..a9d9b85 100644 --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c @@ -624,6 +624,8 @@ void wpa_supplicant_set_state(struct wpa_supplicant *wpa_s, wpa_supplicant_stop_bgscan(wpa_s); #endif /* CONFIG_BGSCAN */ + sme_sched_obss_scan(wpa_s); + if (wpa_s->wpa_state != old_state) { wpas_notify_state_changed(wpa_s, wpa_s->wpa_state, old_state);