[PATCH v2 1/3] nl80211: Add support for probe response offloading

Guy Eilam guy
Sat Oct 22 12:53:14 PDT 2011


Update the driver capabilites for support for probe
response offloading according to the answer to the get
wiphy command.

Signed-off-by: Guy Eilam <guy at wizery.com>
---
v2:
changed WPS in NL80211 to WSC

 src/drivers/driver.h         |   14 ++++++++++++++
 src/drivers/driver_nl80211.c |   21 +++++++++++++++++++++
 2 files changed, 35 insertions(+), 0 deletions(-)

diff --git a/src/drivers/driver.h b/src/drivers/driver.h
index ba24f1d..2078d5c 100644
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -743,6 +743,8 @@ struct wpa_driver_capa {
 #define WPA_DRIVER_FLAGS_DEAUTH_TX_STATUS		0x00020000
 /* Driver supports roaming (BSS selection) in firmware */
 #define WPA_DRIVER_FLAGS_BSS_SELECTION			0x00040000
+/* Driver indicates support in Probe Response Offloading */
+#define WPA_DRIVER_FLAGS_PROBE_RESP_OFFLOAD		0x00080000
 	unsigned int flags;
 
 	int max_scan_ssids;
@@ -760,6 +762,18 @@ 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
+	unsigned int probe_resp_offload_supp_protocols;
 };
 
 
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index 2ecd0bd..9865aba 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -1739,6 +1739,20 @@ 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_WSC)
+		prot |= WPA_DRIVER_PROBE_RESP_OFFLOAD_SUPPORT_WPS;
+	if (supp_protocols & NL80211_PROBE_RESP_OFFLOAD_SUPPORT_WSC2)
+		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;
+
+	return prot;
+}
+
 static int wiphy_info_handler(struct nl_msg *msg, void *arg)
 {
 	struct nlattr *tb[NL80211_ATTR_MAX + 1];
@@ -1906,6 +1920,13 @@ broken_combination:
 		capa->flags |= WPA_DRIVER_FLAGS_P2P_MGMT_AND_NON_P2P;
 	}
 
+	if (tb[NL80211_ATTR_PROBE_RESP_OFFLOAD_SUPPORT]) {
+		capa->flags |= WPA_DRIVER_FLAGS_PROBE_RESP_OFFLOAD;
+		capa->probe_resp_offload_supp_protocols =
+			probe_resp_offload_support(
+			  nla_get_u32(tb[NL80211_ATTR_PROBE_RESP_OFFLOAD_SUPPORT]));
+	}
+
 	return NL_SKIP;
 }
 
-- 
1.7.4.1




More information about the Hostap mailing list