From patchwork Tue Nov 8 14:11:16 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arik Nemtsov X-Patchwork-Id: 124367 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 0A7A9B6F0E for ; Wed, 9 Nov 2011 01:11:42 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 0EB449C1CB; Tue, 8 Nov 2011 09:11:39 -0500 (EST) 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 zfu73mTSZv2t; Tue, 8 Nov 2011 09:11:38 -0500 (EST) Received: from maxx.shmoo.com (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id BCDCC9D1F0; Tue, 8 Nov 2011 09:11:32 -0500 (EST) 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 95AE89D1F0 for ; Tue, 8 Nov 2011 09:11:31 -0500 (EST) 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 ihLX9tvgYSvO for ; Tue, 8 Nov 2011 09:11:26 -0500 (EST) Received: from mail-wy0-f172.google.com (mail-wy0-f172.google.com [74.125.82.172]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority" (not verified)) by maxx.maxx.shmoo.com (Postfix) with ESMTPS id 5D0D89C1CB for ; Tue, 8 Nov 2011 09:11:26 -0500 (EST) Received: by wyg30 with SMTP id 30so831824wyg.17 for ; Tue, 08 Nov 2011 06:11:25 -0800 (PST) Received: by 10.227.205.76 with SMTP id fp12mr35690190wbb.17.1320761484865; Tue, 08 Nov 2011 06:11:24 -0800 (PST) Received: from localhost.localdomain (46-116-162-41.bb.netvision.net.il. [46.116.162.41]) by mx.google.com with ESMTPS id en13sm1839901wbb.22.2011.11.08.06.11.22 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 08 Nov 2011 06:11:24 -0800 (PST) From: Arik Nemtsov To: hostap@lists.shmoo.com Subject: [PATCH v3 1/3] driver_nl80211: Propagate probe-resp offload caps from kernel Date: Tue, 8 Nov 2011 16:11:16 +0200 Message-Id: <1320761478-29133-1-git-send-email-arik@wizery.com> X-Mailer: git-send-email 1.7.5.4 Cc: Arik Nemtsov 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: , MIME-Version: 1.0 Sender: hostap-bounces@lists.shmoo.com Errors-To: hostap-bounces@lists.shmoo.com Translate nl80211 flags to wpa_supplicant flags for probe-resp offload support. The existence of the nl80211 PROBE_RESP_OFFLOAD_SUPPORT attribute means probe-response offload is supported. The value of the attribute is a bitmap of supported protocols. Signed-off-by: Guy Eilam Signed-off-by: Arik Nemtsov --- v1->3: - add 802.11u to supported protocols bitmap src/drivers/driver.h | 16 ++++++++++++++++ src/drivers/driver_nl80211.c | 27 +++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 0 deletions(-) diff --git a/src/drivers/driver.h b/src/drivers/driver.h index 06f2db3..2500c1e 100644 --- a/src/drivers/driver.h +++ b/src/drivers/driver.h @@ -751,6 +751,8 @@ struct wpa_driver_capa { #define WPA_DRIVER_FLAGS_TDLS_SUPPORT 0x00080000 /* Driver requires external TDLS setup/teardown/discovery */ #define WPA_DRIVER_FLAGS_TDLS_EXTERNAL_SETUP 0x00100000 +/* Driver indicates support for probe response offloading in AP mode */ +#define WPA_DRIVER_FLAGS_PROBE_RESP_OFFLOAD 0x00200000 unsigned int flags; int max_scan_ssids; @@ -768,6 +770,20 @@ struct wpa_driver_capa { * supports in AP mode */ unsigned int max_stations; + + /** + * probe_resp_offload_supp_protocols - bitmap of supported + * protocols by the driver for probe response offloading. + */ +/* Driver probe response offloading support for WPS ver. 1 */ +#define WPA_DRIVER_PROBE_RESP_OFFLOAD_SUPPORT_WPS 0x00000001 +/* Driver probe response offloading support for WPS ver. 2 */ +#define WPA_DRIVER_PROBE_RESP_OFFLOAD_SUPPORT_WPS2 0x00000002 +/* Driver probe response offloading support for P2P */ +#define WPA_DRIVER_PROBE_RESP_OFFLOAD_SUPPORT_P2P 0x00000004 +/* Driver probe response offloading support for 802.11u (interworking) */ +#define WPA_DRIVER_PROBE_RESP_OFFLOAD_SUPPORT_80211U 0x00000008 + unsigned int probe_resp_offload_protocols; }; diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c index 2ab10ae..1e66c72 100644 --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c @@ -1880,6 +1880,23 @@ struct wiphy_info_data { }; +static unsigned int probe_resp_offload_support(int supp_protocols) +{ + unsigned int prot = 0; + + if (supp_protocols & NL80211_PROBE_RESP_OFFLOAD_SUPPORT_WPS) + prot |= WPA_DRIVER_PROBE_RESP_OFFLOAD_SUPPORT_WPS; + if (supp_protocols & NL80211_PROBE_RESP_OFFLOAD_SUPPORT_WPS2) + prot |= WPA_DRIVER_PROBE_RESP_OFFLOAD_SUPPORT_WPS2; + if (supp_protocols & NL80211_PROBE_RESP_OFFLOAD_SUPPORT_P2P) + prot |= WPA_DRIVER_PROBE_RESP_OFFLOAD_SUPPORT_P2P; + if (supp_protocols & NL80211_PROBE_RESP_OFFLOAD_SUPPORT_80211U) + prot |= WPA_DRIVER_PROBE_RESP_OFFLOAD_SUPPORT_80211U; + + return prot; +} + + static int wiphy_info_handler(struct nl_msg *msg, void *arg) { struct nlattr *tb[NL80211_ATTR_MAX + 1]; @@ -2058,6 +2075,16 @@ broken_combination: } } + if (tb[NL80211_ATTR_PROBE_RESP_OFFLOAD_SUPPORT]) { + int protocols = + nla_get_u32(tb[NL80211_ATTR_PROBE_RESP_OFFLOAD_SUPPORT]); + wpa_printf(MSG_DEBUG, "nl80211: Supports probe-resp offload " + "in AP-mode"); + capa->flags |= WPA_DRIVER_FLAGS_PROBE_RESP_OFFLOAD; + capa->probe_resp_offload_protocols = + probe_resp_offload_support(protocols); + } + return NL_SKIP; }