Skip to contentSkip to conversation

wifi: ath12k: MLO support part 2

PATCH Applied Kalle Valo 2 participants 20 messages Nov 1, 2024 – Nov 4, 2024 Qualcomm ATH12K wireless driver

lore
Share & tools
lore

Kalle Valo

author
#0 lore raw

v2 cover wifi: ath12k: MLO support part 2

From: Kalle Valo <[email protected]>

Here we continue to refactor mac.c to support multiple links and extend peer assoc WMI command to support MLO.

Please review.

v2:

* patch 1: use err_vdev_del

* patch 2: ath12k_mac_mlo_get_vdev_args(): switch
wiphy_dereference()

* patch 2: use struct ath12k_wmi_mac_addr_params instead adding struct wmi_mac_addr

* patch 3: ath12k_mac_station_post_remove(): assign ahsta->links_map before rcu_assign_pointer()

* patch 3: ath12k_mac_station_unauthorize(): fi* confusing comment about __sta_info_destroy_part2()

* patch 4: debugfs.c: copyright year

* patch 5: ath12k_peer_mlo_create(): remove parenthesis from the warning message

* patch 5: ATH12K_ML_PEER_ID_VALID: move to peer.h and rename to ATH12K_PEER_ML_ID_VALID

* patch 5: rename struct ath12k_peer::ml_peer_id to peer_id

* patch 5: use ath12k_peer_ml_*() naming style in peer.c

* patch 7: improve commit message a bit

* patch 7: struct wmi_peer_assoc_mlo_partner_info: add _params to name

v1: https://patchwork.kernel.org/project/linux-wireless/cover/[email protected]/

Kalle Valo (2):
wifi: ath12k: ath12k_mac_vdev_create(): use goto for error handling
wifi: ath12k: introduce ath12k_hw_warn()

Sriram R (6):
wifi: ath12k: MLO vdev bringup changes
wifi: ath12k: Refactor sta state machine
wifi: ath12k: Add helpers for multi link peer creation and deletion
wifi: ath12k: add multi-link flag in peer create command
wifi: ath12k: add helper to find multi-link station
wifi: ath12k: Add MLO peer assoc command support

 drivers/net/wireless/ath/ath12k/core.h  |  25 ++
 drivers/net/wireless/ath/ath12k/debug.c |   6 +-
 drivers/net/wireless/ath/ath12k/debug.h |   5 +-
 drivers/net/wireless/ath/ath12k/mac.c   | 504 +++++++++++++++++++-----
 drivers/net/wireless/ath/ath12k/peer.c  | 115 ++++++
 drivers/net/wireless/ath/ath12k/peer.h  |  12 +
 drivers/net/wireless/ath/ath12k/wmi.c   | 191 ++++++++-
 drivers/net/wireless/ath/ath12k/wmi.h   | 115 ++++++
 8 files changed, 848 insertions(+), 125 deletions(-)

base-commit: fa934bf3e0a825ee09f035c6580af513187d59a2

Signature · 1 line
2.39.5
author
#1 lore raw

PATCH v2 1/8 wifi: ath12k: ath12k_mac_vdev_create(): use goto for error handling

From: Kalle Valo <[email protected]>

In commit 477cabfdb776 ("wifi: ath12k: modify link arvif creation and removal for MLO") I had accidentally left one personal TODO comment about using goto instead of ret. Switch to use goto to be consistent with the error handling in the function.

Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3

---
 drivers/net/wireless/ath/ath12k/mac.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/wireless/ath/ath12k/mac.c +1 -2
index f5f96a8b1d61..7dd2b66d3386 100644
@@ -7047,8 +7047,7 @@ int ath12k_mac_vdev_create(struct ath12k *ar, struct ath12k_link_vif *arvif)
 		ret = ath12k_wait_for_peer_delete_done(ar, arvif->vdev_id,
 						       arvif->bssid);
 		if (ret)
-			/* KVALO: why not goto err? */
-			return ret;
+			goto err_vdev_del;
 
 		ar->num_peers--;
 	}
Signature · 1 line
2.39.5
Acked-by on v2 1/8
#2 lore raw

Re: [PATCH v2 1/8] wifi: ath12k: ath12k_mac_vdev_create(): use goto for error handling

Quoted 10 lines · Kalle Valo

From: Kalle Valo <[email protected]>

In commit 477cabfdb776 ("wifi: ath12k: modify link arvif creation and removal for MLO") I had accidentally left one personal TODO comment about using goto instead of ret. Switch to use goto to be consistent with the error handling in the function.

Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3

author
#3 lore raw

PATCH v2 2/8 wifi: ath12k: MLO vdev bringup changes

In reply to Kalle Valo

From: Sriram R <[email protected]>

Add changes to add the link vdevs dynamically whenever a channel is assigned from mac80211 for a link vdev. During vdev create, update ML address of the vdev to firmware using the new WMI parameter (WMI_TAG_MLO_VDEV_CREATE_PARAMS).

During vdev start, notify the firmware that this link vdev is newly added and also indicate all its known partners so that the firmware can take necessary actions to internally update the partners on the new link being added.

Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-QCAHKSWPL_SILICONZ-1
Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3

---
 drivers/net/wireless/ath/ath12k/mac.c | 87 ++++++++++++++++++++++++++-
 drivers/net/wireless/ath/ath12k/wmi.c | 85 +++++++++++++++++++++++++-
 drivers/net/wireless/ath/ath12k/wmi.h | 63 +++++++++++++++++++
 3 files changed, 230 insertions(+), 5 deletions(-)
