From a84bf443887deee828a3b4422f63475709404d5c Mon Sep 17 00:00:00 2001 From: John Crispin Date: Tue, 13 Aug 2019 16:16:25 +0200 Subject: [PATCH] HE: Send the AP's OBSS PD settings to the kernel 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 --- src/ap/beacon.c | 7 +++++++ src/drivers/driver.h | 15 +++++++++++++++ src/drivers/driver_nl80211.c | 17 +++++++++++++++++ 3 files changed, 39 insertions(+) diff --git a/src/ap/beacon.c b/src/ap/beacon.c index f3bdf30aa..6c94f9521 100644 --- a/src/ap/beacon.c +++ b/src/ap/beacon.c @@ -1423,6 +1423,13 @@ int ieee802_11_set_beacon(struct hostapd_data *hapd) params.proberesp_ies = proberesp; params.assocresp_ies = assocresp; params.reenable = hapd->reenable_beacon; +#ifdef CONFIG_IEEE80211AX + 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 /* CONFIG_IEEE80211AX */ hapd->reenable_beacon = 0; if (cmode && diff --git a/src/drivers/driver.h b/src/drivers/driver.h index 2a8459ae3..e9d0e4728 100644 --- a/src/drivers/driver.h +++ b/src/drivers/driver.h @@ -1442,6 +1442,21 @@ struct wpa_driver_ap_params { * type 11 as defined in IEEE Std 802.11-2016, 9.4.2.22.13 */ const struct wpabuf *civic; + + /** + * 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 4133aa6af..c7dad201b 100644 --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c @@ -4282,6 +4282,23 @@ static int wpa_driver_nl80211_set_ap(void *priv, nla_nest_end(msg, ftm); } +#ifdef CONFIG_IEEE80211AX + if (params->he_spr) { + struct nlattr *spr; + + 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) || + 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 /* CONFIG_IEEE80211AX */ + ret = send_and_recv_msgs(drv, msg, NULL, NULL); if (ret) { wpa_printf(MSG_DEBUG, "nl80211: Beacon set failed: %d (%s)",