From 7829894c21042a23e834659fbfd42ad8de74d5be Mon Sep 17 00:00:00 2001 From: Vladimir Kondratiev Date: Tue, 18 Dec 2012 11:50:35 +0200 Subject: [PATCH] Introduce 60 GHz band Basic support for the 60 GHz band. Neither P2P nor WPS are yet taken care off. Allows to start AP with very simple config: network={ ssid="test" mode=2 frequency=60480 key_mgmt=NONE } Signed-off-by: Vladimir Kondratiev Signed-hostap: Jouni Malinen --- hostapd/config_file.c | 2 ++ hostapd/hostapd.conf | 2 ++ src/ap/hw_features.c | 4 ++++ src/ap/ieee802_1x.c | 2 ++ src/common/defs.h | 1 + src/drivers/driver_nl80211.c | 26 +++++++++++++++++++++----- wpa_supplicant/ap.c | 4 ++++ wpa_supplicant/config.c | 2 +- wpa_supplicant/ctrl_iface.c | 3 +++ 9 files changed, 40 insertions(+), 6 deletions(-) diff --git a/hostapd/config_file.c b/hostapd/config_file.c index 1b5c730ae..4c4d51b48 100644 --- a/hostapd/config_file.c +++ b/hostapd/config_file.c @@ -2313,6 +2313,8 @@ static int hostapd_config_fill(struct hostapd_config *conf, conf->hw_mode = HOSTAPD_MODE_IEEE80211B; else if (os_strcmp(pos, "g") == 0) conf->hw_mode = HOSTAPD_MODE_IEEE80211G; + else if (os_strcmp(pos, "ad") == 0) + conf->hw_mode = HOSTAPD_MODE_IEEE80211AD; else { wpa_printf(MSG_ERROR, "Line %d: unknown " "hw_mode '%s'", line, pos); diff --git a/hostapd/hostapd.conf b/hostapd/hostapd.conf index 58717acba..5a3cdd3df 100644 --- a/hostapd/hostapd.conf +++ b/hostapd/hostapd.conf @@ -106,6 +106,8 @@ ssid=test #ieee80211d=1 # Operation mode (a = IEEE 802.11a, b = IEEE 802.11b, g = IEEE 802.11g, +# ad = IEEE 802.11ad (60 GHz); a/g options are used with IEEE 802.11n, too, to +# specify band) # Default: IEEE 802.11b hw_mode=g diff --git a/src/ap/hw_features.c b/src/ap/hw_features.c index 97e1238e6..923b69823 100644 --- a/src/ap/hw_features.c +++ b/src/ap/hw_features.c @@ -122,6 +122,8 @@ int hostapd_prepare_rates(struct hostapd_iface *iface, case HOSTAPD_MODE_IEEE80211G: basic_rates = basic_rates_g; break; + case HOSTAPD_MODE_IEEE80211AD: + return 0; /* No basic rates for 11ad */ default: return -1; } @@ -756,6 +758,8 @@ const char * hostapd_hw_mode_txt(int mode) return "IEEE 802.11b"; case HOSTAPD_MODE_IEEE80211G: return "IEEE 802.11g"; + case HOSTAPD_MODE_IEEE80211AD: + return "IEEE 802.11ad"; default: return "UNKNOWN"; } diff --git a/src/ap/ieee802_1x.c b/src/ap/ieee802_1x.c index 7ac1d3e63..5b011201c 100644 --- a/src/ap/ieee802_1x.c +++ b/src/ap/ieee802_1x.c @@ -354,6 +354,8 @@ void ieee802_1x_tx_key(struct hostapd_data *hapd, struct sta_info *sta) const char *radius_mode_txt(struct hostapd_data *hapd) { switch (hapd->iface->conf->hw_mode) { + case HOSTAPD_MODE_IEEE80211AD: + return "802.11ad"; case HOSTAPD_MODE_IEEE80211A: return "802.11a"; case HOSTAPD_MODE_IEEE80211G: diff --git a/src/common/defs.h b/src/common/defs.h index 85e99329a..281dd8a5e 100644 --- a/src/common/defs.h +++ b/src/common/defs.h @@ -297,6 +297,7 @@ enum hostapd_hw_mode { HOSTAPD_MODE_IEEE80211B, HOSTAPD_MODE_IEEE80211G, HOSTAPD_MODE_IEEE80211A, + HOSTAPD_MODE_IEEE80211AD, NUM_HOSTAPD_MODES }; diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c index b7244c29d..0a32025be 100644 --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c @@ -4974,19 +4974,35 @@ static int phy_info_handler(struct nl_msg *msg, void *arg) /* crude heuristic */ if (mode->channels[idx].freq < 4000) mode->mode = HOSTAPD_MODE_IEEE80211B; + else if (mode->channels[idx].freq > 50000) + mode->mode = HOSTAPD_MODE_IEEE80211AD; else mode->mode = HOSTAPD_MODE_IEEE80211A; mode_is_set = 1; } - /* crude heuristic */ - if (mode->channels[idx].freq < 4000) + switch (mode->mode) { + case HOSTAPD_MODE_IEEE80211AD: + mode->channels[idx].chan = + (mode->channels[idx].freq - 56160) / + 2160; + break; + case HOSTAPD_MODE_IEEE80211A: + mode->channels[idx].chan = + mode->channels[idx].freq / 5 - 1000; + break; + case HOSTAPD_MODE_IEEE80211B: + case HOSTAPD_MODE_IEEE80211G: if (mode->channels[idx].freq == 2484) mode->channels[idx].chan = 14; else - mode->channels[idx].chan = (mode->channels[idx].freq - 2407) / 5; - else - mode->channels[idx].chan = mode->channels[idx].freq/5 - 1000; + mode->channels[idx].chan = + (mode->channels[idx].freq - + 2407) / 5; + break; + default: + break; + } if (tb_freq[NL80211_FREQUENCY_ATTR_DISABLED]) mode->channels[idx].flag |= diff --git a/wpa_supplicant/ap.c b/wpa_supplicant/ap.c index e261ef9d7..3708bcc9f 100644 --- a/wpa_supplicant/ap.c +++ b/wpa_supplicant/ap.c @@ -63,6 +63,10 @@ static int wpa_supplicant_conf_ap(struct wpa_supplicant *wpa_s, (ssid->frequency >= 5745 && ssid->frequency <= 5825)) { conf->hw_mode = HOSTAPD_MODE_IEEE80211A; conf->channel = (ssid->frequency - 5000) / 5; + } else if (ssid->frequency >= 56160 + 2160 * 1 && + ssid->frequency <= 56160 + 2160 * 4) { + conf->hw_mode = HOSTAPD_MODE_IEEE80211AD; + conf->channel = (ssid->frequency - 56160) / 2160; } else { wpa_printf(MSG_ERROR, "Unsupported AP mode frequency: %d MHz", ssid->frequency); diff --git a/wpa_supplicant/config.c b/wpa_supplicant/config.c index 58e56ce9d..0b6fbb0be 100644 --- a/wpa_supplicant/config.c +++ b/wpa_supplicant/config.c @@ -1627,7 +1627,7 @@ static const struct parse_data ssid_fields[] = { #endif /* CONFIG_IEEE80211W */ { INT_RANGE(peerkey, 0, 1) }, { INT_RANGE(mixed_cell, 0, 1) }, - { INT_RANGE(frequency, 0, 10000) }, + { INT_RANGE(frequency, 0, 65000) }, { INT(wpa_ptk_rekey) }, { STR(bgscan) }, { INT_RANGE(ignore_broadcast_ssid, 0, 2) }, diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c index 904a12eaa..c5e5fd295 100644 --- a/wpa_supplicant/ctrl_iface.c +++ b/wpa_supplicant/ctrl_iface.c @@ -2765,6 +2765,9 @@ static int ctrl_iface_get_capability_channels(struct wpa_supplicant *wpa_s, case HOSTAPD_MODE_IEEE80211A: hmode = "A"; break; + case HOSTAPD_MODE_IEEE80211AD: + hmode = "AD"; + break; default: continue; }