linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/15] cfg80211/mac80211 patches from our internal tree 2024-03-18
@ 2024-03-18 16:53 Miri Korenblit
  2024-03-18 16:53 ` [PATCH 01/15] wifi: ieee80211: check for NULL in ieee80211_mle_size_ok() Miri Korenblit
                   ` (14 more replies)
  0 siblings, 15 replies; 16+ messages in thread
From: Miri Korenblit @ 2024-03-18 16:53 UTC (permalink / raw)
  To: johannes; +Cc: linux-wireless

Hi,

A bunch of patches from our internal tree with mac80211 and
cfg80211 changes. It's the usual developement:
features, cleanups and bugfixes.

Thanks,
Miri

Anjaneyulu (2):
  wifi: mac80211: handle indoor AFC/LPI AP on assoc success
  wifi: cfg80211: handle indoor AFC/LPI AP in probe response and beacon

Ayala Beker (3):
  wifi: mac80211: fix BSS_CHANGED_MLD_TTLM description
  wifi: mac80211: correctly set active links upon TTLM
  wifi: mac80211: add support for tearing down negotiated TTLM

Benjamin Berg (3):
  wifi: mac80211: improve association error reporting slightly
  wifi: cfg80211: check BSSID Index against MaxBSSID
  wifi: cfg80211: ignore non-TX BSSs in per-STA profile

Johannes Berg (7):
  wifi: ieee80211: check for NULL in ieee80211_mle_size_ok()
  wifi: ieee80211: fix ieee80211_mle_basic_sta_prof_size_ok()
  wifi: mac80211_hwsim: move skip_beacons to be per link
  wifi: mac80211: clarify the dormant/suspended links docs
  wifi: mac80211: add flag to disallow puncturing in 5 GHz
  wifi: mac80211: parse puncturing bitmap in 6 GHz
  wifi: mac80211: fix prep_connection error path

 drivers/net/wireless/virtual/mac80211_hwsim.c | 19 ++--
 include/linux/ieee80211.h                     | 12 ++-
 include/net/mac80211.h                        | 22 ++++-
 net/mac80211/debugfs.c                        |  1 +
 net/mac80211/ieee80211_i.h                    |  2 +
 net/mac80211/mlme.c                           | 97 ++++++++++++++++---
 net/mac80211/status.c                         | 22 ++++-
 net/mac80211/util.c                           |  2 +
 net/wireless/scan.c                           | 54 +++++++++--
 9 files changed, 192 insertions(+), 39 deletions(-)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH 01/15] wifi: ieee80211: check for NULL in ieee80211_mle_size_ok()
  2024-03-18 16:53 [PATCH 00/15] cfg80211/mac80211 patches from our internal tree 2024-03-18 Miri Korenblit
@ 2024-03-18 16:53 ` Miri Korenblit
  2024-03-18 16:53 ` [PATCH 02/15] wifi: ieee80211: fix ieee80211_mle_basic_sta_prof_size_ok() Miri Korenblit
                   ` (13 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Miri Korenblit @ 2024-03-18 16:53 UTC (permalink / raw)
  To: johannes; +Cc: linux-wireless, Johannes Berg

From: Johannes Berg <johannes.berg@intel.com>

For simplicity, we may want to pass a NULL element, and
while we should then pass also a zero length, just be a
bit more careful here.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
---
 include/linux/ieee80211.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index 3385a2cc5b09..a99f048404b8 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -5166,7 +5166,7 @@ static inline bool ieee80211_mle_size_ok(const u8 *data, size_t len)
 	bool check_common_len = false;
 	u16 control;
 
-	if (len < fixed)
+	if (!data || len < fixed)
 		return false;
 
 	control = le16_to_cpu(mle->control);
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 02/15] wifi: ieee80211: fix ieee80211_mle_basic_sta_prof_size_ok()
  2024-03-18 16:53 [PATCH 00/15] cfg80211/mac80211 patches from our internal tree 2024-03-18 Miri Korenblit
  2024-03-18 16:53 ` [PATCH 01/15] wifi: ieee80211: check for NULL in ieee80211_mle_size_ok() Miri Korenblit
