mac80211: allow setting spatial reuse parameters from bss_conf
Subsystems (2)
PATCH v2 1/1 mac80211: allow setting spatial reuse parameters from bss_conf
Store the OBSS PD parameters inside bss_conf when bringing up an AP and/or when a station connects to an AP. This allows the driver to configure the HW accordingly.
Signed-off-by John Crispin <[email protected]>
---
Changes in V2
* fix symbol prefixes
* fix nl policy
include/net/cfg80211.h | 15 ++++++++++++ include/net/mac80211.h | 4 ++++ include/uapi/linux/nl80211.h | 27 ++++++++++++++++++++++ net/mac80211/cfg.c | 5 +++- net/mac80211/he.c | 24 ++++++++++++++++++++ net/mac80211/ieee80211_i.h | 3 +++ net/mac80211/mlme.c | 1 + net/wireless/nl80211.c | 44 ++++++++++++++++++++++++++++++++++++ 8 files changed, 122 insertions(+), 1 deletion(-)
include/net/cfg80211.h +15 -0
@@ -246,6 +246,19 @@ struct ieee80211_rate {u16 hw_value, hw_value_short; }; +/** +* struct ieee80211_he_obss_pd - AP settings for spatial reuse +* +* @enable: is the feature enabled. +* @min_offset: minimal tx power offset an associated station shall use +* @max_offset: maximum tx power offset an associated station shall use +*/ +struct ieee80211_he_obss_pd { +bool enable; +u8 min_offset; +u8 max_offset; +}; +/** * struct ieee80211_sta_ht_cap - STA's HT capabilities *
@@ -891,6 +904,7 @@ enum cfg80211_ap_settings_flags {* @vht_required: stations must support VHT * @twt_responder: Enable Target Wait Time * @flags: flags, as defined in enum cfg80211_ap_settings_flags +* @he_obss_pd: OBSS Packet Detection settings */ struct cfg80211_ap_settings {struct cfg80211_chan_def chandef;
@@ -918,6 +932,7 @@ struct cfg80211_ap_settings {bool ht_required, vht_required;bool twt_responder;u32 flags; +struct ieee80211_he_obss_pd he_obss_pd; };/**
include/net/mac80211.h +4 -0
@@ -315,6 +315,7 @@ struct ieee80211_vif_chanctx_switch {* @BSS_CHANGED_FTM_RESPONDER: fime timing reasurement request responder * functionality changed for this BSS (AP mode). * @BSS_CHANGED_TWT: TWT status changed +* @BSS_CHANGED_HE_OBSS_PD: OBSS Packet Detection status changed. * */ enum ieee80211_bss_change {
@@ -346,6 +347,7 @@ enum ieee80211_bss_change {BSS_CHANGED_MCAST_RATE =1 <<25 ,BSS_CHANGED_FTM_RESPONDER =1 <<26 ,BSS_CHANGED_TWT =1 <<27 , + BSS_CHANGED_HE_OBSS_PD = 1<<28, /* when adding here, make sure to change ieee80211_reconfig */ };
@@ -601,6 +603,7 @@ struct ieee80211_ftm_responder_params {* @profile_periodicity: the least number of beacon frames need to be received * in order to discover all the nontransmitted BSSIDs in the set. * @he_operation: HE operation information of the AP we are connected to +* @he_obss_pd: OBSS Packet Detection parameters. */ struct ieee80211_bss_conf {const u8 *bssid;
@@ -663,6 +666,7 @@ struct ieee80211_bss_conf {bool ema_ap;u8 profile_periodicity;struct ieee80211_he_operation he_operation; +struct ieee80211_he_obss_pd he_obss_pd; };/**
include/uapi/linux/nl80211.h +27 -0
@@ -2344,6 +2344,9 @@ enum nl80211_commands {* * @NL80211_ATTR_TWT_RESPONDER: Enable target wait time responder support. * +* @NL80211_ATTR_HE_OBSS_PD: nested attribute for OBSS Packet Detection +* functionality. +* * @NUM_NL80211_ATTR: total number of nl80211_attrs available * @NL80211_ATTR_MAX: highest attribute number currently defined * @__NL80211_ATTR_AFTER_LAST: internal use
@@ -2799,6 +2802,8 @@ enum nl80211_attrs {NL80211_ATTR_TWT_RESPONDER , +NL80211_ATTR_HE_OBSS_PD , +/* add attributes here, update the policy in nl80211.c */ __NL80211_ATTR_AFTER_LAST,
@@ -6469,4 +6474,26 @@ enum nl80211_peer_measurement_ftm_resp {NL80211_PMSR_FTM_RESP_ATTR_MAX =NUM_NL80211_PMSR_FTM_RESP_ATTR -1 }; +/** +* enum nl80211_obss_pd_attributes - OBSS packet detection attributes +* @__NL80211_HE_OBSS_PD_ATTR_INVALID: Invalid +* +* @NL80211_HE_OBSS_PD_ATTR_MIN_OFFSET: the OBSS PD minimum tx power offset. +* @NL80211_HE_OBSS_PD_ATTR_MAX_OFFSET: the OBSS PD maximum tx power offset. +* +* @__NL80211_HE_OBSS_PD_ATTR_LAST: Internal +* @NL80211_HE_OBSS_PD_ATTR_MAX: highest OBSS PD attribute. +*/ +enum nl80211_obss_pd_attributes { + __NL80211_HE_OBSS_PD_ATTR_INVALID, + +NL80211_HE_OBSS_PD_ATTR_MIN_OFFSET , +NL80211_HE_OBSS_PD_ATTR_MAX_OFFSET , + +/* keep last */ + __NL80211_HE_OBSS_PD_ATTR_LAST, +NL80211_HE_OBSS_PD_ATTR_MAX = __NL80211_HE_OBSS_PD_ATTR_LAST -1 , +}; + +#endif /* __LINUX_NL80211_H */
net/mac80211/cfg.c +4 -1
@@ -975,7 +975,8 @@ static int ieee80211_start_ap(struct wiphy *wiphy, struct net_device *dev,BSS_CHANGED_SSID |BSS_CHANGED_P2P_PS |BSS_CHANGED_TXPOWER | -BSS_CHANGED_TWT ; +BSS_CHANGED_TWT | +BSS_CHANGED_HE_OBSS_PD ;int err;int prev_beacon_int;
@@ -1046,6 +1047,8 @@ static int ieee80211_start_ap(struct wiphy *wiphy, struct net_device *dev, sdata->vif.bss_conf.enable_beacon = true; sdata->vif.bss_conf.allow_p2p_go_ps = sdata->vif.p2p; sdata->vif.bss_conf.twt_responder = params->twt_responder; +memcpy (&sdata->vif.bss_conf.he_obss_pd, ¶ms->he_obss_pd, +sizeof (struct ieee80211_he_obss_pd )); sdata->vif.bss_conf.ssid_len = params->ssid_len;if (params->ssid_len)
net/mac80211/he.c +24 -0
@@ -64,3 +64,27 @@ ieee80211_he_op_ie_to_bss_conf(struct ieee80211_vif *vif, }memcpy (he_operation, he_op_ie_elem,sizeof (*he_operation)); } + +void +ieee80211_he_spr_ie_to_bss_conf (struct ieee80211_vif *vif, +const struct ieee80211_he_spr *he_spr_ie_elem) +{ +struct ieee80211_he_obss_pd *he_obss_pd = + &vif->bss_conf.he_obss_pd; +const u8 *data = he_spr_ie_elem->optional; + +memset (he_obss_pd,0 ,sizeof (*he_obss_pd)); + +if (!he_spr_ie_elem) +return ; + +if (he_spr_ie_elem->he_sr_control & +IEEE80211_HE_SPR_NON_SRG_OFFSET_PRESENT ) + data++; +if (he_spr_ie_elem->he_sr_control & +IEEE80211_HE_SPR_SRG_INFORMATION_PRESENT ) { + he_obss_pd->max_offset = *data++; + he_obss_pd->min_offset = *data++; + he_obss_pd->enable = true; + } +}
net/mac80211/ieee80211_i.h +3 -0
@@ -1873,6 +1873,9 @@ ieee80211_he_cap_ie_to_sta_he_cap(struct ieee80211_sub_if_data *sdata,struct ieee80211_supported_band *sband, const u8 *he_cap_ie, u8 he_cap_len, struct sta_info *sta); +void +ieee80211_he_spr_ie_to_bss_conf (struct ieee80211_vif *vif, +const struct ieee80211_he_spr *he_spr_ie_elem); void ieee80211_he_op_ie_to_bss_conf(struct ieee80211_vif *vif,
net/mac80211/mlme.c +1 -0
@@ -3381,6 +3381,7 @@ static bool ieee80211_assoc_success(struct ieee80211_sub_if_data *sdata, bss_conf->uora_ocw_range = elems.uora_element[0 ];ieee80211_he_op_ie_to_bss_conf (&sdata->vif, elems.he_operation); +ieee80211_he_spr_ie_to_bss_conf (&sdata->vif, elems.he_spr);/* TODO: OPEN: what happens if BSS color disable is set? */ }
net/wireless/nl80211.c +44 -0
68 lines not on this page · raw message
Signature · 1 line
2.20.1