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>
This commit is contained in:
Michal Kazior 2013-08-31 11:49:51 +03:00 committed by Jouni Malinen
parent 43ee470494
commit 50f4f2a066
12 changed files with 937 additions and 5 deletions

View file

@ -24,6 +24,7 @@
#include "hostapd.h"
#include "ap_config.h"
#include "ap_drv_ops.h"
#include "acs.h"
#include "hw_features.h"
@ -686,10 +687,18 @@ hostapd_check_chans(struct hostapd_iface *iface)
}
/*
* The user set channel=0 which is used to trigger ACS,
* which we do not yet support.
* The user set channel=0 or channel=acs_survey
* which is used to trigger ACS.
*/
return HOSTAPD_CHAN_INVALID;
switch (acs_init(iface)) {
case HOSTAPD_CHAN_ACS:
return HOSTAPD_CHAN_ACS;
case HOSTAPD_CHAN_VALID:
case HOSTAPD_CHAN_INVALID:
default:
return HOSTAPD_CHAN_INVALID;
}
}
@ -709,6 +718,36 @@ static void hostapd_notify_bad_chans(struct hostapd_iface *iface)
}
int hostapd_acs_completed(struct hostapd_iface *iface)
{
int ret;
switch (hostapd_check_chans(iface)) {
case HOSTAPD_CHAN_VALID:
break;
case HOSTAPD_CHAN_ACS:
wpa_printf(MSG_ERROR, "ACS error - reported complete, but no result available");
hostapd_notify_bad_chans(iface);
return -1;
case HOSTAPD_CHAN_INVALID:
default:
wpa_printf(MSG_ERROR, "ACS picked unusable channels");
hostapd_notify_bad_chans(iface);
return -1;
}
ret = hostapd_check_ht_capab(iface);
if (ret < 0)
return -1;
if (ret == 1) {
wpa_printf(MSG_DEBUG, "Interface initialization will be completed in a callback");
return 0;
}
return hostapd_setup_interface_complete(iface, 0);
}
/**
* hostapd_select_hw_mode - Select the hardware mode
* @iface: Pointer to interface data.
@ -747,7 +786,8 @@ int hostapd_select_hw_mode(struct hostapd_iface *iface)
switch (hostapd_check_chans(iface)) {
case HOSTAPD_CHAN_VALID:
return 0;
case HOSTAPD_CHAN_ACS: /* ACS not supported yet */
case HOSTAPD_CHAN_ACS: /* ACS will run and later complete */
return 1;
case HOSTAPD_CHAN_INVALID:
default:
hostapd_notify_bad_chans(iface);