[PATCH 2/2] HE: propagate BSS color settings to nl80211

John Crispin <[email protected]>
Newsgroups gmane.linux.drivers.hostap
Message-ID <[email protected]>
This patch adds the code required to send the BSS color settings to the kernel.

It depends on the latest nl80211.h from the linux-wireless tree.

Signed-off-by: John Crispin <[email protected]>
---
 src/ap/beacon.c              |  5 +++++
 src/drivers/driver.h         | 15 +++++++++++++++
 src/drivers/driver_nl80211.c | 15 +++++++++++++++
 3 files changed, 35 insertions(+)

diff --git a/src/ap/beacon.c b/src/ap/beacon.c
index 29c7e383d..f63be15c8 100644
--- a/src/ap/beacon.c
+++ b/src/ap/beacon.c
@@ -1443,6 +1443,11 @@ int ieee802_11_set_beacon(struct hostapd_data *hapd)
 		hapd->iface->conf->spr.srg_obss_pd_min_offset;
 	params.he_spr_srg_obss_pd_max_offset =
 		hapd->iface->conf->spr.srg_obss_pd_max_offset;
+	params.he_bss_color_disabled =
+		hapd->iface->conf->he_op.he_bss_color_disabled;
+	params.he_bss_color_partial =
+		hapd->iface->conf->he_op.he_bss_color_partial;
+	params.he_bss_color = hapd->iface->conf->he_op.he_bss_color;
 #endif /* CONFIG_IEEE80211AX */
 	hapd->reenable_beacon = 0;
 
diff --git a/src/drivers/driver.h b/src/drivers/driver.h
index 9bdf88011..5e6d00d56 100644
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -1487,6 +1487,21 @@ struct wpa_driver_ap_params {
 	 * he_spr_srg_obss_pd_max_offset - Maximum TX power offset
 	 */
 	 int he_spr_srg_obss_pd_max_offset;
+
+	/**
+	 * he_bss_color - Define if BSS Color is enabled
+	 */
+	int he_bss_color_disabled;
+
+	/**
+	 * he_bss_color_partial - The BSS Color AID equation
+	 */
+	int he_bss_color_partial;
+
+	/**
+	 * he_bss_color - The BSS Color of the AP
+	 */
+	int he_bss_color;
 };
 
 struct wpa_driver_mesh_bss_params {
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index 7305ed60b..a4026afec 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -4108,6 +4108,9 @@ static int wpa_driver_nl80211_set_ap(void *priv,
 #ifdef CONFIG_MESH
 	struct wpa_driver_mesh_bss_params mesh_params;
 #endif /* CONFIG_MESH */
+#ifdef CONFIG_IEEE80211AX
+	struct nlattr *bss_color;
+#endif
 
 	beacon_set = params->reenable ? 0 : bss->beacon_set;
 
@@ -4348,6 +4351,18 @@ static int wpa_driver_nl80211_set_ap(void *priv,
 
 		nla_nest_end(msg, spr);
 	}
+
+	bss_color = nla_nest_start(msg, NL80211_ATTR_HE_BSS_COLOR);
+	if (params->he_bss_color_disabled)
+		if (nla_put_flag(msg, NL80211_HE_BSS_COLOR_ATTR_DISABLED))
+			goto fail;
+	if (params->he_bss_color_partial)
+		if (nla_put_flag(msg, NL80211_HE_BSS_COLOR_ATTR_PARTIAL))
+			goto fail;
+	if (nla_put_u8(msg, NL80211_HE_BSS_COLOR_ATTR_COLOR, params->he_bss_color))
+		goto fail;
+	nla_nest_end(msg, bss_color);
+
 #endif /* CONFIG_IEEE80211AX */
 
 	ret = send_and_recv_msgs(drv, msg, NULL, NULL);
-- 
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.