[3/3] HE: send the APs OBSS PD settings to the kernel
diff mbox series

Message ID 20190813141625.25216-3-john@phrozen.org
State New
Headers show
Series
  • [1/3] update nl80211.h to the version from mac80211-next 13.08.2019
Related show

Commit Message

John Crispin Aug. 13, 2019, 2:16 p.m. UTC
This allows us to send the OBSS PD settings to the kernel, such that the
driver can propagate them to the hardware/firmware.

Signed-off-by: John Crispin <john@phrozen.org>
---
 src/ap/beacon.c              |  3 +++
 src/drivers/driver.h         | 16 ++++++++++++++++
 src/drivers/driver_nl80211.c | 13 +++++++++++++
 3 files changed, 32 insertions(+)

Patch
diff mbox series

diff --git a/src/ap/beacon.c b/src/ap/beacon.c
index 756dde926..7376ce976 100644
--- a/src/ap/beacon.c
+++ b/src/ap/beacon.c
@@ -1423,6 +1423,9 @@  int ieee802_11_set_beacon(struct hostapd_data *hapd)
 	params.reenable = hapd->reenable_beacon;
 #ifdef CONFIG_IEEE80211AX
 	params.twt_responder = hostapd_get_he_twt_responder(hapd);
+	params.he_spr = !!hapd->iface->conf->spr.sr_control;
+	params.he_spr_srg_obss_pd_min_offset = 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;
 #endif
 	hapd->reenable_beacon = 0;
 
diff --git a/src/drivers/driver.h b/src/drivers/driver.h
index 198745ca6..00fbe4faf 100644
--- a/src/drivers/driver.h
+++ b/src/drivers/driver.h
@@ -1447,6 +1447,22 @@  struct wpa_driver_ap_params {
 	 * twt_responder - Whether Target Wait Time responder is enabled
 	 */
 	int twt_responder;
+
+	/**
+	 * he_spr - Whether Spatial Reuse is enabled
+	 */
+	 int he_spr;
+
+	/**
+	 * he_spr_srg_obss_pd_min_offset - minimum tx power offset
+	 */
+	 int he_spr_srg_obss_pd_min_offset;
+
+	/**
+	 * he_spr_srg_obss_pd_max_offset - maximum tx power offset
+	 */
+	 int he_spr_srg_obss_pd_max_offset;
+
 };
 
 struct wpa_driver_mesh_bss_params {
diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index e0f69c967..1fcb38a4a 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -4293,6 +4293,19 @@  static int wpa_driver_nl80211_set_ap(void *priv,
 		if (nla_put_flag(msg, NL80211_ATTR_TWT_RESPONDER))
 			goto fail;
 	}
+
+	if (params->he_spr) {
+		struct nlattr *spr = nla_nest_start(msg, NL80211_ATTR_HE_OBSS_PD);
+		wpa_printf(MSG_DEBUG, "nl80211: he_spr=%d",
+			   params->he_spr);
+
+		if (nla_put_u8(msg, NL80211_HE_OBSS_PD_ATTR_MIN_OFFSET, params->he_spr_srg_obss_pd_min_offset))
+			goto fail;
+		if (nla_put_u8(msg, NL80211_HE_OBSS_PD_ATTR_MAX_OFFSET, params->he_spr_srg_obss_pd_max_offset))
+			goto fail;
+
+		nla_nest_end(msg, spr);
+	}
 #endif
 	ret = send_and_recv_msgs(drv, msg, NULL, NULL);
 	if (ret) {