@ 2024-03-18 16:53 ` Miri Korenblit
  2024-03-18 16:53 ` [PATCH 03/15] wifi: mac80211_hwsim: move skip_beacons to be per link Miri Korenblit
                   ` (12 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Miri Korenblit @ 2024-03-18 16:53 UTC (permalink / raw)
  To: johannes; +Cc: linux-wireless, Johannes Berg, Ilan Peer

From: Johannes Berg <johannes.berg@intel.com>

If there was a possibility of an MLE basic STA profile without
subelements, we might reject it because we account for the one
octet for sta_info_len twice (it's part of itself, and in the
fixed portion). Like in ieee80211_mle_reconf_sta_prof_size_ok,
subtract 1 to adjust that.

When reading the elements we did take this into account, and
since there are always elements, this never really mattered.

Fixes: 7b6f08771bf6 ("wifi: ieee80211: Support validating ML station profile length")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Reviewed-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
---
 include/linux/ieee80211.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index a99f048404b8..4fd9735bb75e 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -5302,7 +5302,7 @@ static inline bool ieee80211_mle_basic_sta_prof_size_ok(const u8 *data,
 		info_len += 1;
 
 	return prof->sta_info_len >= info_len &&
-	       fixed + prof->sta_info_len <= len;
+	       fixed + prof->sta_info_len - 1 <= len;
 }
 
 /**
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 03/15] wifi: mac80211_hwsim: move skip_beacons to be per link
  2024-03-18 16:53 [PATCH 00/15] cfg80211/mac80211 patches from our internal tree 2024-03-18 Miri Korenblit
  2024-03-18 16:53 ` [PATCH 01/15] wifi: ieee80211: check for NULL in ieee80211_mle_size_ok() Miri Korenblit
  2024-03-18 16:53 ` [PATCH 02/15] wifi: ieee80211: fix ieee80211_mle_basic_sta_prof_size_ok() Miri Korenblit
@ 2024-03-18 16:53 ` Miri Korenblit
  2024-03-18 16:53 ` [PATCH 04/15] wifi: mac80211: clarify the dormant/suspended links docs Miri Korenblit
                   ` (11 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Miri Korenblit @ 2024-03-18 16:53 UTC (permalink / raw)
  To: johannes; +Cc: linux-wireless, Johannes Berg

From: Johannes Berg <johannes.berg@intel.com>

Initially, we were only using this for non-MLO, but it could
also be useful for MLO, and if we move it to per-link and the
vif isn't an MLD, it'll be put in the same place (by mac80211)
anyway. Move it to be per link.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
---
 drivers/net/wireless/virtual/mac80211_hwsim.c | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/drivers/net/wireless/virtual/mac80211_hwsim.c b/drivers/net/wireless/virtual/mac80211_hwsim.c
index b55fe320633c..450913cf6583 100644
--- a/drivers/net/wireless/virtual/mac80211_hwsim.c
+++ b/drivers/net/wireless/virtual/mac80211_hwsim.c
@@ -216,7 +216,7 @@ static const struct ieee80211_regdomain *hwsim_world_regdom_custom[] = {
 
 struct hwsim_vif_priv {
 	u32 magic;
-	u32 skip_beacons;
+	u32 skip_beacons[IEEE80211_MLD_MAX_NUM_LINKS];
 	u8 bssid[ETH_ALEN];
 	bool assoc;
 	bool bcn_en;
@@ -2133,13 +2133,16 @@ static int mac80211_hwsim_add_interface(struct ieee80211_hw *hw,
 }
 
 #ifdef CONFIG_MAC80211_DEBUGFS
-static void mac80211_hwsim_vif_add_debugfs(struct ieee80211_hw *hw,
-					   struct ieee80211_vif *vif)
+static void
+mac80211_hwsim_link_add_debugfs(struct ieee80211_hw *hw,
+				struct ieee80211_vif *vif,
+				struct ieee80211_bss_conf *link_conf,
+				struct dentry *dir)
 {
 	struct hwsim_vif_priv *vp = (void *)vif->drv_priv;
 
-	debugfs_create_u32("skip_beacons", 0600, vif->debugfs_dir,
-			   &vp->skip_beacons);
+	debugfs_create_u32("skip_beacons", 0600, dir,
+			   &vp->skip_beacons[link_conf->link_id]);
 }
 #endif
 
@@ -2214,8 +2217,8 @@ static void __mac80211_hwsim_beacon_tx(struct ieee80211_bss_conf *link_conf,
 	/* TODO: get MCS */
 	int bitrate = 100;
 
-	if (vp->skip_beacons) {
-		vp->skip_beacons--;
+	if (vp->skip_beacons[link_conf->link_id]) {
+		vp->skip_beacons[link_conf->link_id]--;
 		dev_kfree_skb(skb);
 		return;
 	}
@@ -3922,7 +3925,7 @@ static int hwsim_pmsr_report_nl(struct sk_buff *msg, struct genl_info *info)
 
 #ifdef CONFIG_MAC80211_DEBUGFS
 #define HWSIM_DEBUGFS_OPS					\
-	.vif_add_debugfs = mac80211_hwsim_vif_add_debugfs,
+	.link_add_debugfs = mac80211_hwsim_link_add_debugfs,
 #else
 #define HWSIM_DEBUGFS_OPS
 #endif
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 04/15] wifi: mac80211: clarify the dormant/suspended links docs
  2024-03-18 16:53 [PATCH 00/15] cfg80211/mac80211 patches from our internal tree 2024-03-18 Miri Korenblit
                   ` (2 preceding siblings ...)
  2024-03-18 16:53 ` [PATCH 03/15] wifi: mac80211_hwsim: move skip_beacons to be per link Miri Korenblit
@ 2024-03-18 16:53 ` Miri Korenblit
  2024-03-18 16:53 ` [PATCH 05/15] wifi: mac80211: fix BSS_CHANGED_MLD_TTLM description Miri Korenblit
                   ` (10 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Miri Korenblit @ 2024-03-18 16:53 UTC (permalink / raw)
  To: johannes; +Cc: linux-wireless, Johannes Berg

From: Johannes Berg <johannes.berg@intel.com>

Since I keep getting confused about this and asking about it,
update the documentation.

In the future, especially when we add more reasons for a link
to be disabled, we should add a per-link 'disable state' bitmap
instead of maintaining all these bitmaps with subset logic, to
indicate each of the different states separately.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
---
 include/net/mac80211.h | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 353488ab94a2..47fa73a62f8a 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -1921,10 +1921,12 @@ enum ieee80211_neg_ttlm_res {
  * @active_links: The bitmap of active links, or 0 for non-MLO.
  *	The driver shouldn't change this directly, but use the
  *	API calls meant for that purpose.
- * @dormant_links: bitmap of valid but disabled links, or 0 for non-MLO.
- *	Must be a subset of valid_links.
+ * @dormant_links: subset of the valid links that are disabled/suspended
+ *	due to advertised or negotiated TTLM respectively.
+ *	0 for non-MLO.
  * @suspended_links: subset of dormant_links representing links that are
- *	suspended.
+ *	suspended due to negotiated TTLM, and could be activated in the
+ *	future by tearing down the TTLM negotiation.
  *	0 for non-MLO.
  * @neg_ttlm: negotiated TID to link mapping info.
  *	see &struct ieee80211_neg_ttlm.
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 05/15] wifi: mac80211: fix BSS_CHANGED_MLD_TTLM description
  2024-03-18 16:53 [PATCH 00/15] cfg80211/mac80211 patches from our internal tree 2024-03-18 Miri Korenblit
                   ` (3 preceding siblings ...)
  2024-03-18 16:53 ` [PATCH 04/15] wifi: mac80211: clarify the dormant/suspended links docs Miri Korenblit
@ 2024-03-18 16:53 ` Miri Korenblit
  2024-03-18 16:53 ` [PATCH 06/15] wifi: mac80211: correctly set active links upon TTLM Miri Korenblit
                   ` (9 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Miri Korenblit @ 2024-03-18 16:53 UTC (permalink / raw)
  To: johannes; +Cc: linux-wireless, Ayala Beker, Ilan Peer

From: Ayala Beker <ayala.beker@intel.com>

BSS_CHANGED_MLD_TTLM purpose is to let the driver know that
negotiated TTLM was updated and as a result MLD suspended links
status was change.
Fix the description to better reflect it.

Signed-off-by: Ayala Beker <ayala.beker@intel.com>
Reviewed-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
---
 include/net/mac80211.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 47fa73a62f8a..757ec33882c2 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -361,7 +361,7 @@ struct ieee80211_vif_chanctx_switch {
  * @BSS_CHANGED_UNSOL_BCAST_PROBE_RESP: Unsolicited broadcast probe response
  *	status changed.
  * @BSS_CHANGED_MLD_VALID_LINKS: MLD valid links status changed.
- * @BSS_CHANGED_MLD_TTLM: TID to link mapping was changed
+ * @BSS_CHANGED_MLD_TTLM: negotiated TID to link mapping was changed
  */
 enum ieee80211_bss_change {
 	BSS_CHANGED_ASSOC		= 1<<0,
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 06/15] wifi: mac80211: correctly set active links upon TTLM
  2024-03-18 16:53 [PATCH 00/15] cfg80211/mac80211 patches from our internal tree 2024-03-18 Miri Korenblit
                   ` (4 preceding siblings ...)
  2024-03-18 16:53 ` [PATCH 05/15] wifi: mac80211: fix BSS_CHANGED_MLD_TTLM description Miri Korenblit
@ 2024-03-18 16:53 ` Miri Korenblit
  2024-03-18 16:53 ` [PATCH 07/15] wifi: mac80211: handle indoor AFC/LPI AP on assoc success Miri Korenblit
                   ` (8 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Miri Korenblit @ 2024-03-18 16:53 UTC (permalink / raw)
  To: johannes; +Cc: linux-wireless, Ayala Beker, Johannes Berg, Ilan Peer

From: Ayala Beker <ayala.beker@intel.com>

Fix ieee80211_ttlm_set_links() to not set all active links,
but instead let the driver know that valid links status changed
and select the active links properly.

Fixes: 8f500fbc6c65 ("wifi: mac80211: process and save negotiated TID to Link mapping request")
Signed-off-by: Ayala Beker <ayala.beker@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Reviewed-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
---
 net/mac80211/mlme.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 47a2cba8313f..30cba84e7053 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -5874,6 +5874,15 @@ static int ieee80211_ttlm_set_links(struct ieee80211_sub_if_data *sdata,
 	}
 
 	if (sdata->vif.active_links != active_links) {
+		/* usable links are affected when active_links are changed,
+		 * so notify the driver about the status change
+		 */
+		changed |= BSS_CHANGED_MLD_VALID_LINKS;
+		active_links &= sdata->vif.active_links;
+		if (!active_links)
+			active_links =
+				BIT(__ffs(sdata->vif.valid_links &
+				    ~dormant_links));
 		ret = ieee80211_set_active_links(&sdata->vif, active_links);
 		if (ret) {
 			sdata_info(sdata, "Failed to set TTLM active links\n");
@@ -5888,7 +5897,6 @@ static int ieee80211_ttlm_set_links(struct ieee80211_sub_if_data *sdata,
 		goto out;
 	}
 
-	changed |= BSS_CHANGED_MLD_VALID_LINKS;
 	sdata->vif.suspended_links = suspended_links;
 	if (sdata->vif.suspended_links)
 		changed |= BSS_CHANGED_MLD_TTLM;
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 07/15] wifi: mac80211: handle indoor AFC/LPI AP on assoc success
  2024-03-18 16:53 [PATCH 00/15] cfg80211/mac80211 patches from our internal tree 2024-03-18 Miri Korenblit
                   ` (5 preceding siblings ...)
  2024-03-18 16:53 ` [PATCH 06/15] wifi: mac80211: correctly set active links upon TTLM Miri Korenblit
@ 2024-03-18 16:53 ` Miri Korenblit
  2024-03-18 16:53 ` [PATCH 08/15] wifi: cfg80211: handle indoor AFC/LPI AP in probe response and beacon Miri Korenblit
                   ` (7 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Miri Korenblit @ 2024-03-18 16:53 UTC (permalink / raw)
  To: johannes; +Cc: linux-wireless, Anjaneyulu

From: Anjaneyulu <pagadala.yesu.anjaneyulu@intel.com>

Update power_type in bss_conf based on Indoor AFC and LPI power types
received in HE 6 GHz operation element on assoc success.

Signed-off-by: Anjaneyulu <pagadala.yesu.anjaneyulu@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
---
 include/linux/ieee80211.h | 8 +++++---
 net/mac80211/mlme.c       | 2 ++
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index 4fd9735bb75e..7f9b829dcb1e 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -2742,9 +2742,11 @@ static inline bool ieee80211_he_capa_size_ok(const u8 *data, u8 len)
 #define IEEE80211_HE_OPERATION_PARTIAL_BSS_COLOR		0x40000000
 #define IEEE80211_HE_OPERATION_BSS_COLOR_DISABLED		0x80000000
 
-#define IEEE80211_6GHZ_CTRL_REG_LPI_AP	0
-#define IEEE80211_6GHZ_CTRL_REG_SP_AP	1
-#define IEEE80211_6GHZ_CTRL_REG_VLP_AP	2
+#define IEEE80211_6GHZ_CTRL_REG_LPI_AP		0
+#define IEEE80211_6GHZ_CTRL_REG_SP_AP		1
+#define IEEE80211_6GHZ_CTRL_REG_VLP_AP		2
+#define IEEE80211_6GHZ_CTRL_REG_INDOOR_LPI_AP	3
+#define IEEE80211_6GHZ_CTRL_REG_INDOOR_SP_AP	4
 
 /**
  * struct ieee80211_he_6ghz_oper - HE 6 GHz operation Information field
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 30cba84e7053..a0f9fdc8b0d3 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -4429,9 +4429,11 @@ static bool ieee80211_assoc_config_link(struct ieee80211_link_data *link,
 			switch (u8_get_bits(he_6ghz_oper->control,
 					    IEEE80211_HE_6GHZ_OPER_CTRL_REG_INFO)) {
 			case IEEE80211_6GHZ_CTRL_REG_LPI_AP:
+			case IEEE80211_6GHZ_CTRL_REG_INDOOR_LPI_AP:
 				bss_conf->power_type = IEEE80211_REG_LPI_AP;
 				break;
 			case IEEE80211_6GHZ_CTRL_REG_SP_AP:
+			case IEEE80211_6GHZ_CTRL_REG_INDOOR_SP_AP:
 				bss_conf->power_type = IEEE80211_REG_SP_AP;
 				break;
 			case IEEE80211_6GHZ_CTRL_REG_VLP_AP:
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 08/15] wifi: cfg80211: handle indoor AFC/LPI AP in probe response and beacon
  2024-03-18 16:53 [PATCH 00/15] cfg80211/mac80211 patches from our internal tree 2024-03-18 Miri Korenblit
                   ` (6 preceding siblings ...)
  2024-03-18 16:53 ` [PATCH 07/15] wifi: mac80211: handle indoor AFC/LPI AP on assoc success Miri Korenblit
@ 2024-03-18 16:53 ` Miri Korenblit
  2024-03-18 16:53 ` [PATCH 09/15] wifi: mac80211: add flag to disallow puncturing in 5 GHz Miri Korenblit
                   ` (6 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Miri Korenblit @ 2024-03-18 16:53 UTC (permalink / raw)
  To: johannes; +Cc: linux-wireless, Anjaneyulu

From: Anjaneyulu <pagadala.yesu.anjaneyulu@intel.com>

Mark Indoor LPI and Indoor AFC power types as valid based on channel flags.
While on it, added default case.

Signed-off-by: Anjaneyulu <pagadala.yesu.anjaneyulu@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
---
 net/wireless/scan.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/net/wireless/scan.c b/net/wireless/scan.c
index 5a5dd3ce497f..b55ffe73e1ef 100644
--- a/net/wireless/scan.c
+++ b/net/wireless/scan.c
@@ -2140,11 +2140,15 @@ static bool cfg80211_6ghz_power_type_valid(const u8 *ie, size_t ielen,
 		switch (u8_get_bits(he_6ghz_oper->control,
 				    IEEE80211_HE_6GHZ_OPER_CTRL_REG_INFO)) {
 		case IEEE80211_6GHZ_CTRL_REG_LPI_AP:
+		case IEEE80211_6GHZ_CTRL_REG_INDOOR_LPI_AP:
 			return true;
 		case IEEE80211_6GHZ_CTRL_REG_SP_AP:
+		case IEEE80211_6GHZ_CTRL_REG_INDOOR_SP_AP:
 			return !(flags & IEEE80211_CHAN_NO_6GHZ_AFC_CLIENT);
 		case IEEE80211_6GHZ_CTRL_REG_VLP_AP:
 			return !(flags & IEEE80211_CHAN_NO_6GHZ_VLP_CLIENT);
+		default:
+			return false;
 		}
 	}
 	return false;
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 09/15] wifi: mac80211: add flag to disallow puncturing in 5 GHz
  2024-03-18 16:53 [PATCH 00/15] cfg80211/mac80211 patches from our internal tree 2024-03-18 Miri Korenblit
                   ` (7 preceding siblings ...)
  2024-03-18 16:53 ` [PATCH 08/15] wifi: cfg80211: handle indoor AFC/LPI AP in probe response and beacon Miri Korenblit
@ 2024-03-18 16:53 ` Miri Korenblit
  2024-03-18 16:53 ` [PATCH 10/15] wifi: mac80211: parse puncturing bitmap in 6 GHz Miri Korenblit
                   ` (5 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Miri Korenblit @ 2024-03-18 16:53 UTC (permalink / raw)
  To: johannes; +Cc: linux-wireless, Johannes Berg

From: Johannes Berg <johannes.berg@intel.com>

Some devices may not be capable of handling puncturing in 5 GHz
only (vs. the current flag that just removes puncturing support
completely). Add a flag to support such devices: check and then
downgrade the channel width if needed.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
---
 include/net/mac80211.h | 3 +++
 net/mac80211/debugfs.c | 1 +
 net/mac80211/mlme.c    | 4 ++++
 3 files changed, 8 insertions(+)

diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 757ec33882c2..88bb781f33f6 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -2779,6 +2779,8 @@ struct ieee80211_txq {
  *
  * @IEEE80211_HW_DISALLOW_PUNCTURING: HW requires disabling puncturing in EHT
  *	and connecting with a lower bandwidth instead
+ * @IEEE80211_HW_DISALLOW_PUNCTURING_5GHZ: HW requires disabling puncturing in
+ *	EHT in 5 GHz and connecting with a lower bandwidth instead
  *
  * @IEEE80211_HW_HANDLES_QUIET_CSA: HW/driver handles quieting for CSA, so
  *	no need to stop queues. This really should be set by a driver that
@@ -2843,6 +2845,7 @@ enum ieee80211_hw_flags {
 	IEEE80211_HW_DETECTS_COLOR_COLLISION,
 	IEEE80211_HW_MLO_MCAST_MULTI_LINK_TX,
 	IEEE80211_HW_DISALLOW_PUNCTURING,
+	IEEE80211_HW_DISALLOW_PUNCTURING_5GHZ,
 	IEEE80211_HW_HANDLES_QUIET_CSA,
 
 	/* keep last, obviously */
diff --git a/net/mac80211/debugfs.c b/net/mac80211/debugfs.c
index 2f68e92a7404..98310188f330 100644
--- a/net/mac80211/debugfs.c
+++ b/net/mac80211/debugfs.c
@@ -498,6 +498,7 @@ static const char *hw_flag_names[] = {
 	FLAG(DETECTS_COLOR_COLLISION),
 	FLAG(MLO_MCAST_MULTI_LINK_TX),
 	FLAG(DISALLOW_PUNCTURING),
+	FLAG(DISALLOW_PUNCTURING_5GHZ),
 	FLAG(HANDLES_QUIET_CSA),
 #undef FLAG
 };
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index a0f9fdc8b0d3..958ff328a6c1 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -599,6 +599,10 @@ static bool ieee80211_chandef_usable(struct ieee80211_sub_if_data *sdata,
 	    ieee80211_hw_check(&sdata->local->hw, DISALLOW_PUNCTURING))
 		return false;
 
+	if (chandef->punctured && chandef->chan->band == NL80211_BAND_5GHZ &&
+	    ieee80211_hw_check(&sdata->local->hw, DISALLOW_PUNCTURING_5GHZ))
+		return false;
+
 	return true;
 }
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 10/15] wifi: mac80211: parse puncturing bitmap in 6 GHz
  2024-03-18 16:53 [PATCH 00/15] cfg80211/mac80211 patches from our internal tree 2024-03-18 Miri Korenblit
                   ` (8 preceding siblings ...)
  2024-03-18 16:53 ` [PATCH 09/15] wifi: mac80211: add flag to disallow puncturing in 5 GHz Miri Korenblit
@ 2024-03-18 16:53 ` Miri Korenblit
  2024-03-18 16:53 ` [PATCH 11/15] wifi: mac80211: improve association error reporting slightly Miri Korenblit
                   ` (4 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Miri Korenblit @ 2024-03-18 16:53 UTC (permalink / raw)
  To: johannes; +Cc: linux-wireless, Johannes Berg

From: Johannes Berg <johannes.berg@intel.com>

In ieee80211_chandef_he_6ghz_oper(), the HE/EHT information for
the 6 GHz channel is parsed, but ieee80211_chandef_eht_oper()
calls must be paired with extracting the puncturing bitmap. Fix
this.

Fixes: b82730bf57b5 ("wifi: cfg80211/mac80211: move puncturing into chandef")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
---
 net/mac80211/util.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index a237cbcf7b49..a5d5e05688b4 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -3136,6 +3136,8 @@ bool ieee80211_chandef_he_6ghz_oper(struct ieee80211_local *local,
 	} else {
 		ieee80211_chandef_eht_oper((const void *)eht_oper->optional,
 					   &he_chandef);
+		he_chandef.punctured =
+			ieee80211_eht_oper_dis_subchan_bitmap(eht_oper);
 	}
 
 	if (!cfg80211_chandef_valid(&he_chandef))
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 11/15] wifi: mac80211: improve association error reporting slightly
  2024-03-18 16:53 [PATCH 00/15] cfg80211/mac80211 patches from our internal tree 2024-03-18 Miri Korenblit
                   ` (9 preceding siblings ...)
  2024-03-18 16:53 ` [PATCH 10/15] wifi: mac80211: parse puncturing bitmap in 6 GHz Miri Korenblit
@ 2024-03-18 16:53 ` Miri Korenblit
  2024-03-18 16:53 ` [PATCH 12/15] wifi: cfg80211: check BSSID Index against MaxBSSID Miri Korenblit
                   ` (3 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Miri Korenblit @ 2024-03-18 16:53 UTC (permalink / raw)
  To: johannes; +Cc: linux-wireless, Benjamin Berg, Johannes Berg

From: Benjamin Berg <benjamin.berg@intel.com>

There is no reason to check the request flags for each of the links, so
pull that out of the loop. Also, within the loop we can set the per-link
error everywhere.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
---
 net/mac80211/mlme.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 958ff328a6c1..2434023317e9 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -8214,6 +8214,14 @@ int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata,
 	if (req->ap_mld_addr) {
 		uapsd_supported = true;
 
+		if (req->flags & (ASSOC_REQ_DISABLE_HT |
+				  ASSOC_REQ_DISABLE_VHT |
+				  ASSOC_REQ_DISABLE_HE |
+				  ASSOC_REQ_DISABLE_EHT)) {
+			err = -EINVAL;
+			goto err_free;
+		}
+
 		for (i = 0; i < IEEE80211_MLD_MAX_NUM_LINKS; i++) {
 			struct ieee80211_supported_band *sband;
 			struct cfg80211_bss *link_cbss = req->links[i].bss;
@@ -8226,19 +8234,13 @@ int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata,
 
 			if (!bss->wmm_used) {
 				err = -EINVAL;
-				goto err_free;
-			}
-
-			if (req->flags & (ASSOC_REQ_DISABLE_HT |
-					  ASSOC_REQ_DISABLE_VHT |
-					  ASSOC_REQ_DISABLE_HE |
-					  ASSOC_REQ_DISABLE_EHT)) {
-				err = -EINVAL;
+				req->links[i].error = err;
 				goto err_free;
 			}
 
 			if (link_cbss->channel->band == NL80211_BAND_S1GHZ) {
 				err = -EINVAL;
+				req->links[i].error = err;
 				goto err_free;
 			}
 
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 12/15] wifi: cfg80211: check BSSID Index against MaxBSSID
  2024-03-18 16:53 [PATCH 00/15] cfg80211/mac80211 patches from our internal tree 2024-03-18 Miri Korenblit
                   ` (10 preceding siblings ...)
  2024-03-18 16:53 ` [PATCH 11/15] wifi: mac80211: improve association error reporting slightly Miri Korenblit
@ 2024-03-18 16:53 ` Miri Korenblit
  2024-03-18 16:53 ` [PATCH 13/15] wifi: cfg80211: ignore non-TX BSSs in per-STA profile Miri Korenblit
                   ` (2 subsequent siblings)
  14 siblings, 0 replies; 16+ messages in thread
From: Miri Korenblit @ 2024-03-18 16:53 UTC (permalink / raw)
  To: johannes; +Cc: linux-wireless, Benjamin Berg, Johannes Berg

From: Benjamin Berg <benjamin.berg@intel.com>

Add a verification that the BSSID Index does not exceed the maximum
number of BSSIDs in the Multiple-BSSID set.

Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
---
 net/wireless/scan.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/wireless/scan.c b/net/wireless/scan.c
index b55ffe73e1ef..8ac2d19d8ede 100644
--- a/net/wireless/scan.c
+++ b/net/wireless/scan.c
@@ -2447,7 +2447,8 @@ cfg80211_parse_mbssid_data(struct wiphy *wiphy,
 				 profile, profile_len);
 			if (!mbssid_index_ie || mbssid_index_ie[1] < 1 ||
 			    mbssid_index_ie[2] == 0 ||
-			    mbssid_index_ie[2] > 46) {
+			    mbssid_index_ie[2] > 46 ||
+			    mbssid_index_ie[2] >= (1 << elem->data[0])) {
 				/* No valid Multiple BSSID-Index element */
 				continue;
 			}
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 13/15] wifi: cfg80211: ignore non-TX BSSs in per-STA profile
  2024-03-18 16:53 [PATCH 00/15] cfg80211/mac80211 patches from our internal tree 2024-03-18 Miri Korenblit
                   ` (11 preceding siblings ...)
  2024-03-18 16:53 ` [PATCH 12/15] wifi: cfg80211: check BSSID Index against MaxBSSID Miri Korenblit
@ 2024-03-18 16:53 ` Miri Korenblit
  2024-03-18 16:53 ` [PATCH 14/15] wifi: mac80211: fix prep_connection error path Miri Korenblit
  2024-03-18 16:53 ` [PATCH 15/15] wifi: mac80211: add support for tearing down negotiated TTLM Miri Korenblit
  14 siblings, 0 replies; 16+ messages in thread
From: Miri Korenblit @ 2024-03-18 16:53 UTC (permalink / raw)
  To: johannes; +Cc: linux-wireless, Benjamin Berg, Johannes Berg

From: Benjamin Berg <benjamin.berg@intel.com>

If a non-TX BSS is included in a per-STA profile, then we cannot set
transmitted_bss for it. Even worse, if we do things properly we should
be configuring both bssid_index and max_bssid_indicator correctly. We do
not actually have both pieces of information (and, some APs currently
do not include either).

So, ignore any per-STA profile where the RNR says that the BSS is not
transmitted. Also fix transmitted_bss to never be set for per-STA
profiles.

This fixes issues where mac80211 was setting the reference BSSID to an
incorrect value.

Fixes: 2481b5da9c6b ("wifi: cfg80211: handle BSS data contained in ML probe responses")
Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
---
 net/wireless/scan.c | 47 ++++++++++++++++++++++++++++++++++++---------
 1 file changed, 38 insertions(+), 9 deletions(-)

diff --git a/net/wireless/scan.c b/net/wireless/scan.c
index 8ac2d19d8ede..127853877a0a 100644
--- a/net/wireless/scan.c
+++ b/net/wireless/scan.c
@@ -2211,12 +2211,16 @@ cfg80211_inform_single_bss_data(struct wiphy *wiphy,
 	tmp.pub.use_for = data->use_for;
 	tmp.pub.cannot_use_reasons = data->cannot_use_reasons;
 
-	if (data->bss_source != BSS_SOURCE_DIRECT) {
+	switch (data->bss_source) {
+	case BSS_SOURCE_MBSSID:
 		tmp.pub.transmitted_bss = data->source_bss;
+		fallthrough;
+	case BSS_SOURCE_STA_PROFILE:
 		ts = bss_from_pub(data->source_bss)->ts;
 		tmp.pub.bssid_index = data->bssid_index;
 		tmp.pub.max_bssid_indicator = data->max_bssid_indicator;
-	} else {
+		break;
+	case BSS_SOURCE_DIRECT:
 		ts = jiffies;
 
 		if (channel->band == NL80211_BAND_60GHZ) {
@@ -2231,6 +2235,7 @@ cfg80211_inform_single_bss_data(struct wiphy *wiphy,
 				regulatory_hint_found_beacon(wiphy, channel,
 							     gfp);
 		}
+		break;
 	}
 
 	/*
@@ -2660,6 +2665,7 @@ struct tbtt_info_iter_data {
 	u8 param_ch_count;
 	u32 use_for;
 	u8 mld_id, link_id;
+	bool non_tx;
 };
 
 static enum cfg80211_rnr_iter_ret
@@ -2670,14 +2676,20 @@ cfg802121_mld_ap_rnr_iter(void *_data, u8 type,
 	const struct ieee80211_rnr_mld_params *mld_params;
 	struct tbtt_info_iter_data *data = _data;
 	u8 link_id;
+	bool non_tx = false;
 
 	if (type == IEEE80211_TBTT_INFO_TYPE_TBTT &&
 	    tbtt_info_len >= offsetofend(struct ieee80211_tbtt_info_ge_11,
-					 mld_params))
-		mld_params = (void *)(tbtt_info +
-				      offsetof(struct ieee80211_tbtt_info_ge_11,
-					       mld_params));
-	else if (type == IEEE80211_TBTT_INFO_TYPE_MLD &&
+					 mld_params)) {
+		const struct ieee80211_tbtt_info_ge_11 *tbtt_info_ge_11 =
+			(void *)tbtt_info;
+
+		non_tx = (tbtt_info_ge_11->bss_params &
+			  (IEEE80211_RNR_TBTT_PARAMS_MULTI_BSSID |
+			   IEEE80211_RNR_TBTT_PARAMS_TRANSMITTED_BSSID)) ==
+			 IEEE80211_RNR_TBTT_PARAMS_MULTI_BSSID;
+		mld_params = &tbtt_info_ge_11->mld_params;
+	} else if (type == IEEE80211_TBTT_INFO_TYPE_MLD &&
 		 tbtt_info_len >= sizeof(struct ieee80211_rnr_mld_params))
 		mld_params = (void *)tbtt_info;
 	else
@@ -2696,6 +2708,7 @@ cfg802121_mld_ap_rnr_iter(void *_data, u8 type,
 	data->param_ch_count =
 		le16_get_bits(mld_params->params,
 			      IEEE80211_RNR_MLD_PARAMS_BSS_CHANGE_COUNT);
+	data->non_tx = non_tx;
 
 	if (type == IEEE80211_TBTT_INFO_TYPE_TBTT)
 		data->use_for = NL80211_BSS_USE_FOR_ALL;
@@ -2707,7 +2720,7 @@ cfg802121_mld_ap_rnr_iter(void *_data, u8 type,
 static u8
 cfg80211_rnr_info_for_mld_ap(const u8 *ie, size_t ielen, u8 mld_id, u8 link_id,
 			     const struct ieee80211_neighbor_ap_info **ap_info,
-			     u8 *param_ch_count)
+			     u8 *param_ch_count, bool *non_tx)
 {
 	struct tbtt_info_iter_data data = {
 		.mld_id = mld_id,
@@ -2718,6 +2731,7 @@ cfg80211_rnr_info_for_mld_ap(const u8 *ie, size_t ielen, u8 mld_id, u8 link_id,
 
 	*ap_info = data.ap_info;
 	*param_ch_count = data.param_ch_count;
+	*non_tx = data.non_tx;
 
 	return data.use_for;
 }
@@ -2897,6 +2911,7 @@ cfg80211_parse_ml_elem_sta_data(struct wiphy *wiphy,
 		ssize_t profile_len;
 		u8 param_ch_count;
 		u8 link_id, use_for;
+		bool non_tx;
 
 		if (!ieee80211_mle_basic_sta_prof_size_ok((u8 *)mle->sta_prof[i],
 							  mle->sta_prof_len[i]))
@@ -2942,10 +2957,24 @@ cfg80211_parse_ml_elem_sta_data(struct wiphy *wiphy,
 						       tx_data->ielen,
 						       mld_id, link_id,
 						       &ap_info,
-						       &param_ch_count);
+						       &param_ch_count,
+						       &non_tx);
 		if (!use_for)
 			continue;
 
+		/*
+		 * As of 802.11be_D5.0, the specification does not give us any
+		 * way of discovering both the MaxBSSID and the Multiple-BSSID
+		 * Index. It does seem like the Multiple-BSSID Index element
+		 * may be provided, but section 9.4.2.45 explicitly forbids
+		 * including a Multiple-BSSID Element (in this case without any
+		 * subelements).
+		 * Without both pieces of information we cannot calculate the
+		 * reference BSSID, so simply ignore the BSS.
+		 */
+		if (non_tx)
+			continue;
+
 		/* We could sanity check the BSSID is included */
 
 		if (!ieee80211_operating_class_to_band(ap_info->op_class,
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 14/15] wifi: mac80211: fix prep_connection error path
  2024-03-18 16:53 [PATCH 00/15] cfg80211/mac80211 patches from our internal tree 2024-03-18 Miri Korenblit
                   ` (12 preceding siblings ...)
  2024-03-18 16:53 ` [PATCH 13/15] wifi: cfg80211: ignore non-TX BSSs in per-STA profile Miri Korenblit
@ 2024-03-18 16:53 ` Miri Korenblit
  2024-03-18 16:53 ` [PATCH 15/15] wifi: mac80211: add support for tearing down negotiated TTLM Miri Korenblit
  14 siblings, 0 replies; 16+ messages in thread
From: Miri Korenblit @ 2024-03-18 16:53 UTC (permalink / raw)
  To: johannes; +Cc: linux-wireless, Johannes Berg

From: Johannes Berg <johannes.berg@intel.com>

If prep_channel fails in prep_connection, the code releases
the deflink's chanctx, which is wrong since we may be using
a different link. It's already wrong to even do that always
though, since we might still have the station. Remove it
only if prep_channel succeeded and later updates fail.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
---
 net/mac80211/mlme.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 2434023317e9..082fe2bf14fd 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -7666,7 +7666,7 @@ static int ieee80211_prep_connection(struct ieee80211_sub_if_data *sdata,
 			sdata_info(sdata,
 				   "failed to insert STA entry for the AP (error %d)\n",
 				   err);
-			goto out_err;
+			goto out_release_chan;
 		}
 	} else
 		WARN_ON_ONCE(!ether_addr_equal(link->u.mgd.bssid, cbss->bssid));
@@ -7677,8 +7677,9 @@ static int ieee80211_prep_connection(struct ieee80211_sub_if_data *sdata,
 
 	return 0;
 
+out_release_chan:
+	ieee80211_link_release_channel(link);
 out_err:
-	ieee80211_link_release_channel(&sdata->deflink);
 	ieee80211_vif_set_links(sdata, 0, 0);
 	return err;
 }
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 15/15] wifi: mac80211: add support for tearing down negotiated TTLM
  2024-03-18 16:53 [PATCH 00/15] cfg80211/mac80211 patches from our internal tree 2024-03-18 Miri Korenblit
                   ` (13 preceding siblings ...)
  2024-03-18 16:53 ` [PATCH 14/15] wifi: mac80211: fix prep_connection error path Miri Korenblit
@ 2024-03-18 16:53 ` Miri Korenblit
  14 siblings, 0 replies; 16+ messages in thread
From: Miri Korenblit @ 2024-03-18 16:53 UTC (permalink / raw)
  To: johannes; +Cc: linux-wireless, Ayala Beker, Johannes Berg

From: Ayala Beker <ayala.beker@intel.com>

In order to activate a link that is currently inactive due to
a negotiated TTLM request, need to first tear down the negotiated
TTLM request.
Add support for sending TTLM teardown request and update the links
state accordingly.

Signed-off-by: Ayala Beker <ayala.beker@intel.com>
Reviewed-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
---
 include/net/mac80211.h     |  9 ++++++
 net/mac80211/ieee80211_i.h |  2 ++
 net/mac80211/mlme.c        | 58 ++++++++++++++++++++++++++++++++++++++
 net/mac80211/status.c      | 22 ++++++++++++++-
 4 files changed, 90 insertions(+), 1 deletion(-)

diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 88bb781f33f6..f57c29de3a91 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -7591,6 +7591,15 @@ int ieee80211_set_active_links(struct ieee80211_vif *vif, u16 active_links);
 void ieee80211_set_active_links_async(struct ieee80211_vif *vif,
 				      u16 active_links);
 
+/**
+ * ieee80211_send_teardown_neg_ttlm - tear down a negotiated TTLM request
+ * @vif: the interface on which the tear down request should be sent.
+ *
+ * This function can be used to tear down a previously accepted negotiated
+ * TTLM request.
+ */
+void ieee80211_send_teardown_neg_ttlm(struct ieee80211_vif *vif);
+
 /* for older drivers - let's not document these ... */
 int ieee80211_emulate_add_chanctx(struct ieee80211_hw *hw,
 				  struct ieee80211_chanctx_conf *ctx);
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index b6fead612b66..925e875f9b96 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -89,6 +89,7 @@ enum ieee80211_status_data {
 	IEEE80211_STATUS_TYPE_MASK	= 0x00f,
 	IEEE80211_STATUS_TYPE_INVALID	= 0,
 	IEEE80211_STATUS_TYPE_SMPS	= 1,
+	IEEE80211_STATUS_TYPE_NEG_TTLM	= 2,
 	IEEE80211_STATUS_SUBDATA_MASK	= 0xff0,
 };
 
@@ -595,6 +596,7 @@ struct ieee80211_if_managed {
 	/* TID-to-link mapping support */
 	struct wiphy_delayed_work ttlm_work;
 	struct ieee80211_adv_ttlm_info ttlm_info;
+	struct wiphy_work teardown_ttlm_work;
 
 	/* dialog token enumerator for neg TTLM request */
 	u8 dialog_token_alloc;
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 082fe2bf14fd..cd4b54e02653 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -6798,6 +6798,60 @@ void ieee80211_process_neg_ttlm_res(struct ieee80211_sub_if_data *sdata,
 		__ieee80211_disconnect(sdata);
 }
 
+static void ieee80211_teardown_ttlm_work(struct wiphy *wiphy,
+					 struct wiphy_work *work)
+{
+	u16 new_dormant_links;
+	struct ieee80211_sub_if_data *sdata =
+		container_of(work, struct ieee80211_sub_if_data,
+			     u.mgd.neg_ttlm_timeout_work.work);
+
+	if (!sdata->vif.neg_ttlm.valid)
+		return;
+
+	memset(&sdata->vif.neg_ttlm, 0, sizeof(sdata->vif.neg_ttlm));
+	new_dormant_links =
+		sdata->vif.dormant_links & ~sdata->vif.suspended_links;
+	sdata->vif.suspended_links = 0;
+	ieee80211_vif_set_links(sdata, sdata->vif.valid_links,
+				new_dormant_links);
+	ieee80211_vif_cfg_change_notify(sdata, BSS_CHANGED_MLD_TTLM |
+					       BSS_CHANGED_MLD_VALID_LINKS);
+}
+
+void ieee80211_send_teardown_neg_ttlm(struct ieee80211_vif *vif)
+{
+	struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif);
+	struct ieee80211_local *local = sdata->local;
+	struct ieee80211_mgmt *mgmt;
+	struct sk_buff *skb;
+	int frame_len = offsetofend(struct ieee80211_mgmt,
+				  u.action.u.ttlm_tear_down);
+	struct ieee80211_tx_info *info;
+
+	skb = dev_alloc_skb(local->hw.extra_tx_headroom + frame_len);
+	if (!skb)
+		return;
+
+	skb_reserve(skb, local->hw.extra_tx_headroom);
+	mgmt = skb_put_zero(skb, frame_len);
+	mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT |
+					  IEEE80211_STYPE_ACTION);
+	memcpy(mgmt->da, sdata->vif.cfg.ap_addr, ETH_ALEN);
+	memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN);
+	memcpy(mgmt->bssid, sdata->vif.cfg.ap_addr, ETH_ALEN);
+
+	mgmt->u.action.category = WLAN_CATEGORY_PROTECTED_EHT;
+	mgmt->u.action.u.ttlm_tear_down.action_code =
+		WLAN_PROTECTED_EHT_ACTION_TTLM_TEARDOWN;
+
+	info = IEEE80211_SKB_CB(skb);
+	info->flags |= IEEE80211_TX_CTL_REQ_TX_STATUS;
+	info->status_data = IEEE80211_STATUS_TYPE_NEG_TTLM;
+	ieee80211_tx_skb(sdata, skb);
+}
+EXPORT_SYMBOL(ieee80211_send_teardown_neg_ttlm);
+
 void ieee80211_sta_rx_queued_ext(struct ieee80211_sub_if_data *sdata,
 				 struct sk_buff *skb)
 {
@@ -7429,6 +7483,8 @@ void ieee80211_sta_setup_sdata(struct ieee80211_sub_if_data *sdata)
 				ieee80211_tid_to_link_map_work);
 	wiphy_delayed_work_init(&ifmgd->neg_ttlm_timeout_work,
 				ieee80211_neg_ttlm_timeout_work);
+	wiphy_work_init(&ifmgd->teardown_ttlm_work,
+			ieee80211_teardown_ttlm_work);
 
 	ifmgd->flags = 0;
 	ifmgd->powersave = sdata->wdev.ps;
@@ -8618,6 +8674,8 @@ void ieee80211_mgd_stop(struct ieee80211_sub_if_data *sdata)
 			  &ifmgd->beacon_connection_loss_work);
 	wiphy_work_cancel(sdata->local->hw.wiphy,
 			  &ifmgd->csa_connection_drop_work);
+	wiphy_work_cancel(sdata->local->hw.wiphy,
+			  &ifmgd->teardown_ttlm_work);
 	wiphy_delayed_work_cancel(sdata->local->hw.wiphy,
 				  &ifmgd->tdls_peer_del_work);
 	wiphy_delayed_work_cancel(sdata->local->hw.wiphy,
diff --git a/net/mac80211/status.c b/net/mac80211/status.c
index 1708b33cdc5e..dd8f857a1fbc 100644
--- a/net/mac80211/status.c
+++ b/net/mac80211/status.c
@@ -5,7 +5,7 @@
  * Copyright 2006-2007	Jiri Benc <jbenc@suse.cz>
  * Copyright 2008-2010	Johannes Berg <johannes@sipsolutions.net>
  * Copyright 2013-2014  Intel Mobile Communications GmbH
- * Copyright 2021-2023  Intel Corporation
+ * Copyright 2021-2024  Intel Corporation
  */
 
 #include <linux/export.h>
@@ -696,6 +696,23 @@ static void ieee80211_handle_smps_status(struct ieee80211_sub_if_data *sdata,
 	wiphy_work_queue(sdata->local->hw.wiphy, &link->u.mgd.recalc_smps);
 }
 
+static void
+ieee80211_handle_teardown_ttlm_status(struct ieee80211_sub_if_data *sdata,
+				      bool acked)
+{
+	if (!sdata || !ieee80211_sdata_running(sdata))
+		return;
+
+	if (!acked)
+		return;
+
+	if (sdata->vif.type != NL80211_IFTYPE_STATION)
+		return;
+
+	wiphy_work_queue(sdata->local->hw.wiphy,
+			 &sdata->u.mgd.teardown_ttlm_work);
+}
+
 static void ieee80211_report_used_skb(struct ieee80211_local *local,
 				      struct sk_buff *skb, bool dropped,
 				      ktime_t ack_hwtstamp)
@@ -773,6 +790,9 @@ static void ieee80211_report_used_skb(struct ieee80211_local *local,
 			ieee80211_handle_smps_status(sdata, acked,
 						     info->status_data);
 			break;
+		case IEEE80211_STATUS_TYPE_NEG_TTLM:
+			ieee80211_handle_teardown_ttlm_status(sdata, acked);
+			break;
 		}
 		rcu_read_unlock();
 	}
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2024-03-18 16:54 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-18 16:53 [PATCH 00/15] cfg80211/mac80211 patches from our internal tree 2024-03-18 Miri Korenblit
2024-03-18 16:53 ` [PATCH 01/15] wifi: ieee80211: check for NULL in ieee80211_mle_size_ok() Miri Korenblit
2024-03-18 16:53 ` [PATCH 02/15] wifi: ieee80211: fix ieee80211_mle_basic_sta_prof_size_ok() Miri Korenblit
2024-03-18 16:53 ` [PATCH 03/15] wifi: mac80211_hwsim: move skip_beacons to be per link Miri Korenblit
2024-03-18 16:53 ` [PATCH 04/15] wifi: mac80211: clarify the dormant/suspended links docs Miri Korenblit
2024-03-18 16:53 ` [PATCH 05/15] wifi: mac80211: fix BSS_CHANGED_MLD_TTLM description Miri Korenblit
2024-03-18 16:53 ` [PATCH 06/15] wifi: mac80211: correctly set active links upon TTLM Miri Korenblit
2024-03-18 16:53 ` [PATCH 07/15] wifi: mac80211: handle indoor AFC/LPI AP on assoc success Miri Korenblit
2024-03-18 16:53 ` [PATCH 08/15] wifi: cfg80211: handle indoor AFC/LPI AP in probe response and beacon Miri Korenblit
2024-03-18 16:53 ` [PATCH 09/15] wifi: mac80211: add flag to disallow puncturing in 5 GHz Miri Korenblit
2024-03-18 16:53 ` [PATCH 10/15] wifi: mac80211: parse puncturing bitmap in 6 GHz Miri Korenblit
2024-03-18 16:53 ` [PATCH 11/15] wifi: mac80211: improve association error reporting slightly Miri Korenblit
2024-03-18 16:53 ` [PATCH 12/15] wifi: cfg80211: check BSSID Index against MaxBSSID Miri Korenblit
2024-03-18 16:53 ` [PATCH 13/15] wifi: cfg80211: ignore non-TX BSSs in per-STA profile Miri Korenblit
2024-03-18 16:53 ` [PATCH 14/15] wifi: mac80211: fix prep_connection error path Miri Korenblit
2024-03-18 16:53 ` [PATCH 15/15] wifi: mac80211: add support for tearing down negotiated TTLM Miri Korenblit

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).