From patchwork Wed Jun 19 12:49:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrei Otcheretianski X-Patchwork-Id: 1118517 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="iPcljIqy"; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45THNB6fCMz9s6w for ; Wed, 19 Jun 2019 17:56:58 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=JmNsbMRbvWtFkfXTjHEevoRTjb3iGpLACpltPfHMTT4=; b=iPcljIqyY9IZwW C7umZGf6WAFFJkseAvNqW6KByHbngQrLObCpe2DxF5yiG4r2Z5F2aY9nkx9wR9zkTJP90VnlJcKIP 6cOyEFA0y7PRCrpMA6OL5UEEAMAv7R5F0mQoinqKMS6SdmalSt8nlBi9jK3lyiYc+vNNRW7slG+4r ogRe2TqOEvWBLBT1pASWI4MkyooLg4ngob/XQMtTEgDzzqbtY7lu6GIed026gYVRKjTWWV5SAt5Y/ Mt5kM0rkfEyBl1o3/EqrDGlIKdKDUojQnjFrUsMumcfVGNe+sWEFUjIEhifh4q7lEMX/qbbJaGdR9 ulJ56a6/G7wWd8lgU+sA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hdVSh-0006f9-Dh; Wed, 19 Jun 2019 07:56:55 +0000 Received: from mga17.intel.com ([192.55.52.151]) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hdVSd-0006ZZ-HR for hostap@lists.infradead.org; Wed, 19 Jun 2019 07:56:53 +0000 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Jun 2019 00:56:51 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.63,392,1557212400"; d="scan'208";a="358537302" Received: from andrei-xps-12-9q33.jer.intel.com ([10.12.190.53]) by fmsmga006.fm.intel.com with ESMTP; 19 Jun 2019 00:56:50 -0700 From: Andrei Otcheretianski To: hostap@lists.infradead.org Subject: [PATCH 1/6] AP: Add initial support for 6GHz band Date: Wed, 19 Jun 2019 15:49:11 +0300 Message-Id: <20190619124916.14150-2-andrei.otcheretianski@intel.com> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190619_005651_637746_2CEEBA06 X-CRM114-Status: GOOD ( 19.51 ) X-Spam-Score: 0.1 (/) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (0.1 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [192.55.52.151 listed in list.dnswl.org] 2.4 DATE_IN_FUTURE_03_06 Date: is 3 to 6 hours after Received: date 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record X-BeenThere: hostap@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrei Otcheretianski Sender: "Hostap" Errors-To: hostap-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Add support for new hardware mode for 6GHz band. 6GHz operation is defined in "Draft IEEE P802.11ax/D4.1". 6GHz band adds 131-135 operating classes that define channels in frequency range from 5940MHz to 7105MHz. Signed-off-by: Andrei Otcheretianski --- hostapd/config_file.c | 2 + hostapd/hostapd.conf | 7 ++- src/ap/hw_features.c | 3 ++ src/common/defs.h | 1 + src/common/hw_features_common.c | 84 +++++++++++++++++++++++++++++++++ src/common/hw_features_common.h | 1 + src/common/ieee802_11_common.c | 23 +++++++++ wlantest/Makefile | 1 + 8 files changed, 121 insertions(+), 1 deletion(-) diff --git a/hostapd/config_file.c b/hostapd/config_file.c index c4106c1283..21671721c0 100644 --- a/hostapd/config_file.c +++ b/hostapd/config_file.c @@ -3154,6 +3154,8 @@ static int hostapd_config_fill(struct hostapd_config *conf, conf->hw_mode = HOSTAPD_MODE_IEEE80211G; else if (os_strcmp(pos, "ad") == 0) conf->hw_mode = HOSTAPD_MODE_IEEE80211AD; + else if (os_strcmp(pos, "ax") == 0) + conf->hw_mode = HOSTAPD_MODE_IEEE80211AX; else if (os_strcmp(pos, "any") == 0) conf->hw_mode = HOSTAPD_MODE_IEEE80211ANY; else { diff --git a/hostapd/hostapd.conf b/hostapd/hostapd.conf index 71e577a89c..a25d3f0092 100644 --- a/hostapd/hostapd.conf +++ b/hostapd/hostapd.conf @@ -147,7 +147,8 @@ ssid=test # Operation mode (a = IEEE 802.11a (5 GHz), b = IEEE 802.11b (2.4 GHz), # g = IEEE 802.11g (2.4 GHz), ad = IEEE 802.11ad (60 GHz); a/g options are used # with IEEE 802.11n (HT), too, to specify band). For IEEE 802.11ac (VHT), this -# needs to be set to hw_mode=a. When using ACS (see channel parameter), a +# needs to be set to hw_mode=a. For IEEE 802.11ax (HE) on 6-7 GHz this needs +# to be set to hw_mode=ax. When using ACS (see channel parameter), a # special value "any" can be used to indicate that any support band can be used. # This special case is currently supported only with drivers with which # offloaded ACS is used. @@ -800,6 +801,10 @@ wmm_ac_vo_acm=0 #he_rts_threshold=0 # HE operating channel information; see matching vht_* parameters for details. +# On 6GHz band (hw_mode=ax) the center freq calculation starts from 5.940 offset. +# For example idx=3 would result in 5955MHz center frequency. In addition, +# he_oper_chwidth is ignored, and the channel width is derived from the +# configured center frequencies (See IEEE802.11ax/D4.1 Annex E) #he_oper_chwidth #he_oper_centr_freq_seg0_idx #he_oper_centr_freq_seg1_idx diff --git a/src/ap/hw_features.c b/src/ap/hw_features.c index c1f19e26b5..4ba4cc7437 100644 --- a/src/ap/hw_features.c +++ b/src/ap/hw_features.c @@ -158,6 +158,7 @@ int hostapd_prepare_rates(struct hostapd_iface *iface, basic_rates = iface->conf->basic_rates; else switch (mode->mode) { case HOSTAPD_MODE_IEEE80211A: + case HOSTAPD_MODE_IEEE80211AX: /* same as 5GHz */ basic_rates = basic_rates_a; break; case HOSTAPD_MODE_IEEE80211B: @@ -934,6 +935,8 @@ const char * hostapd_hw_mode_txt(int mode) return "IEEE 802.11g"; case HOSTAPD_MODE_IEEE80211AD: return "IEEE 802.11ad"; + case HOSTAPD_MODE_IEEE80211AX: + return "IEEE 802.11ax"; default: return "UNKNOWN"; } diff --git a/src/common/defs.h b/src/common/defs.h index 4faf1c8601..c6bb7c0286 100644 --- a/src/common/defs.h +++ b/src/common/defs.h @@ -348,6 +348,7 @@ enum hostapd_hw_mode { HOSTAPD_MODE_IEEE80211G, HOSTAPD_MODE_IEEE80211A, HOSTAPD_MODE_IEEE80211AD, + HOSTAPD_MODE_IEEE80211AX, HOSTAPD_MODE_IEEE80211ANY, NUM_HOSTAPD_MODES }; diff --git a/src/common/hw_features_common.c b/src/common/hw_features_common.c index 3fdbf893d2..9996ef2bf7 100644 --- a/src/common/hw_features_common.c +++ b/src/common/hw_features_common.c @@ -358,6 +358,25 @@ int check_40mhz_2g4(struct hostapd_hw_modes *mode, } +int center_idx_to_width_6ghz(u8 idx) +{ + /* channels: 1, 5, 9, 13... */ + if ((idx & 0x3) == 0x1) + return 0; /* 20mhz */ + /* channels 3, 11, 19... */ + if ((idx & 0x7) == 0x3) + return 1; /* 40mhz */ + /* channels 7, 23, 39.. */ + if ((idx & 0xf) == 0x7) + return 2; /* 80mhz */ + /* channels 15, 47, 79...*/ + if ((idx & 0x1f) == 0xf) + return 3; /* 160mhz */ + + return -1; +} + + int hostapd_set_freq_params(struct hostapd_freq_params *data, enum hostapd_hw_mode mode, int freq, int channel, int ht_enabled, @@ -381,6 +400,71 @@ int hostapd_set_freq_params(struct hostapd_freq_params *data, data->center_freq2 = 0; data->bandwidth = sec_channel_offset ? 40 : 20; + if (mode == HOSTAPD_MODE_IEEE80211AX) { + if (!data->he_enabled) { + wpa_printf(MSG_ERROR, + "Can't set 6GHz mode - HE isn't enabled"); + return -1; + } + + if (center_idx_to_width_6ghz(channel) != 0) { + wpa_printf(MSG_ERROR, + "Invalid control channel for 6Ghz band"); + return -1; + } + + if (!center_segment0) { + if (center_segment1) { + wpa_printf(MSG_ERROR, + "Center0 freq isn't set"); + return -1; + } + + data->center_freq1 = data->freq; + data->bandwidth = 20; + } else { + int freq1, freq2 = 0; + int bw = center_idx_to_width_6ghz(center_segment0); + + if (bw < 0 ) { + wpa_printf(MSG_ERROR, + "Invalid center channel idx for 6GHz"); + return -1; + } + + freq1 = ieee80211_chan_to_freq(NULL, 131, + center_segment0); + if (freq1 < 0) { + wpa_printf(MSG_ERROR, + "Invalid center0 freq. for 6GHz"); + return -1; + } + + if (center_segment1) { + if (center_idx_to_width_6ghz(center_segment1) != 2 || + bw != 2) { + wpa_printf(MSG_ERROR, + "6GHz 80+80 configuration doesn't use valid 80MHz channels"); + return -1; + } + + freq2 = ieee80211_chan_to_freq(NULL, 131, + center_segment1); + if (freq2 < 0) { + wpa_printf(MSG_ERROR, + "Invalid center1 freq. for UHB"); + return -1; + } + } + + data->bandwidth = (1 << (u8)bw) * 20; + data->center_freq1 = freq1; + data->center_freq2 = freq2; + } + + return 0; + } + if (data->vht_enabled) switch (oper_chwidth) { case CHANWIDTH_USE_HT: if (center_segment1 || diff --git a/src/common/hw_features_common.h b/src/common/hw_features_common.h index 2d2a539943..c75a79746a 100644 --- a/src/common/hw_features_common.h +++ b/src/common/hw_features_common.h @@ -45,5 +45,6 @@ u32 num_chan_to_bw(int num_chans); int chan_bw_allowed(const struct hostapd_channel_data *chan, u32 bw, int ht40_plus, int pri); int chan_pri_allowed(const struct hostapd_channel_data *chan); +int center_idx_to_width_6ghz(u8 idx); #endif /* HW_FEATURES_COMMON_H */ diff --git a/src/common/ieee802_11_common.c b/src/common/ieee802_11_common.c index a081f87cc2..8096e17409 100644 --- a/src/common/ieee802_11_common.c +++ b/src/common/ieee802_11_common.c @@ -15,6 +15,7 @@ #include "qca-vendor.h" #include "ieee802_11_defs.h" #include "ieee802_11_common.h" +#include "hw_features_common.h" static int ieee802_11_parse_vendor_specific(const u8 *pos, size_t elen, @@ -882,6 +883,19 @@ enum hostapd_hw_mode ieee80211_freq_to_channel_ext(unsigned int freq, return HOSTAPD_MODE_IEEE80211AD; } + if (freq > 5940 && freq <= 7105) { + int bw; + u8 idx = (freq - 5940) / 5; + + bw = center_idx_to_width_6ghz(idx); + if (bw < 0) + return NUM_HOSTAPD_MODES; + + *channel = idx; + *op_class = 131 + bw; + return HOSTAPD_MODE_IEEE80211AX; + } + return NUM_HOSTAPD_MODES; } @@ -1161,6 +1175,14 @@ static int ieee80211_chan_to_freq_global(u8 op_class, u8 chan) if (chan < 36 || chan > 128) return -1; return 5000 + 5 * chan; + case 131: /* UHB channels, 20 mhz: 1, 5, 9.. */ + case 132: /* UHB channels, 40 mhz: 3, 11, 19.. */ + case 133: /* UHB channels, 80 mhz: 7, 23, 39.. */ + case 134: /* UHB channels, 160 mhz: 15, 47, 79.. */ + case 135: /* UHB channels, 80+80 mhz: 7, 23, 39.. */ + if (chan < 1 || chan > 233) + return -1; + return 5940 + chan * 5; case 180: /* 60 GHz band, channels 1..4 */ if (chan < 1 || chan > 4) return -1; @@ -1590,6 +1612,7 @@ const struct oper_class_map global_op_class[] = { { HOSTAPD_MODE_IEEE80211A, 128, 36, 161, 4, BW80, P2P_SUPP }, { HOSTAPD_MODE_IEEE80211A, 129, 50, 114, 16, BW160, P2P_SUPP }, { HOSTAPD_MODE_IEEE80211A, 130, 36, 161, 4, BW80P80, P2P_SUPP }, + { HOSTAPD_MODE_IEEE80211AX, 131, 1, 233, 4, BW20, NO_P2P_SUPP }, { HOSTAPD_MODE_IEEE80211AD, 180, 1, 4, 1, BW2160, P2P_SUPP }, { -1, 0, 0, 0, 0, BW20, NO_P2P_SUPP } }; diff --git a/wlantest/Makefile b/wlantest/Makefile index 4195a24dd1..8d5e69dd66 100644 --- a/wlantest/Makefile +++ b/wlantest/Makefile @@ -54,6 +54,7 @@ CFLAGS += -DCONFIG_FILS OBJS += ../src/common/ieee802_11_common.o OBJS += ../src/common/wpa_common.o +OBJS += ../src/common/hw_features_common.o OBJS += ../src/radius/radius.o OBJS += ../src/rsn_supp/wpa_ie.o