diff mbox series

[RFC,4/4] wifi: mac80211: Handle RU Puncturing information

Message ID 1670006154-6092-5-git-send-email-quic_msinada@quicinc.com (mailing list archive)
State RFC
Delegated to: Johannes Berg
Headers show
Series Static RU Puncturing | expand

Commit Message

Muna Sinada Dec. 2, 2022, 6:35 p.m. UTC
Handle RU Puncturing information received from user space.
RU Puncturing bitmap is initially received during
ieee80211_change_iface() and stored. During AP chanwidth setting,
the bitmap is validated. In addition driver is notified of new bitmap
value.

Signed-off-by: Muna Sinada <quic_msinada@quicinc.com>
---
 net/mac80211/cfg.c  |  8 ++++++++
 net/mac80211/chan.c | 14 ++++++++++++--
 2 files changed, 20 insertions(+), 2 deletions(-)

Comments

Johannes Berg Jan. 19, 2023, 3:40 p.m. UTC | #1
On Fri, 2022-12-02 at 10:35 -0800, Muna Sinada wrote:
> Handle RU Puncturing information received from user space.
> RU Puncturing bitmap is initially received during
> ieee80211_change_iface() and stored. During AP chanwidth setting,
> the bitmap is validated. In addition driver is notified of new bitmap
> value.


"initially" is a bit of a problem, right?


> @@ -213,6 +213,12 @@ static int ieee80211_change_iface(struct wiphy *wiphy,
>  	struct sta_info *sta;
>  	int ret;
>  
> +	sdata->vif.bss_conf.ru_punct_bitmap = params->ru_punct_bitmap;
> +	sdata->vif.bss_conf.ru_punct_bitmap_supp_he = params->ru_punct_bitmap_supp_he;

I mean this can happen at any point in time due to the way you've wired
it up in nl80211 (which I'm not happy about), and then ... it just gets
ignored.

> +	if (!sdata->vif.bss_conf.ru_punct_bitmap)
> +		sdata_dbg(sdata, "RU Puncturing Bitmap was not set by user\n");
> +

?

> @@ -1251,6 +1257,8 @@ static int ieee80211_start_ap(struct wiphy *wiphy, struct net_device *dev,
>  	prev_beacon_int = link_conf->beacon_int;
>  	link_conf->beacon_int = params->beacon_interval;
>  
> +	sdata->vif.bss_conf.ru_punct_bitmap = dev->ieee80211_ptr->ru_punct_bitmap;

Why grab only one of them here? In fact why grab them at all?

I think you really need to work on the API here.

Also this completely ignores links ... so it's wrong for that too. Must
use link_conf->...

johannes
diff mbox series

Patch

diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index c848fe04dd44..d82060d8fd4e 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -213,6 +213,12 @@  static int ieee80211_change_iface(struct wiphy *wiphy,
 	struct sta_info *sta;
 	int ret;
 
+	sdata->vif.bss_conf.ru_punct_bitmap = params->ru_punct_bitmap;
+	sdata->vif.bss_conf.ru_punct_bitmap_supp_he = params->ru_punct_bitmap_supp_he;
+
+	if (!sdata->vif.bss_conf.ru_punct_bitmap)
+		sdata_dbg(sdata, "RU Puncturing Bitmap was not set by user\n");
+
 	ret = ieee80211_if_change_type(sdata, type);
 	if (ret)
 		return ret;
@@ -1251,6 +1257,8 @@  static int ieee80211_start_ap(struct wiphy *wiphy, struct net_device *dev,
 	prev_beacon_int = link_conf->beacon_int;
 	link_conf->beacon_int = params->beacon_interval;
 
+	sdata->vif.bss_conf.ru_punct_bitmap = dev->ieee80211_ptr->ru_punct_bitmap;
+
 	if (params->he_cap && params->he_oper) {
 		link_conf->he_support = true;
 		link_conf->htc_trig_based_pkt_ext =
diff --git a/net/mac80211/chan.c b/net/mac80211/chan.c
index e72cf0749d49..55a1f8bb309c 100644
--- a/net/mac80211/chan.c
+++ b/net/mac80211/chan.c
@@ -838,6 +838,7 @@  static int ieee80211_assign_link_chanctx(struct ieee80211_link_data *link,
 	struct ieee80211_local *local = sdata->local;
 	struct ieee80211_chanctx_conf *conf;
 	struct ieee80211_chanctx *curr_ctx = NULL;
+	u64 changed;
 	int ret = 0;
 
 	if (WARN_ON(sdata->vif.type == NL80211_IFTYPE_NAN))
@@ -882,8 +883,10 @@  static int ieee80211_assign_link_chanctx(struct ieee80211_link_data *link,
 	}
 
 	if (sdata->vif.type != NL80211_IFTYPE_P2P_DEVICE &&
-	    sdata->vif.type != NL80211_IFTYPE_MONITOR)
-		ieee80211_vif_cfg_change_notify(sdata, BSS_CHANGED_IDLE);
+	    sdata->vif.type != NL80211_IFTYPE_MONITOR) {
+		changed |= BSS_CHANGED_IDLE | BSS_CHANGED_EHT_PUNCTURING;
+		ieee80211_vif_cfg_change_notify(sdata, changed);
+	}
 
 	ieee80211_check_fast_xmit_iface(sdata);
 
@@ -1942,6 +1945,13 @@  int ieee80211_link_change_bandwidth(struct ieee80211_link_data *link,
 		goto out;
 	}
 
+	if (!ieee80211_valid_disable_subchannel_bitmap(
+					   &sdata->vif.bss_conf.ru_punct_bitmap,
+					   chandef->width)) {
+		ret = -EINVAL;
+		goto out;
+	}
+
 	conf = rcu_dereference_protected(link_conf->chanctx_conf,
 					 lockdep_is_held(&local->chanctx_mtx));
 	if (!conf) {