[PATCH 1/2] HE: extend BSS color support

John Crispin <[email protected]>
Newsgroups gmane.linux.drivers.hostap
Message-ID <[email protected]>
The he_oper field for BSS color consiste of a disable a partial and 6 color
bits. The original patch adding support for BSS color considered this to be
a u8. This patch changes this to the actual bits/values.

This patch adds an explicit config patameter for the partial bit. The
disabled is set to 0 implicitly if a bss_color is defined.

Interop testing showed that stations will require a bss color to be set
even if the feature is disabled. Hence the default colour is 1 when none
is defined inside the config file.

Signed-off-by: John Crispin <[email protected]>
---
 hostapd/config_file.c        | 5 ++++-
 hostapd/hostapd.conf         | 3 +++
 src/ap/ap_config.c           | 3 +++
 src/ap/ap_config.h           | 2 ++
 src/ap/ieee802_11_he.c       | 9 ++++++---
 src/common/ieee802_11_defs.h | 1 +
 6 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/hostapd/config_file.c b/hostapd/config_file.c
index 0169b989d..602c4a2b9 100644
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
@@ -3474,7 +3474,10 @@ static int hostapd_config_fill(struct hostapd_config *conf,
 	} else if (os_strcmp(buf, "he_mu_beamformer") == 0) {
 		conf->he_phy_capab.he_mu_beamformer = atoi(pos);
 	} else if (os_strcmp(buf, "he_bss_color") == 0) {
-		conf->he_op.he_bss_color = atoi(pos);
+		conf->he_op.he_bss_color = atoi(pos) & 0x3f;
+		conf->he_op.he_bss_color_disabled = 0;
+	} else if (os_strcmp(buf, "he_bss_color_partial") == 0) {
+		conf->he_op.he_bss_color_partial = atoi(pos);
 	} else if (os_strcmp(buf, "he_default_pe_duration") == 0) {
 		conf->he_op.he_default_pe_duration = atoi(pos);
 	} else if (os_strcmp(buf, "he_twt_required") == 0) {
diff --git a/hostapd/hostapd.conf b/hostapd/hostapd.conf
index f55925afd..eaffed4e6 100644
--- a/hostapd/hostapd.conf
+++ b/hostapd/hostapd.conf
@@ -806,6 +806,9 @@ wmm_ac_vo_acm=0
 # he_bss_color: BSS color (1-63)
 #he_bss_color=1
 
+# he_bss_color_partial: BSS color AID equation
+#he_bss_color_partial=0
+
 #he_default_pe_duration: The duration of PE field in an HE PPDU in us
 # Possible values are 0 us (default), 4 us, 8 us, 12 us, and 16 us
 #he_default_pe_duration=0
diff --git a/src/ap/ap_config.c b/src/ap/ap_config.c
index 799d8f4da..91fc6df93 100644
--- a/src/ap/ap_config.c
+++ b/src/ap/ap_config.c
@@ -251,6 +251,9 @@ struct hostapd_config * hostapd_config_defaults(void)
 		HE_OPERATION_RTS_THRESHOLD_OFFSET;
 	/* Set default basic MCS/NSS set to single stream MCS 0-7 */
 	conf->he_op.he_basic_mcs_nss_set = 0xfffc;
+	conf->he_op.he_bss_color_disabled = 1;
+	conf->he_op.he_bss_color_partial = 0;
+	conf->he_op.he_bss_color = 1;
 #endif /* CONFIG_IEEE80211AX */
 
 	/* The third octet of the country string uses an ASCII space character
diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h
index 017e60aa4..3efdf1f48 100644
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
@@ -853,6 +853,8 @@ struct he_phy_capabilities_info {
  */
 struct he_operation {
 	u8 he_bss_color;
+	u8 he_bss_color_disabled;
+	u8 he_bss_color_partial;
 	u8 he_default_pe_duration;
 	u8 he_twt_required;
 	u16 he_rts_threshold;
diff --git a/src/ap/ieee802_11_he.c b/src/ap/ieee802_11_he.c
index 3e22ce412..b06d1be42 100644
--- a/src/ap/ieee802_11_he.c
+++ b/src/ap/ieee802_11_he.c
@@ -192,9 +192,12 @@ u8 * hostapd_eid_he_operation(struct hostapd_data *hapd, u8 *eid)
 		params |= (hapd->iface->conf->he_op.he_rts_threshold <<
 			   HE_OPERATION_RTS_THRESHOLD_OFFSET);
 
-	if (hapd->iface->conf->he_op.he_bss_color)
-		params |= (hapd->iface->conf->he_op.he_bss_color <<
-			   HE_OPERATION_BSS_COLOR_OFFSET);
+	if (hapd->iface->conf->he_op.he_bss_color_disabled)
+		params |= HE_OPERATION_BSS_COLOR_DISABLED;
+	if (hapd->iface->conf->he_op.he_bss_color_partial)
+		params |= HE_OPERATION_BSS_COLOR_PARTIAL;
+	params |= (hapd->iface->conf->he_op.he_bss_color <<
+		   HE_OPERATION_BSS_COLOR_OFFSET);
 
 	/* HE minimum required basic MCS and NSS for STAs */
 	oper->he_mcs_nss_set =
diff --git a/src/common/ieee802_11_defs.h b/src/common/ieee802_11_defs.h
index ad4ef1a33..fca211709 100644
--- a/src/common/ieee802_11_defs.h
+++ b/src/common/ieee802_11_defs.h
@@ -2200,6 +2200,7 @@ struct ieee80211_spatial_reuse {
 							BIT(28) | BIT(29)))
 #define HE_OPERATION_PARTIAL_BSS_COLOR		((u32) BIT(30))
 #define HE_OPERATION_BSS_COLOR_DISABLED		((u32) BIT(31))
+#define HE_OPERATION_BSS_COLOR_PARTIAL		((u32) BIT(30))
 #define HE_OPERATION_BSS_COLOR_OFFSET		24
 
 /* Spatial Reuse defines */
-- 
2.20.1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.