Patchwork [RFC,v1,2/2] wpa_supplicant: Enable Automatic Channel Selection support for AP mode

login
register
mail settings
Submitter Tomasz Bursztyka
Date Sept. 9, 2013, 10:30 a.m.
Message ID <1378722649-6558-3-git-send-email-tomasz.bursztyka@linux.intel.com>
Download mbox | patch
Permalink /patch/273551/
State New
Headers show

Comments

Tomasz Bursztyka - Sept. 9, 2013, 10:30 a.m.
Since hostapd supports ACS now, let's enable its support into
wpa_supplicant when going on AP mode.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
---
 wpa_supplicant/Makefile      |  6 ++++++
 wpa_supplicant/ap.c          |  6 ++++++
 wpa_supplicant/config.c      |  3 +++
 wpa_supplicant/config_ssid.h | 12 ++++++++++++
 wpa_supplicant/defconfig     | 24 ++++++++++++++++++++++++
 5 files changed, 51 insertions(+)

Patch

diff --git a/wpa_supplicant/Makefile b/wpa_supplicant/Makefile
index 5698619..85c9abf 100644
--- a/wpa_supplicant/Makefile
+++ b/wpa_supplicant/Makefile
@@ -831,6 +831,12 @@  OBJS_h += ../src/ap/peerkey_auth.o
 endif
 endif
 
+ifdef CONFIG_ACS
+CFLAGS += -DCONFIG_ACS
+OBJS += ../src/ap/acs.o
+LIBS += -lm
+endif
+
 ifdef CONFIG_PCSC
 # PC/SC interface for smartcards (USIM, GSM SIM)
 CFLAGS += -DPCSC_FUNCS -I/usr/include/PCSC
diff --git a/wpa_supplicant/ap.c b/wpa_supplicant/ap.c
index fdbe248..a135e04 100644
--- a/wpa_supplicant/ap.c
+++ b/wpa_supplicant/ap.c
@@ -60,6 +60,12 @@  static int wpa_supplicant_conf_ap(struct wpa_supplicant *wpa_s,
 		return -1;
 	}
 
+#ifdef CONFIG_ACS
+	/* Setting channel to 0 in order to enable ACS */
+	if (ssid->acs)
+		conf->channel = 0;
+#endif
+
 	/* TODO: enable HT40 if driver supports it;
 	 * drop to 11b if driver does not support 11g */
 
diff --git a/wpa_supplicant/config.c b/wpa_supplicant/config.c
index d666c91..0645b39 100644
--- a/wpa_supplicant/config.c
+++ b/wpa_supplicant/config.c
@@ -1588,6 +1588,9 @@  static const struct parse_data ssid_fields[] = {
 	{ INT_RANGE(peerkey, 0, 1) },
 	{ INT_RANGE(mixed_cell, 0, 1) },
 	{ INT_RANGE(frequency, 0, 65000) },
+#ifdef CONFIG_ACS
+	{ INT_RANGE(acs, 0, 1) },
+#endif /* CONFIG_ACS */
 	{ INT(wpa_ptk_rekey) },
 	{ STR(bgscan) },
 	{ INT_RANGE(ignore_broadcast_ssid, 0, 2) },
diff --git a/wpa_supplicant/config_ssid.h b/wpa_supplicant/config_ssid.h
index 3a44272..f14cf53 100644
--- a/wpa_supplicant/config_ssid.h
+++ b/wpa_supplicant/config_ssid.h
@@ -392,6 +392,18 @@  struct wpa_ssid {
 	 */
 	int frequency;
 
+#ifdef CONFIG_ACS
+	/**
+	 * ACS - Automatic Channel Selection for AP mode
+	 *
+	 * If present, it will be handled together with frequency. 
+	 * frequency will be used to determine hardware mode only, when it is
+	 * used for both harware mode and channel when used alone. This will
+	 * force the channel to be set to 0, thus enabling ACS.
+	 */
+	int acs;
+#endif /* CONFIG_ACS */
+
 	int ht40;
 
 	/**
diff --git a/wpa_supplicant/defconfig b/wpa_supplicant/defconfig
index aa6005f..4770fe8 100644
--- a/wpa_supplicant/defconfig
+++ b/wpa_supplicant/defconfig
@@ -532,3 +532,27 @@  CONFIG_PEERKEY=y
 #
 # External password backend for testing purposes (developer use)
 #CONFIG_EXT_PASSWORD_TEST=y
+
+# Automatic Channel Selection
+# This will allow hostapd to pick the channel automatically when channel is set
+# to "acs_survey" or "0". Eventually, other ACS algorithms can be added in
+# similar way.
+#
+# Automatic selection is currently only done through initialization, later on
+# we hope to do background checks to keep us moving to more ideal channels as
+# time goes by. ACS is currently only supported through the nl80211 driver and
+# your driver must have survey dump capability that is filled by the driver
+# during scanning.
+#
+# You can customize the ACS survey algorithm with the hostapd.conf variable
+# acs_num_scans.
+#
+# Supported ACS drivers:
+# * ath9k
+# * ath5k
+# * ath10k
+#
+# For more details refer to:
+# http://wireless.kernel.org/en/users/Documentation/acs
+#
+#CONFIG_ACS=y