aboutsummaryrefslogtreecommitdiffstats
path: root/hostapd
diff options
context:
space:
mode:
authorMichal Kazior <michal.kazior@tieto.com>2013-08-31 08:49:51 (GMT)
committerJouni Malinen <j@w1.fi>2013-08-31 08:51:06 (GMT)
commit50f4f2a066e60be7cc03e291635e9a0f953922bd (patch)
tree3188920502b2e7d6895e7e16f1e62e1c899ef005 /hostapd
parent43ee470494a78440db8eb675ed67dc0e9f9e4cf9 (diff)
downloadhostap-50f4f2a066e60be7cc03e291635e9a0f953922bd.zip
hostap-50f4f2a066e60be7cc03e291635e9a0f953922bd.tar.gz
hostap-50f4f2a066e60be7cc03e291635e9a0f953922bd.tar.bz2
hostapd: Add Automatic Channel Selection (ACS) support
This adds ACS support to hostapd. Currently only survey-based algorithm is available. To use ACS you need to enable CONFIG_ACS=y in .config and use channel=0 (or channel=acs_survey) in hostapd.conf. For more details see wiki page [1] or comments in src/ap/acs.c. [1]: http://wireless.kernel.org/en/users/Documentation/acs Signed-hostap: Michal Kazior <michal.kazior@tieto.com>
Diffstat (limited to 'hostapd')
-rw-r--r--hostapd/Makefile6
-rw-r--r--hostapd/config_file.c20
-rw-r--r--hostapd/defconfig24
-rw-r--r--hostapd/hostapd.conf20
4 files changed, 69 insertions, 1 deletions
diff --git a/hostapd/Makefile b/hostapd/Makefile
index a30a244..fda4e4e 100644
--- a/hostapd/Makefile
+++ b/hostapd/Makefile
@@ -817,6 +817,12 @@ else
OBJS_c += ../src/utils/edit_simple.o
endif
+ifdef CONFIG_ACS
+CFLAGS += -DCONFIG_ACS
+OBJS += ../src/ap/acs.o
+LIBS += -lm
+endif
+
ifdef CONFIG_NO_STDOUT_DEBUG
CFLAGS += -DCONFIG_NO_STDOUT_DEBUG
endif
diff --git a/hostapd/config_file.c b/hostapd/config_file.c
index e9d324f..a420c88 100644
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
@@ -2311,7 +2311,15 @@ static int hostapd_config_fill(struct hostapd_config *conf,
errors++;
}
} else if (os_strcmp(buf, "channel") == 0) {
- conf->channel = atoi(pos);
+ if (os_strcmp(pos, "acs_survey") == 0) {
+#ifndef CONFIG_ACS
+ wpa_printf(MSG_ERROR, "Line %d: tries to enable ACS but CONFIG_ACS disabled",
+ line);
+ errors++;
+#endif /* CONFIG_ACS */
+ conf->channel = 0;
+ } else
+ conf->channel = atoi(pos);
} else if (os_strcmp(buf, "beacon_int") == 0) {
int val = atoi(pos);
/* MIB defines range as 1..65535, but very small values
@@ -2326,6 +2334,16 @@ static int hostapd_config_fill(struct hostapd_config *conf,
errors++;
} else
conf->beacon_int = val;
+#ifdef CONFIG_ACS
+ } else if (os_strcmp(buf, "acs_num_scans") == 0) {
+ int val = atoi(pos);
+ if (val <= 0 || val > 100) {
+ wpa_printf(MSG_ERROR, "Line %d: invalid acs_num_scans %d (expected 1..100)",
+ line, val);
+ errors++;
+ } else
+ conf->acs_num_scans = val;
+#endif /* CONFIG_ACS */
} else if (os_strcmp(buf, "dtim_period") == 0) {
bss->dtim_period = atoi(pos);
if (bss->dtim_period < 1 || bss->dtim_period > 255) {
diff --git a/hostapd/defconfig b/hostapd/defconfig
index c288f46..2dd6fc8 100644
--- a/hostapd/defconfig
+++ b/hostapd/defconfig
@@ -278,3 +278,27 @@ CONFIG_IPV6=y
# certain percentage of probe requests or auth/(re)assoc frames.
#
#CONFIG_TESTING_OPTIONS=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
diff --git a/hostapd/hostapd.conf b/hostapd/hostapd.conf
index c46dff5..45897ed 100644
--- a/hostapd/hostapd.conf
+++ b/hostapd/hostapd.conf
@@ -121,8 +121,28 @@ hw_mode=g
# (default: 0, i.e., not set)
# Please note that some drivers do not use this value from hostapd and the
# channel will need to be configured separately with iwconfig.
+#
+# If CONFIG_ACS build option is enabled, the channel can be selected
+# automatically at run time by setting channel=acs_survey or channel=0, both of
+# which will enable the ACS survey based algorithm.
channel=1
+# ACS tuning - Automatic Channel Selection
+# See: http://wireless.kernel.org/en/users/Documentation/acs
+#
+# You can customize the ACS survey algorithm with following variables:
+#
+# acs_num_scans requirement is 1..100 - number of scans to be performed that
+# are used to trigger survey data gathering of an underlying device driver.
+# Scans are passive and typically take a little over 100ms (depending on the
+# driver) on each available channel for given hw_mode. Increasing this value
+# means sacrificing startup time and gathering more data wrt channel
+# interference that may help choosing a better channel. This can also help fine
+# tune the ACS scan time in case a driver has different scan dwell times.
+#
+# Defaults:
+#acs_num_scans=5
+
# Beacon interval in kus (1.024 ms) (default: 100; range 15..65535)
beacon_int=100