All of lore.kernel.org
 help / color / mirror / Atom feed
From: Aloka Dixit <quic_alokad@quicinc.com>
To: <johannes@sipsolutions.net>, <linux-wireless@vger.kernel.org>
Cc: Aloka Dixit <quic_alokad@quicinc.com>,
	Muna Sinada <quic_msinada@quicinc.com>
Subject: [PATCH v3 2/6] wifi: mac80211: validate and configure puncturing bitmap in start_ap()
Date: Sun, 29 Jan 2023 23:22:35 -0800	[thread overview]
Message-ID: <20230130072239.26345-3-quic_alokad@quicinc.com> (raw)
In-Reply-To: <20230130072239.26345-1-quic_alokad@quicinc.com>

- 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@quicinc.com>
Signed-off-by: Muna Sinada <quic_msinada@quicinc.com>
---
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


  parent reply	other threads:[~2023-01-30  7:23 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-30  7:22 [PATCH v3 0/6] Puncturing support in AP mode Aloka Dixit
2023-01-30  7:22 ` [PATCH v3 1/6] wifi: nl80211: configure puncturing bitmap in NL80211_CMD_START_AP Aloka Dixit
2023-01-30  8:40   ` Johannes Berg
2023-01-30 19:35     ` Aloka Dixit
2023-01-30 19:40       ` Aloka Dixit
2023-01-30  7:22 ` Aloka Dixit [this message]
2023-01-30  8:42   ` [PATCH v3 2/6] wifi: mac80211: validate and configure puncturing bitmap in start_ap() Johannes Berg
2023-01-30  7:22 ` [PATCH v3 3/6] wifi: nl80211: configure puncturing in NL80211_CMD_CHANNEL_SWITCH Aloka Dixit
2023-01-30  8:43   ` Johannes Berg
2023-01-30  7:22 ` [PATCH v3 4/6] wifi: mac80211: configure puncturing bitmap in channel_switch() Aloka Dixit
2023-01-30  8:44   ` Johannes Berg
2023-01-30  7:22 ` [PATCH v3 5/6] wifi: cfg80211: add puncturing bitmap in channel switch notifications Aloka Dixit
2023-01-30  8:45   ` Johannes Berg
2023-01-30  7:22 ` [PATCH v3 6/6] wifi: nl80211: add puncturing bitmap in channel switch events Aloka Dixit
2023-01-30  8:48 ` [PATCH v3 0/6] Puncturing support in AP mode Johannes Berg
2023-01-30 19:44   ` Aloka Dixit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230130072239.26345-3-quic_alokad@quicinc.com \
    --to=quic_alokad@quicinc.com \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    --cc=quic_msinada@quicinc.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.