diff mbox series

[3/6] AP: Publish only HE capabilities and operation IEs on 6GHz band

Message ID 20190619124916.14150-4-andrei.otcheretianski@intel.com
State Changes Requested
Headers show
Series AP: Support for 6GHz band | expand

Commit Message

Andrei Otcheretianski June 19, 2019, 12:49 p.m. UTC
When operating on 6GHz band, add "6 GHz Operation Information" inside
the HE operation IE and don't publish HT/VHT IEs.

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
---
 src/ap/beacon.c              |  4 +++-
 src/ap/ieee802_11_he.c       | 22 ++++++++++++++++++++--
 src/ap/ieee802_11_ht.c       | 11 ++++++++---
 src/ap/ieee802_11_vht.c      |  6 +++++-
 src/common/ieee802_11_defs.h |  4 ++++
 5 files changed, 40 insertions(+), 7 deletions(-)
diff mbox series

Patch

diff --git a/src/ap/beacon.c b/src/ap/beacon.c
index 1838c1c843..c1aeb03a3d 100644
--- a/src/ap/beacon.c
+++ b/src/ap/beacon.c
@@ -498,7 +498,9 @@  static u8 * hostapd_gen_probe_resp(struct hostapd_data *hapd,
 #endif /* CONFIG_FST */
 
 #ifdef CONFIG_IEEE80211AC
-	if (hapd->iconf->ieee80211ac && !hapd->conf->disable_11ac) {
+	if (hapd->iconf->ieee80211ac && !hapd->conf->disable_11ac &&
+	    hapd->iface->current_mode &&
+	    hapd->iface->current_mode->mode != HOSTAPD_MODE_IEEE80211AX) {
 		pos = hostapd_eid_vht_capabilities(hapd, pos, 0);
 		pos = hostapd_eid_vht_operation(hapd, pos);
 		pos = hostapd_eid_txpower_envelope(hapd, pos);
diff --git a/src/ap/ieee802_11_he.c b/src/ap/ieee802_11_he.c
index ba22a174a3..9fc769ec33 100644
--- a/src/ap/ieee802_11_he.c
+++ b/src/ap/ieee802_11_he.c
@@ -17,6 +17,7 @@ 
 #include "sta_info.h"
 #include "ieee802_11.h"
 #include "dfs.h"
+#include "common/hw_features_common.h"
 
 static u8 ieee80211_he_ppet_size(u8 ppe_thres_hdr, const u8 *phy_cap_info)
 {
@@ -135,6 +136,9 @@  u8 * hostapd_eid_he_operation(struct hostapd_data *hapd, u8 *eid)
 	if (!hapd->iface->current_mode)
 		return eid;
 
+	if (hapd->iface->current_mode->mode == HOSTAPD_MODE_IEEE80211AX)
+		oper_size += 5;
+
 	*pos++ = WLAN_EID_EXTENSION;
 	*pos++ = 1 + oper_size;
 	*pos++ = WLAN_EID_EXT_HE_OPERATION;
@@ -163,9 +167,23 @@  u8 * hostapd_eid_he_operation(struct hostapd_data *hapd, u8 *eid)
 
 	/* TODO: conditional MaxBSSID Indicator subfield */
 
-	oper->he_oper_params = host_to_le32(params);
+	pos += 6; /* skip the fixed part */
+
+	if (hapd->iface->current_mode->mode == HOSTAPD_MODE_IEEE80211AX) {
+		u8 seg0 = hostapd_get_oper_centr_freq_seg0_idx(hapd->iconf);
+
+		if (!seg0)
+			seg0 = hapd->iconf->channel;
 
-	pos += oper_size;
+		params |= HE_OPERATION_6GHZ_OPER_INFO;
+		*pos++ = hapd->iconf->channel;
+		*pos++ = center_idx_to_width_6ghz(seg0);
+		*pos++ = seg0;
+		*pos++ = hostapd_get_oper_centr_freq_seg1_idx(hapd->iconf);
+		*pos++ = 6; /* TODO: what should be set here? */
+	}
+
+	oper->he_oper_params = host_to_le32(params);
 
 	return pos;
 }
diff --git a/src/ap/ieee802_11_ht.c b/src/ap/ieee802_11_ht.c
index 214855dccb..89241cf9e1 100644
--- a/src/ap/ieee802_11_ht.c
+++ b/src/ap/ieee802_11_ht.c
@@ -27,7 +27,8 @@  u8 * hostapd_eid_ht_capabilities(struct hostapd_data *hapd, u8 *eid)
 	u8 *pos = eid;
 
 	if (!hapd->iconf->ieee80211n || !hapd->iface->current_mode ||
-	    hapd->conf->disable_11n)
+	    hapd->conf->disable_11n ||
+	    hapd->iface->current_mode->mode == HOSTAPD_MODE_IEEE80211AX)
 		return eid;
 
 	*pos++ = WLAN_EID_HT_CAP;
@@ -84,7 +85,9 @@  u8 * hostapd_eid_ht_operation(struct hostapd_data *hapd, u8 *eid)
 	struct ieee80211_ht_operation *oper;
 	u8 *pos = eid;
 
-	if (!hapd->iconf->ieee80211n || hapd->conf->disable_11n)
+	if (!hapd->iconf->ieee80211n || hapd->conf->disable_11n ||
+	    !hapd->iface->current_mode ||
+	    hapd->iface->current_mode->mode == HOSTAPD_MODE_IEEE80211AX)
 		return eid;
 
 	*pos++ = WLAN_EID_HT_OPERATION;
@@ -113,7 +116,9 @@  u8 * hostapd_eid_secondary_channel(struct hostapd_data *hapd, u8 *eid)
 	u8 sec_ch;
 
 	if (!hapd->cs_freq_params.channel ||
-	    !hapd->cs_freq_params.sec_channel_offset)
+	    !hapd->cs_freq_params.sec_channel_offset ||
+	    !hapd->iface->current_mode ||
+	    hapd->iface->current_mode->mode == HOSTAPD_MODE_IEEE80211AX)
 		return eid;
 
 	if (hapd->cs_freq_params.sec_channel_offset == -1)
diff --git a/src/ap/ieee802_11_vht.c b/src/ap/ieee802_11_vht.c
index 269345fbf8..8b060b12ea 100644
--- a/src/ap/ieee802_11_vht.c
+++ b/src/ap/ieee802_11_vht.c
@@ -26,7 +26,7 @@  u8 * hostapd_eid_vht_capabilities(struct hostapd_data *hapd, u8 *eid, u32 nsts)
 	struct hostapd_hw_modes *mode = hapd->iface->current_mode;
 	u8 *pos = eid;
 
-	if (!mode)
+	if (!mode || mode->mode == HOSTAPD_MODE_IEEE80211AX)
 		return eid;
 
 	if (mode->mode == HOSTAPD_MODE_IEEE80211G && hapd->conf->vendor_vht &&
@@ -75,6 +75,10 @@  u8 * hostapd_eid_vht_operation(struct hostapd_data *hapd, u8 *eid)
 {
 	struct ieee80211_vht_operation *oper;
 	u8 *pos = eid;
+	struct hostapd_hw_modes *mode = hapd->iface->current_mode;
+
+	if (!mode || mode->mode == HOSTAPD_MODE_IEEE80211AX)
+		return eid;
 
 	*pos++ = WLAN_EID_VHT_OPERATION;
 	*pos++ = sizeof(*oper);
diff --git a/src/common/ieee802_11_defs.h b/src/common/ieee802_11_defs.h
index b0aa913bbc..a1e11c7143 100644
--- a/src/common/ieee802_11_defs.h
+++ b/src/common/ieee802_11_defs.h
@@ -2174,6 +2174,10 @@  struct ieee80211_spatial_reuse {
 						BIT(10) | BIT(11) | \
 						BIT(12) | BIT(13)))
 #define HE_OPERATION_RTS_THRESHOLD_OFFSET	4
+#define HE_OPERATION_VHT_OPER_INFO		((u32) BIT(14))
+#define HE_OPERATION_COHOSTED_BSS		((u32) BIT(15))
+#define HE_OPERATION_ER_SU_DISABLE		((u32) BIT(16))
+#define HE_OPERATION_6GHZ_OPER_INFO		((u32) BIT(17))
 #define HE_OPERATION_BSS_COLOR_MASK		((u32) (BIT(24) | BIT(25) | \
 							BIT(26) | BIT(27) | \
 							BIT(28) | BIT(29)))