Search Linux Wireless

[PATCH v3 2/6] wifi: mac80211: validate and configure puncturing bitmap in start_ap()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



- Make puncturing bitmap 32 bit to match NL80211 interface.
- Export ieee80211_valid_disable_subchannel_bitmap() and use it to
validate the puncturing bitmap in AP mode.
- Modify 'change' in ieee80211_start_ap() from u32 to u64 to support
BSS_CHANGED_EHT_PUNCTURING.
- Configure the bitmap in link_conf and notify the driver.

Signed-off-by: Aloka Dixit <quic_alokad@xxxxxxxxxxx>
Signed-off-by: Muna Sinada <quic_msinada@xxxxxxxxxxx>
---
v3: This patch depends on following,
https://patchwork.kernel.org/project/linux-wireless/patch/20230127123930.4fbc74582331.I3547481d49f958389f59dfeba3fcc75e72b0aa6e@changeid/

 include/net/mac80211.h     |  2 +-
 net/mac80211/cfg.c         | 10 +++++++++-
 net/mac80211/ieee80211_i.h |  2 ++
 net/mac80211/mlme.c        | 10 +++++-----
 4 files changed, 17 insertions(+), 7 deletions(-)

diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 54ffc0cc2918..b1c17c7ac044 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -738,7 +738,7 @@ struct ieee80211_bss_conf {
 	u8 tx_pwr_env_num;
 	u8 pwr_reduction;
 	bool eht_support;
-	u16 eht_puncturing;
+	u32 eht_puncturing;
 
 	bool csa_active;
 	bool mu_mimo_owner;
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 24b8648cfafa..185e218e8668 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -1220,7 +1220,7 @@ static int ieee80211_start_ap(struct wiphy *wiphy, struct net_device *dev,
 	struct ieee80211_local *local = sdata->local;
 	struct beacon_data *old;
 	struct ieee80211_sub_if_data *vlan;
-	u32 changed = BSS_CHANGED_BEACON_INT |
+	u64 changed = BSS_CHANGED_BEACON_INT |
 		      BSS_CHANGED_BEACON_ENABLED |
 		      BSS_CHANGED_BEACON |
 		      BSS_CHANGED_P2P_PS |
@@ -1296,6 +1296,14 @@ static int ieee80211_start_ap(struct wiphy *wiphy, struct net_device *dev,
 				IEEE80211_HE_PHY_CAP2_UL_MU_FULL_MU_MIMO;
 	}
 
+	if (params->eht_cap) {
+		if (!ieee80211_valid_disable_subchannel_bitmap(
+							&params->punct_bitmap,
+							params->chandef.width))
+			return -EINVAL;
+		link_conf->eht_puncturing = params->punct_bitmap;
+		changed |= BSS_CHANGED_EHT_PUNCTURING;
+	}
 	if (sdata->vif.type == NL80211_IFTYPE_AP &&
 	    params->mbssid_config.tx_wdev) {
 		err = ieee80211_set_ap_mbssid_options(sdata,
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index e833d472ff72..6fd14a3930d6 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -2566,4 +2566,6 @@ ieee80211_eht_cap_ie_to_sta_eht_cap(struct ieee80211_sub_if_data *sdata,
 				    const struct ieee80211_eht_cap_elem *eht_cap_ie_elem,
 				    u8 eht_cap_len,
 				    struct link_sta_info *link_sta);
+bool ieee80211_valid_disable_subchannel_bitmap(u32 *bitmap,
+					       enum nl80211_chan_width bw);
 #endif /* IEEE80211_I_H */
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index a14a5ea2bffd..50efd5980387 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -119,8 +119,8 @@ static const struct ieee80211_per_bw_puncturing_values per_bw_puncturing[] = {
 	IEEE80211_PER_BW_VALID_PUNCTURING_VALUES(320)
 };
 
-static bool ieee80211_valid_disable_subchannel_bitmap(u16 *bitmap,
-						      enum nl80211_chan_width bw)
+bool ieee80211_valid_disable_subchannel_bitmap(u32 *bitmap,
+					       enum nl80211_chan_width bw)
 {
 	u32 idx, i;
 
@@ -206,7 +206,7 @@ ieee80211_handle_puncturing_bitmap(struct ieee80211_link_data *link,
 			ieee80211_extract_dis_subch_bmap(eht_oper, chandef,
 							 bitmap);
 
-		if (ieee80211_valid_disable_subchannel_bitmap(&bitmap,
+		if (ieee80211_valid_disable_subchannel_bitmap((u32 *)&bitmap,
 							      chandef->width))
 			break;
 		link->u.mgd.conn_flags |=
@@ -5638,7 +5638,7 @@ static bool ieee80211_config_puncturing(struct ieee80211_link_data *link,
 	    extracted == link->conf->eht_puncturing)
 		return true;
 
-	if (!ieee80211_valid_disable_subchannel_bitmap(&bitmap,
+	if (!ieee80211_valid_disable_subchannel_bitmap((u32 *)&bitmap,
 						       link->conf->chandef.width)) {
 		link_info(link,
 			  "Got an invalid disable subchannel bitmap from AP %pM: bitmap = 0x%x, bw = 0x%x. disconnect\n",
@@ -7132,7 +7132,7 @@ ieee80211_setup_assoc_link(struct ieee80211_sub_if_data *sdata,
 			u16 bitmap;
 
 			bitmap = get_unaligned_le16(disable_subchannel_bitmap);
-			if (ieee80211_valid_disable_subchannel_bitmap(&bitmap,
+			if (ieee80211_valid_disable_subchannel_bitmap((u32 *)&bitmap,
 								      link->conf->chandef.width))
 				ieee80211_handle_puncturing_bitmap(link,
 								   eht_oper,
-- 
2.39.0




[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Wireless Regulations]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux