Patchwork [1/4] nl80211: Report the number of concurrent support channels

login
register
mail settings
Submitter Ilan Peer
Date July 17, 2013, 6:32 a.m.
Message ID <1374042746-8001-2-git-send-email-ilan.peer@intel.com>
Download mbox | patch
Permalink /patch/259612/
State Accepted
Commit 4752147d88007a099d64f926937508bd7efa5045
Headers show

Comments

Ilan Peer - July 17, 2013, 6:32 a.m.
Currently, drivers only report if they support multiple concurrent
channels, but do not report the maximum number of supported channels.

Add this reporting to the driver capabilities, and add the implementation
to driver_nl80211.

Signed-hostap: Ilan Peer <ilan.peer@intel.com>
Signed-hostap: David Spinadel <david.spinadel@intel.com>
---
 src/drivers/driver.h              |    5 +++++
 src/drivers/driver_nl80211.c      |   12 ++++++++----
 wpa_supplicant/wpa_supplicant.c   |    5 +++++
 wpa_supplicant/wpa_supplicant_i.h |    2 ++
 4 files changed, 20 insertions(+), 4 deletions(-)

Patch

diff --git a/src/drivers/driver.h b/src/drivers/driver.h
index 3b7e400..98bbdc1 100644
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -911,6 +911,11 @@  struct wpa_driver_capa {
 	unsigned int max_acl_mac_addrs;
 
 	/**
+	 * Number of supported concurrent channels
+	 */
+	unsigned int num_multichan_concurrent;
+
+	/**
 	 * extended_capa - extended capabilities in driver/device
 	 *
 	 * Must be allocated and freed by driver and the pointers must be
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index 0115533..26487b1 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -2866,6 +2866,8 @@  struct wiphy_info_data {
 	struct wpa_driver_nl80211_data *drv;
 	struct wpa_driver_capa *capa;
 
+	unsigned int num_multichan_concurrent;
+
 	unsigned int error:1;
 	unsigned int device_ap_sme:1;
 	unsigned int poll_command_supported:1;
@@ -2876,7 +2878,6 @@  struct wiphy_info_data {
 	unsigned int p2p_go_supported:1;
 	unsigned int p2p_client_supported:1;
 	unsigned int p2p_concurrent:1;
-	unsigned int p2p_multichan_concurrent:1;
 };
 
 
@@ -2986,8 +2987,9 @@  static int wiphy_info_iface_comb_process(struct wiphy_info_data *info,
 
 	if (combination_has_p2p && combination_has_mgd) {
 		info->p2p_concurrent = 1;
-		if (nla_get_u32(tb_comb[NL80211_IFACE_COMB_NUM_CHANNELS]) > 1)
-			info->p2p_multichan_concurrent = 1;
+		if (tb_comb[NL80211_IFACE_COMB_NUM_CHANNELS])
+			info->num_multichan_concurrent =
+				nla_get_u32(tb_comb[NL80211_IFACE_COMB_NUM_CHANNELS]);
 		return 1;
 	}
 
@@ -3237,10 +3239,12 @@  static int wpa_driver_nl80211_get_info(struct wpa_driver_nl80211_data *drv,
 		drv->capa.flags |= WPA_DRIVER_FLAGS_P2P_CONCURRENT;
 		drv->capa.flags |= WPA_DRIVER_FLAGS_P2P_MGMT_AND_NON_P2P;
 	}
-	if (info->p2p_multichan_concurrent) {
+	if (info->num_multichan_concurrent > 1) {
 		wpa_printf(MSG_DEBUG, "nl80211: Enable multi-channel "
 			   "concurrent (driver advertised support)");
 		drv->capa.flags |= WPA_DRIVER_FLAGS_MULTI_CHANNEL_CONCURRENT;
+		drv->capa.num_multichan_concurrent =
+			info->num_multichan_concurrent;
 	}
 
 	/* default to 5000 since early versions of mac80211 don't set it */
diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
index 5773013..e7a2d99 100644
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -2964,6 +2964,8 @@  next_driver:
 		wpa_s->extended_capa = capa.extended_capa;
 		wpa_s->extended_capa_mask = capa.extended_capa_mask;
 		wpa_s->extended_capa_len = capa.extended_capa_len;
+		wpa_s->num_multichan_concurrent =
+			capa.num_multichan_concurrent;
 	}
 	if (wpa_s->max_remain_on_chan == 0)
 		wpa_s->max_remain_on_chan = 1000;
@@ -2978,6 +2980,9 @@  next_driver:
 	else
 		iface->p2p_mgmt = 1;
 
+	if (wpa_s->num_multichan_concurrent == 0)
+		wpa_s->num_multichan_concurrent = 1;
+
 	if (wpa_supplicant_driver_init(wpa_s) < 0)
 		return -1;
 
diff --git a/wpa_supplicant/wpa_supplicant_i.h b/wpa_supplicant/wpa_supplicant_i.h
index 9240863..7597908 100644
--- a/wpa_supplicant/wpa_supplicant_i.h
+++ b/wpa_supplicant/wpa_supplicant_i.h
@@ -722,6 +722,8 @@  struct wpa_supplicant {
 	u8 last_gtk[32];
 	size_t last_gtk_len;
 #endif /* CONFIG_TESTING_GET_GTK */
+
+	unsigned int num_multichan_concurrent;
 };