diff mbox series

[v3,4/6] wifi: mac80211: configure puncturing bitmap in channel_switch()

Message ID 20230130072239.26345-5-quic_alokad@quicinc.com
State New
Headers show
Series Puncturing support in AP mode | expand

Commit Message

Aloka Dixit Jan. 30, 2023, 7:22 a.m. UTC
Validate and set the puncturing bitmap in bss_conf for new channel.

Signed-off-by: Aloka Dixit <quic_alokad@quicinc.com>
---
 include/net/mac80211.h |  3 +++
 net/mac80211/cfg.c     | 13 +++++++++++++
 2 files changed, 16 insertions(+)
diff mbox series

Patch

diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index b1c17c7ac044..87db6055d331 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -645,6 +645,7 @@  struct ieee80211_fils_discovery {
  * @csa_active: marks whether a channel switch is going on. Internally it is
  *	write-protected by sdata_lock and local->mtx so holding either is fine
  *	for read access.
+ * @csa_punct_bitmap: new pucturing bitmap for channel switch
  * @mu_mimo_owner: indicates interface owns MU-MIMO capability
  * @chanctx_conf: The channel context this interface is assigned to, or %NULL
  *	when it is not assigned. This pointer is RCU-protected due to the TX
@@ -741,6 +742,8 @@  struct ieee80211_bss_conf {
 	u32 eht_puncturing;
 
 	bool csa_active;
+	u32 csa_punct_bitmap;
+
 	bool mu_mimo_owner;
 	struct ieee80211_chanctx_conf __rcu *chanctx_conf;
 
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 87aab0ba9353..8a1cb2f083f5 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -3553,6 +3553,12 @@  static int __ieee80211_csa_finalize(struct ieee80211_sub_if_data *sdata)
 	lockdep_assert_held(&local->mtx);
 	lockdep_assert_held(&local->chanctx_mtx);
 
+	if (sdata->vif.bss_conf.eht_puncturing != sdata->vif.bss_conf.csa_punct_bitmap) {
+		sdata->vif.bss_conf.eht_puncturing =
+					sdata->vif.bss_conf.csa_punct_bitmap;
+		changed |= BSS_CHANGED_EHT_PUNCTURING;
+	}
+
 	/*
 	 * using reservation isn't immediate as it may be deferred until later
 	 * with multi-vif. once reservation is complete it will re-schedule the
@@ -3856,9 +3862,16 @@  __ieee80211_channel_switch(struct wiphy *wiphy, struct net_device *dev,
 		goto out;
 	}
 
+	if (params->punct_bitmap &&
+	    (!sdata->vif.bss_conf.eht_support ||
+	     !ieee80211_valid_disable_subchannel_bitmap(&params->punct_bitmap,
+							params->chandef.width)))
+		goto out;
+
 	sdata->deflink.csa_chandef = params->chandef;
 	sdata->deflink.csa_block_tx = params->block_tx;
 	sdata->vif.bss_conf.csa_active = true;
+	sdata->vif.bss_conf.csa_punct_bitmap = params->punct_bitmap;
 
 	if (sdata->deflink.csa_block_tx)
 		ieee80211_stop_vif_queues(local, sdata,