drivers/net/wireless/ath/ath12k/mac.c +84 -3
index 7dd2b66d3386..16b14ae502a6 100644
@@ -648,6 +648,18 @@ struct ath12k *ath12k_mac_get_ar_by_pdev_id(struct ath12k_base *ab, u32 pdev_id)
 	return NULL;
 }
 
+static bool ath12k_mac_is_ml_arvif(struct ath12k_link_vif *arvif)
+{
+	struct ath12k_vif *ahvif = arvif->ahvif;
+
+	lockdep_assert_wiphy(ahvif->ah->hw->wiphy);
+
+	if (ahvif->vif->valid_links & BIT(arvif->link_id))
+		return true;
+
+	return false;
+}
+
 static struct ath12k *ath12k_mac_get_ar_by_chan(struct ieee80211_hw *hw,
 						struct ieee80211_channel *channel)
 {
@@ -1512,7 +1524,8 @@ static int ath12k_mac_setup_bcn_tmpl_ema(struct ath12k_link_vif *arvif)
 	tx_ahvif = ath12k_vif_to_ahvif(ahvif->vif->mbssid_tx_vif);
 	tx_arvif = &tx_ahvif->deflink;
 	beacons = ieee80211_beacon_get_template_ema_list(ath12k_ar_to_hw(tx_arvif->ar),
-							 tx_ahvif->vif, 0);
+							 tx_ahvif->vif,
+							 tx_arvif->link_id);
 	if (!beacons || !beacons->cnt) {
 		ath12k_warn(arvif->ar->ab,
 			    "failed to get ema beacon templates from mac80211\n");
@@ -1577,7 +1590,7 @@ static int ath12k_mac_setup_bcn_tmpl(struct ath12k_link_vif *arvif)
 	}
 
 	bcn = ieee80211_beacon_get_template(ath12k_ar_to_hw(tx_arvif->ar), tx_ahvif->vif,
-					    &offs, 0);
+					    &offs, tx_arvif->link_id);
 	if (!bcn) {
 		ath12k_warn(ab, "failed to get beacon template from mac80211\n");
 		return -EPERM;
@@ -1658,7 +1671,7 @@ static void ath12k_control_beaconing(struct ath12k_link_vif *arvif,
 
 	ahvif->aid = 0;
 
-	ether_addr_copy(arvif->bssid, info->bssid);
+	ether_addr_copy(arvif->bssid, info->addr);
 
 	params.vdev_id = arvif->vdev_id;
 	params.aid = ahvif->aid;
@@ -6671,6 +6684,8 @@ static int ath12k_mac_setup_vdev_create_arg(struct ath12k_link_vif *arvif,
 	struct ath12k_vif *ahvif = arvif->ahvif;
 	int ret;
 
+	lockdep_assert_wiphy(ath12k_ar_to_hw(ar)->wiphy);
+
 	arg->if_id = arvif->vdev_id;
 	arg->type = ahvif->vdev_type;
 	arg->subtype = ahvif->vdev_subtype;
@@ -6702,6 +6717,17 @@ static int ath12k_mac_setup_vdev_create_arg(struct ath12k_link_vif *arvif,
 	}
 
 	arg->if_stats_id = ath12k_mac_get_vdev_stats_id(arvif);
+
+	if (ath12k_mac_is_ml_arvif(arvif)) {
+		if (hweight16(ahvif->vif->valid_links) > ATH12K_WMI_MLO_MAX_LINKS) {
+			ath12k_warn(ar->ab, "too many MLO links during setting up vdev: %d",
+				    ahvif->vif->valid_links);
+			return -EINVAL;
+		}
+
+		ether_addr_copy(arg->mld_addr, ahvif->vif->addr);
+	}
+
 	return 0;
 }
 
@@ -7639,6 +7665,58 @@ ath12k_mac_check_down_grade_phy_mode(struct ath12k *ar,
 	return down_mode;
 }
 
+static void
+ath12k_mac_mlo_get_vdev_args(struct ath12k_link_vif *arvif,
+			     struct wmi_ml_arg *ml_arg)
+{
+	struct ath12k_vif *ahvif = arvif->ahvif;
+	struct wmi_ml_partner_info *partner_info;
+	struct ieee80211_bss_conf *link_conf;
+	struct ath12k_link_vif *arvif_p;
+	unsigned long links;
+	u8 link_id;
+
+	lockdep_assert_wiphy(ahvif->ah->hw->wiphy);
+
+	if (!ath12k_mac_is_ml_arvif(arvif))
+		return;
+
+	if (hweight16(ahvif->vif->valid_links) > ATH12K_WMI_MLO_MAX_LINKS)
+		return;
+
+	ml_arg->enabled = true;
+
+	/* Driver always add a new link via VDEV START, FW takes
+	 * care of internally adding this link to existing
+	 * link vdevs which are advertised as partners below
+	 */
+	ml_arg->link_add = true;
+	partner_info = ml_arg->partner_info;
+
+	links = ahvif->links_map;
+	for_each_set_bit(link_id, &links, IEEE80211_MLD_MAX_NUM_LINKS) {
+		arvif_p = wiphy_dereference(ahvif->ah->hw->wiphy, ahvif->link[link_id]);
+
+		if (WARN_ON(!arvif_p))
+			continue;
+
+		if (arvif == arvif_p)
+			continue;
+
+		link_conf = wiphy_dereference(ahvif->ah->hw->wiphy,
+					      ahvif->vif->link_conf[arvif_p->link_id]);
+
+		if (!link_conf)
+			continue;
+
+		partner_info->vdev_id = arvif_p->vdev_id;
+		partner_info->hw_link_id = arvif_p->ar->pdev->hw_link_id;
+		ether_addr_copy(partner_info->addr, link_conf->addr);
+		ml_arg->num_partner_links++;
+		partner_info++;
+	}
+}
+
 static int
 ath12k_mac_vdev_start_restart(struct ath12k_link_vif *arvif,
 			      struct ieee80211_chanctx_conf *ctx,
@@ -7717,6 +7795,9 @@ ath12k_mac_vdev_start_restart(struct ath12k_link_vif *arvif,
 
 	arg.passive |= !!(chandef->chan->flags & IEEE80211_CHAN_NO_IR);
 
+	if (!restart)
+		ath12k_mac_mlo_get_vdev_args(arvif, &arg.ml);
+
 	ath12k_dbg(ab, ATH12K_DBG_MAC,
 		   "mac vdev %d start center_freq %d phymode %s punct_bitmap 0x%x\n",
 		   arg.vdev_id, arg.freq,
drivers/net/wireless/ath/ath12k/wmi.c +83 -2

127 lines not on this page · raw message

drivers/net/wireless/ath/ath12k/wmi.h +63 -0

93 lines not on this page · raw message

Signature · 1 line
2.39.5
Acked-by on v2 2/8
#4 lore raw

Re: [PATCH v2 2/8] wifi: ath12k: MLO vdev bringup changes

Quoted 10 lines · Kalle Valo

From: Sriram R <[email protected]>

Add changes to add the link vdevs dynamically whenever a channel is assigned from mac80211 for a link vdev. During vdev create, update ML address of the vdev to firmware using the new WMI parameter (WMI_TAG_MLO_VDEV_CREATE_PARAMS).

During vdev start, notify the firmware that this link vdev is newly added and also indicate all its known partners so that the firmware can take necessary actions to internally update the partners on the new link being added.

Quoted 7 lines

Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-QCAHKSWPL_SILICONZ-1
Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3

author
#5 lore raw

PATCH v2 3/8 wifi: ath12k: Refactor sta state machine

In reply to Kalle Valo

From: Sriram R <[email protected]>

Refactor ath12k_mac_op_sta_state(), with generic wrappers which can be used for both multi link stations and non-ML stations.

Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-QCAHKSWPL_SILICONZ-1
Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3

---
 drivers/net/wireless/ath/ath12k/core.h |   3 +
 drivers/net/wireless/ath/ath12k/mac.c  | 343 +++++++++++++++++--------
 2 files changed, 244 insertions(+), 102 deletions(-)
drivers/net/wireless/ath/ath12k/core.h +3 -0
index 06b637ba8b8f..6faa46b9adc9 100644
@@ -461,6 +461,9 @@ struct ath12k_link_sta {
 	struct ath12k_link_vif *arvif;
 	struct ath12k_sta *ahsta;
 
+	/* link address similar to ieee80211_link_sta */
+	u8 addr[ETH_ALEN];
+
 	/* the following are protected by ar->data_lock */
 	u32 changed; /* IEEE80211_RC_* */
 	u32 bw;
drivers/net/wireless/ath/ath12k/mac.c +241 -102

418 lines not on this page · raw message

Signature · 1 line
2.39.5
Acked-by on v2 3/8
#6 lore raw

Re: [PATCH v2 3/8] wifi: ath12k: Refactor sta state machine

Quoted 11 lines · Kalle Valo

From: Sriram R <[email protected]>

Refactor ath12k_mac_op_sta_state(), with generic wrappers which can be used for both multi link stations and non-ML stations.

Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-QCAHKSWPL_SILICONZ-1
Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3

author
#7 lore raw

PATCH v2 4/8 wifi: ath12k: introduce ath12k_hw_warn()

In reply to Kalle Valo

From: Kalle Valo <[email protected]>

In the following patch we need to use ath12k_warn() but don't easily have access to struct ath12k_base (ab) but do have access to struct ath12k_hw (ah). So add a new warning helper ath12_hw_warn() which takes the latter but the log output is still identical but uses the struct device pointer stored to struct ath12k_hw.

Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3

---
 drivers/net/wireless/ath/ath12k/core.h  | 2 ++
 drivers/net/wireless/ath/ath12k/debug.c | 6 +++---
 drivers/net/wireless/ath/ath12k/debug.h | 5 ++++-
 drivers/net/wireless/ath/ath12k/mac.c   | 2 ++
 4 files changed, 11 insertions(+), 4 deletions(-)
drivers/net/wireless/ath/ath12k/core.h +2 -0
index 6faa46b9adc9..9c4e5fae8930 100644
@@ -684,6 +684,8 @@ struct ath12k {
 
 struct ath12k_hw {
 	struct ieee80211_hw *hw;
+	struct device *dev;
+
 	/* Protect the write operation of the hardware state ath12k_hw::state
 	 * between hardware start<=>reconfigure<=>stop transitions.
 	 */
drivers/net/wireless/ath/ath12k/debug.c +3 -3
index fe5a732ba9ec..ff6eaeafa092 100644
@@ -1,7 +1,7 @@
 // SPDX-License-Identifier: BSD-3-Clause-Clear
 /*
  * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved.
- * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved.
  */
 
 #include <linux/vmalloc.h>
@@ -36,7 +36,7 @@ void ath12k_err(struct ath12k_base *ab, const char *fmt, ...)
 	va_end(args);
 }
 
-void ath12k_warn(struct ath12k_base *ab, const char *fmt, ...)
+void __ath12k_warn(struct device *dev, const char *fmt, ...)
 {
 	struct va_format vaf = {
 		.fmt = fmt,
@@ -45,7 +45,7 @@ void ath12k_warn(struct ath12k_base *ab, const char *fmt, ...)
 
 	va_start(args, fmt);
 	vaf.va = &args;
-	dev_warn_ratelimited(ab->dev, "%pV", &vaf);
+	dev_warn_ratelimited(dev, "%pV", &vaf);
 	/* TODO: Trace the log */
 	va_end(args);
 }
drivers/net/wireless/ath/ath12k/debug.h +4 -1
index f7005917362c..90e801136bc6 100644
@@ -31,7 +31,10 @@ enum ath12k_debug_mask {
 
 __printf(2, 3) void ath12k_info(struct ath12k_base *ab, const char *fmt, ...);
 __printf(2, 3) void ath12k_err(struct ath12k_base *ab, const char *fmt, ...);
-__printf(2, 3) void ath12k_warn(struct ath12k_base *ab, const char *fmt, ...);
+__printf(2, 3) void __ath12k_warn(struct device *dev, const char *fmt, ...);
+
+#define ath12k_warn(ab, fmt, ...) __ath12k_warn((ab)->dev, fmt, ##__VA_ARGS__)
+#define ath12k_hw_warn(ah, fmt, ...) __ath12k_warn((ah)->dev, fmt, ##__VA_ARGS__)
 
 extern unsigned int ath12k_debug_mask;
 
drivers/net/wireless/ath/ath12k/mac.c +2 -0
index 354fc21f2af2..9552a9495276 100644
@@ -10192,6 +10192,8 @@ int ath12k_mac_allocate(struct ath12k_base *ab)
 			goto err;
 		}
 
+		ah->dev = ab->dev;
+
 		ab->ah[i] = ah;
 	}
 
Signature · 1 line
2.39.5
Acked-by on v2 4/8
#8 lore raw

Re: [PATCH v2 4/8] wifi: ath12k: introduce ath12k_hw_warn()

Quoted 11 lines · Kalle Valo

From: Kalle Valo <[email protected]>

In the following patch we need to use ath12k_warn() but don't easily have access to struct ath12k_base (ab) but do have access to struct ath12k_hw (ah). So add a new warning helper ath12_hw_warn() which takes the latter but the log output is still identical but uses the struct device pointer stored to struct ath12k_hw.

Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3

author
#9 lore raw

PATCH v2 5/8 wifi: ath12k: Add helpers for multi link peer creation and deletion

In reply to Kalle Valo

From: Sriram R <[email protected]>

Add helper functions for multi link peer addition and deletion. And add address validation to ensure we are not creating link peers (belonging to different clients) with same MLD address. To aid in this validation for faster lookup, add a new list of ML peers to struct ath12k_hw::ml_peers and use the same for parsing for the above address validation use cases.

Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-QCAHKSWPL_SILICONZ-1
Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3

---
 drivers/net/wireless/ath/ath12k/core.h | 13 ++++
 drivers/net/wireless/ath/ath12k/mac.c  |  2 +
 drivers/net/wireless/ath/ath12k/peer.c | 98 ++++++++++++++++++++++++++
 drivers/net/wireless/ath/ath12k/peer.h |  8 +++
 4 files changed, 121 insertions(+)
drivers/net/wireless/ath/ath12k/core.h +13 -0
index 9c4e5fae8930..0a0c1a1594f2 100644
@@ -63,6 +63,13 @@
 #define ATH12K_RECONFIGURE_TIMEOUT_HZ		(10 * HZ)
 #define ATH12K_RECOVER_START_TIMEOUT_HZ		(20 * HZ)
 
+#define ATH12K_MAX_SOCS 3
+#define ATH12K_INVALID_GROUP_ID  0xFF
+#define ATH12K_INVALID_DEVICE_ID 0xFF
+
+#define ATH12K_MAX_MLO_PEERS            256
+#define ATH12K_MLO_PEER_ID_INVALID      0xFFFF
+
 enum ath12k_bdf_search {
 	ATH12K_BDF_SEARCH_DEFAULT,
 	ATH12K_BDF_SEARCH_BUS_AND_BOARD,
@@ -488,6 +495,7 @@ struct ath12k_sta {
 	struct ath12k_link_sta __rcu *link[IEEE80211_MLD_MAX_NUM_LINKS];
 	/* indicates bitmap of link sta created in FW */
 	u16 links_map;
+	u16 ml_peer_id;
 };
 
 #define ATH12K_MIN_5G_FREQ 4150
@@ -696,6 +704,11 @@ struct ath12k_hw {
 
 	u8 num_radio;
 
+	DECLARE_BITMAP(free_ml_peer_id_map, ATH12K_MAX_MLO_PEERS);
+
+	/* protected by wiphy_lock() */
+	struct list_head ml_peers;
+
 	/* Keep last */
 	struct ath12k radio[] __aligned(sizeof(void *));
 };
drivers/net/wireless/ath/ath12k/mac.c +2 -0
index 9552a9495276..2f1edce0287a 100644
@@ -5105,6 +5105,7 @@ static int ath12k_mac_handle_link_sta_state(struct ieee80211_hw *hw,
 		ahsta->links_map = BIT(arsta->link_id);
 		arsta->ahsta = ahsta;
 		arsta->arvif = arvif;
+		ether_addr_copy(arsta->addr, sta->addr);
 		wiphy_work_init(&arsta->update_wk, ath12k_sta_rc_update_wk);
 
 		synchronize_rcu();
@@ -10123,6 +10124,7 @@ static struct ath12k_hw *ath12k_mac_hw_allocate(struct ath12k_base *ab,
 	ah->num_radio = num_pdev_map;
 
 	mutex_init(&ah->hw_mutex);
+	INIT_LIST_HEAD(&ah->ml_peers);
 
 	for (i = 0; i < num_pdev_map; i++) {
 		ab = pdev_map[i].ab;
drivers/net/wireless/ath/ath12k/peer.c +98 -0

107 lines not on this page · raw message

drivers/net/wireless/ath/ath12k/peer.h +8 -0
index b955f0cdf598..085246ca938d 100644
@@ -49,6 +49,12 @@ struct ath12k_peer {
 	bool dp_setup_done;
 };
 
+struct ath12k_ml_peer {
+	struct list_head list;
+	u8 addr[ETH_ALEN];
+	u16 id;
+};
+
 void ath12k_peer_unmap_event(struct ath12k_base *ab, u16 peer_id);
 void ath12k_peer_map_event(struct ath12k_base *ab, u8 vdev_id, u16 peer_id,
 			   u8 *mac_addr, u16 ast_hash, u16 hw_peer_id);
@@ -66,5 +72,7 @@ int ath12k_wait_for_peer_delete_done(struct ath12k *ar, u32 vdev_id,
 				     const u8 *addr);
 bool ath12k_peer_exist_by_vdev_id(struct ath12k_base *ab, int vdev_id);
 struct ath12k_peer *ath12k_peer_find_by_ast(struct ath12k_base *ab, int ast_hash);
+int ath12k_peer_ml_create(struct ath12k_hw *ah, struct ieee80211_sta *sta);
+int ath12k_peer_ml_delete(struct ath12k_hw *ah, struct ieee80211_sta *sta);
 
 #endif /* _PEER_H_ */
Signature · 1 line
2.39.5
Acked-by on v2 5/8
#10 lore raw

Re: [PATCH v2 5/8] wifi: ath12k: Add helpers for multi link peer creation and deletion

Quoted 8 lines · Kalle Valo

From: Sriram R <[email protected]>

Add helper functions for multi link peer addition and deletion. And add address validation to ensure we are not creating link peers (belonging to different clients) with same MLD address. To aid in this validation for faster lookup, add a new list of ML peers to struct ath12k_hw::ml_peers and use the same for parsing for the above address validation use cases.

Quoted 6 lines

Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-QCAHKSWPL_SILICONZ-1
Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3

author
#11 lore raw

PATCH v2 6/8 wifi: ath12k: add multi-link flag in peer create command

In reply to Kalle Valo

From: Sriram R <[email protected]>

Driver should indicate to firmware whether a peer is multi-link or not in peer create command using multi-link flag. Add changes to support WMI_TAG_MLO_PEER_CREATE_PARAMS in WMI_PEER_CREATE_CMDID.

Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-QCAHKSWPL_SILICONZ-1
Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3

---
 drivers/net/wireless/ath/ath12k/mac.c |  5 +++--
 drivers/net/wireless/ath/ath12k/wmi.c | 27 +++++++++++++++++++++++----
 drivers/net/wireless/ath/ath12k/wmi.h |  6 ++++++
 3 files changed, 32 insertions(+), 6 deletions(-)
drivers/net/wireless/ath/ath12k/mac.c +3 -2
index 2f1edce0287a..b12682547410 100644
@@ -4983,8 +4983,9 @@ static int ath12k_mac_station_add(struct ath12k *ar,
 	}
 
 	peer_param.vdev_id = arvif->vdev_id;
-	peer_param.peer_addr = sta->addr;
+	peer_param.peer_addr = arsta->addr;
 	peer_param.peer_type = WMI_PEER_TYPE_DEFAULT;
+	peer_param.ml_enabled = sta->mlo;
 
 	ret = ath12k_peer_create(ar, arvif, sta, &peer_param);
 	if (ret) {
@@ -7018,7 +7019,7 @@ int ath12k_mac_vdev_create(struct ath12k *ar, struct ath12k_link_vif *arvif)
 	struct ath12k_vif *ahvif = arvif->ahvif;
 	struct ieee80211_vif *vif = ath12k_ahvif_to_vif(ahvif);
 	struct ath12k_wmi_vdev_create_arg vdev_arg = {0};
-	struct ath12k_wmi_peer_create_arg peer_param;
+	struct ath12k_wmi_peer_create_arg peer_param = {0};
 	struct ieee80211_bss_conf *link_conf;
 	u32 param_id, param_value;
 	u16 nss;
drivers/net/wireless/ath/ath12k/wmi.c +23 -4
index e089b58bbea1..0583d832fac7 100644
@@ -1230,9 +1230,14 @@ int ath12k_wmi_send_peer_create_cmd(struct ath12k *ar,
 	struct ath12k_wmi_pdev *wmi = ar->wmi;
 	struct wmi_peer_create_cmd *cmd;
 	struct sk_buff *skb;
-	int ret;
+	int ret, len;
+	struct wmi_peer_create_mlo_params *ml_param;
+	void *ptr;
+	struct wmi_tlv *tlv;
 
-	skb = ath12k_wmi_alloc_skb(wmi->wmi_ab, sizeof(*cmd));
+	len = sizeof(*cmd) + TLV_HDR_SIZE + sizeof(*ml_param);
+
+	skb = ath12k_wmi_alloc_skb(wmi->wmi_ab, len);
 	if (!skb)
 		return -ENOMEM;
 
@@ -1244,9 +1249,23 @@ int ath12k_wmi_send_peer_create_cmd(struct ath12k *ar,
 	cmd->peer_type = cpu_to_le32(arg->peer_type);
 	cmd->vdev_id = cpu_to_le32(arg->vdev_id);
 
+	ptr = skb->data + sizeof(*cmd);
+	tlv = ptr;
+	tlv->header = ath12k_wmi_tlv_hdr(WMI_TAG_ARRAY_STRUCT,
+					 sizeof(*ml_param));
+	ptr += TLV_HDR_SIZE;
+	ml_param = ptr;
+	ml_param->tlv_header =
+			ath12k_wmi_tlv_cmd_hdr(WMI_TAG_MLO_PEER_CREATE_PARAMS,
+					       sizeof(*ml_param));
+	if (arg->ml_enabled)
+		ml_param->flags = cpu_to_le32(ATH12K_WMI_FLAG_MLO_ENABLED);
+
+	ptr += sizeof(*ml_param);
+
 	ath12k_dbg(ar->ab, ATH12K_DBG_WMI,
-		   "WMI peer create vdev_id %d peer_addr %pM\n",
-		   arg->vdev_id, arg->peer_addr);
+		   "WMI peer create vdev_id %d peer_addr %pM ml_flags 0x%x\n",
+		   arg->vdev_id, arg->peer_addr, ml_param->flags);
 
 	ret = ath12k_wmi_cmd_send(wmi, skb, WMI_PEER_CREATE_CMDID);
 	if (ret) {
drivers/net/wireless/ath/ath12k/wmi.h +6 -0
index 0ddd7ce97385..2378d94b2409 100644
@@ -3015,6 +3015,12 @@ struct ath12k_wmi_peer_create_arg {
 	const u8 *peer_addr;
 	u32 peer_type;
 	u32 vdev_id;
+	bool ml_enabled;
+};
+
+struct wmi_peer_create_mlo_params {
+	__le32 tlv_header;
+	__le32 flags;
 };
 
 struct ath12k_wmi_pdev_set_regdomain_arg {
Signature · 1 line
2.39.5
Acked-by on v2 6/8
#12 lore raw

Re: [PATCH v2 6/8] wifi: ath12k: add multi-link flag in peer create command

Quoted 6 lines · Kalle Valo

From: Sriram R <[email protected]>

Driver should indicate to firmware whether a peer is multi-link or not in peer create command using multi-link flag. Add changes to support WMI_TAG_MLO_PEER_CREATE_PARAMS in WMI_PEER_CREATE_CMDID.

Quoted 6 lines

Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-QCAHKSWPL_SILICONZ-1
Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3

author
#13 lore raw

PATCH v2 7/8 wifi: ath12k: add helper to find multi-link station

In reply to Kalle Valo

From: Sriram R <[email protected]>

Multi-link stations are identified in driver using the multi-link peer id and they have ATH12K_PEER_ML_ID_VALID bit set in the id. Add a helper to find multi-link station using the multi-link peer id.

Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-QCAHKSWPL_SILICONZ-1
Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3

---
 drivers/net/wireless/ath/ath12k/peer.c | 17 +++++++++++++++++
 drivers/net/wireless/ath/ath12k/peer.h |  4 ++++
 2 files changed, 21 insertions(+)
drivers/net/wireless/ath/ath12k/peer.c +17 -0
index 2ad19baf0664..0e86847edd6e 100644
@@ -79,6 +79,20 @@ struct ath12k_peer *ath12k_peer_find_by_addr(struct ath12k_base *ab,
 	return NULL;
 }
 
+static struct ath12k_peer *ath12k_peer_find_by_ml_id(struct ath12k_base *ab,
+						     int ml_peer_id)
+{
+	struct ath12k_peer *peer;
+
+	lockdep_assert_held(&ab->base_lock);
+
+	list_for_each_entry(peer, &ab->peers, list)
+		if (ml_peer_id == peer->ml_id)
+			return peer;
+
+	return NULL;
+}
+
 struct ath12k_peer *ath12k_peer_find_by_id(struct ath12k_base *ab,
 					   int peer_id)
 {
@@ -86,6 +100,9 @@ struct ath12k_peer *ath12k_peer_find_by_id(struct ath12k_base *ab,
 
 	lockdep_assert_held(&ab->base_lock);
 
+	if (peer_id & ATH12K_PEER_ML_ID_VALID)
+		return ath12k_peer_find_by_ml_id(ab, peer_id);
+
 	list_for_each_entry(peer, &ab->peers, list)
 		if (peer_id == peer->peer_id)
 			return peer;
drivers/net/wireless/ath/ath12k/peer.h +4 -0
index 085246ca938d..c28aca5d88a0 100644
@@ -19,6 +19,8 @@ struct ppdu_user_delayba {
 	u32 resp_rate_flags;
 };
 
+#define ATH12K_PEER_ML_ID_VALID         BIT(13)
+
 struct ath12k_peer {
 	struct list_head list;
 	struct ieee80211_sta *sta;
@@ -47,6 +49,8 @@ struct ath12k_peer {
 
 	/* protected by ab->data_lock */
 	bool dp_setup_done;
+
+	u16 ml_id;
 };
 
 struct ath12k_ml_peer {
Signature · 1 line
2.39.5
Acked-by on v2 7/8
#14 lore raw

Re: [PATCH v2 7/8] wifi: ath12k: add helper to find multi-link station

Quoted 6 lines · Kalle Valo

From: Sriram R <[email protected]>

Multi-link stations are identified in driver using the multi-link peer id and they have ATH12K_PEER_ML_ID_VALID bit set in the id. Add a helper to find multi-link station using the multi-link peer id.

Quoted 6 lines

Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-QCAHKSWPL_SILICONZ-1
Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3

author
#15 lore raw

PATCH v2 8/8 wifi: ath12k: Add MLO peer assoc command support

In reply to Kalle Valo

From: Sriram R <[email protected]>

Add changes to send MLO peer assoc command with partner link details and primary umac details

Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-QCAHKSWPL_SILICONZ-1
Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3

---
 drivers/net/wireless/ath/ath12k/core.h |  7 +++
 drivers/net/wireless/ath/ath12k/mac.c  | 62 ++++++++++++++++++++
 drivers/net/wireless/ath/ath12k/wmi.c  | 79 ++++++++++++++++++++++++--
 drivers/net/wireless/ath/ath12k/wmi.h  | 46 +++++++++++++++
 4 files changed, 188 insertions(+), 6 deletions(-)
drivers/net/wireless/ath/ath12k/core.h +7 -0
index 0a0c1a1594f2..e7a2d43e7b8a 100644
@@ -487,9 +487,16 @@ struct ath12k_link_sta {
 	struct ath12k_rx_peer_stats *rx_stats;
 	struct ath12k_wbm_tx_stats *wbm_tx_stats;
 	u32 bw_prev;
+
+	/* For now the assoc link will be considered primary */
+	bool is_assoc_link;
+
+	 /* for firmware use only */
+	u8 link_idx;
 };
 
 struct ath12k_sta {
+	struct ath12k_vif *ahvif;
 	enum hal_pn_type pn_type;
 	struct ath12k_link_sta deflink;
 	struct ath12k_link_sta __rcu *link[IEEE80211_MLD_MAX_NUM_LINKS];
drivers/net/wireless/ath/ath12k/mac.c +62 -0

74 lines not on this page · raw message

drivers/net/wireless/ath/ath12k/wmi.c +73 -6

117 lines not on this page · raw message

drivers/net/wireless/ath/ath12k/wmi.h +46 -0

60 lines not on this page · raw message

Signature · 1 line
2.39.5
Acked-by on v2 8/8
#16 lore raw

Re: [PATCH v2 8/8] wifi: ath12k: Add MLO peer assoc command support

Quoted 11 lines · Kalle Valo

From: Sriram R <[email protected]>

Add changes to send MLO peer assoc command with partner link details and primary umac details

Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-QCAHKSWPL_SILICONZ-1
Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3

#17 lore raw
In reply to Kalle Valo
Quoted 61 lines · Kalle Valo

From: Kalle Valo <[email protected]>

Here we continue to refactor mac.c to support multiple links and extend peer assoc WMI command to support MLO.

Please review.

v2:

* patch 1: use err_vdev_del

* patch 2: ath12k_mac_mlo_get_vdev_args(): switch
wiphy_dereference()

* patch 2: use struct ath12k_wmi_mac_addr_params instead adding struct wmi_mac_addr

* patch 3: ath12k_mac_station_post_remove(): assign ahsta->links_map before rcu_assign_pointer()

* patch 3: ath12k_mac_station_unauthorize(): fi* confusing comment about __sta_info_destroy_part2()

* patch 4: debugfs.c: copyright year

* patch 5: ath12k_peer_mlo_create(): remove parenthesis from the warning message

* patch 5: ATH12K_ML_PEER_ID_VALID: move to peer.h and rename to ATH12K_PEER_ML_ID_VALID

* patch 5: rename struct ath12k_peer::ml_peer_id to peer_id

* patch 5: use ath12k_peer_ml_*() naming style in peer.c

* patch 7: improve commit message a bit

* patch 7: struct wmi_peer_assoc_mlo_partner_info: add _params to name

v1: https://patchwork.kernel.org/project/linux-wireless/cover/[email protected]/

Kalle Valo (2):
wifi: ath12k: ath12k_mac_vdev_create(): use goto for error handling
wifi: ath12k: introduce ath12k_hw_warn()

Sriram R (6):
wifi: ath12k: MLO vdev bringup changes
wifi: ath12k: Refactor sta state machine
wifi: ath12k: Add helpers for multi link peer creation and deletion
wifi: ath12k: add multi-link flag in peer create command
wifi: ath12k: add helper to find multi-link station
wifi: ath12k: Add MLO peer assoc command support

 drivers/net/wireless/ath/ath12k/core.h  |  25 ++
 drivers/net/wireless/ath/ath12k/debug.c |   6 +-
 drivers/net/wireless/ath/ath12k/debug.h |   5 +-
 drivers/net/wireless/ath/ath12k/mac.c   | 504 +++++++++++++++++++-----
 drivers/net/wireless/ath/ath12k/peer.c  | 115 ++++++
 drivers/net/wireless/ath/ath12k/peer.h  |  12 +
 drivers/net/wireless/ath/ath12k/wmi.c   | 191 ++++++++-
 drivers/net/wireless/ath/ath12k/wmi.h   | 115 ++++++
 8 files changed, 848 insertions(+), 125 deletions(-)
Quoted 1 line

base-commit: fa934bf3e0a825ee09f035c6580af513187d59a2

with this series I see a new warning with gcc:
drivers/net/wireless/ath/ath12k/mac.c: In function 'ath12k_bss_assoc':
drivers/net/wireless/ath/ath12k/mac.c:3080:1: warning: the frame size of 1040 bytes is larger than 1024 bytes [-Wframe-larger-than=]

we should clean this up with a subsequent patch

I'm taking the current series into 'pending'

/jeff

author
#18 lore raw
Quoted 63 lines · Jeff Johnson
Quoted 61 lines · Kalle Valo

From: Kalle Valo <[email protected]>

Here we continue to refactor mac.c to support multiple links and extend peer assoc WMI command to support MLO.

Please review.

v2:

* patch 1: use err_vdev_del

* patch 2: ath12k_mac_mlo_get_vdev_args(): switch
wiphy_dereference()

* patch 2: use struct ath12k_wmi_mac_addr_params instead adding struct wmi_mac_addr

* patch 3: ath12k_mac_station_post_remove(): assign ahsta->links_map before rcu_assign_pointer()

* patch 3: ath12k_mac_station_unauthorize(): fi* confusing comment about __sta_info_destroy_part2()

* patch 4: debugfs.c: copyright year

* patch 5: ath12k_peer_mlo_create(): remove parenthesis from the warning message

* patch 5: ATH12K_ML_PEER_ID_VALID: move to peer.h and rename to ATH12K_PEER_ML_ID_VALID

* patch 5: rename struct ath12k_peer::ml_peer_id to peer_id

* patch 5: use ath12k_peer_ml_*() naming style in peer.c

* patch 7: improve commit message a bit

* patch 7: struct wmi_peer_assoc_mlo_partner_info: add _params to name

v1: https://patchwork.kernel.org/project/linux-wireless/cover/[email protected]/

Kalle Valo (2):
wifi: ath12k: ath12k_mac_vdev_create(): use goto for error handling
wifi: ath12k: introduce ath12k_hw_warn()

Sriram R (6):
wifi: ath12k: MLO vdev bringup changes
wifi: ath12k: Refactor sta state machine
wifi: ath12k: Add helpers for multi link peer creation and deletion
wifi: ath12k: add multi-link flag in peer create command
wifi: ath12k: add helper to find multi-link station
wifi: ath12k: Add MLO peer assoc command support

 drivers/net/wireless/ath/ath12k/core.h  |  25 ++
 drivers/net/wireless/ath/ath12k/debug.c |   6 +-
 drivers/net/wireless/ath/ath12k/debug.h |   5 +-
 drivers/net/wireless/ath/ath12k/mac.c   | 504 +++++++++++++++++++-----
 drivers/net/wireless/ath/ath12k/peer.c  | 115 ++++++
 drivers/net/wireless/ath/ath12k/peer.h  |  12 +
 drivers/net/wireless/ath/ath12k/wmi.c   | 191 ++++++++-
 drivers/net/wireless/ath/ath12k/wmi.h   | 115 ++++++
 8 files changed, 848 insertions(+), 125 deletions(-)
Quoted 6 lines
Quoted 1 line

base-commit: fa934bf3e0a825ee09f035c6580af513187d59a2

with this series I see a new warning with gcc:
drivers/net/wireless/ath/ath12k/mac.c: In function 'ath12k_bss_assoc':
drivers/net/wireless/ath/ath12k/mac.c:3080:1: warning: the frame size of 1040 bytes is larger than 1024 bytes [-Wframe-larger-than=]

What GCC version are you using and can you privately share your .config? I'm guessing it's coming from peer_arg which was already in ath12k_bss_assoc() before this patchset:

	struct ath12k_wmi_peer_assoc_arg peer_arg;

And indeed it's a large struct, we shouldn't allocate that from the stack.

Quoted 1 line

we should clean this up with a subsequent patch

Agreed.

Quoted 1 line

I'm taking the current series into 'pending'

Thanks.

Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/list/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
Applied
#19 lore raw
In reply to Kalle Valo
Quoted 8 lines · Kalle Valo

Here we continue to refactor mac.c to support multiple links and extend peer assoc WMI command to support MLO.

Please review.

v2:

[...]

Applied, thanks!

[1/8] wifi: ath12k: ath12k_mac_vdev_create(): use goto for error handling

      commit: 09b99c10ddcb4ce6ea8410057ce99e5ab8e21f84
[2/8] wifi: ath12k: MLO vdev bringup changes
      commit: 60dcd3ce43104d774962c63cd21e93853449f2b0
[3/8] wifi: ath12k: Refactor sta state machine
      commit: edecb91a4f808ae48885e69479aa1b8e0d8e23e0
[4/8] wifi: ath12k: introduce ath12k_hw_warn()
      commit: 0b532c7a3d7f6dfb44796df12afa0823338453dc
[5/8] wifi: ath12k: Add helpers for multi link peer creation and deletion
      commit: 2496a67fee5a1d08fa1dd193057ae16d35e656da
[6/8] wifi: ath12k: add multi-link flag in peer create command
      commit: 9ef82da375f8991a6006a36e4b00f87adbffb67e
[7/8] wifi: ath12k: add helper to find multi-link station
      commit: 08a171207b407c5c8e187ab0dd137cbb0394294c
[8/8] wifi: ath12k: Add MLO peer assoc command support
      commit: c33f9c2728d0ccc7472e6239346c0fb3de556e0f

Best regards,

Signature · 1 line
Jeff Johnson <[email protected]>