Skip to contentSkip to conversation

wifi: ath12k: Prepare ath12k driver for Wi-Fi 8 Control path Changes

PATCH New Sriram R 1 participant 11 messages Dec 3 Qualcomm ATH12K wireless driver

lore
Share & tools
lore

Sriram R

author
#0 lore raw

cover wifi: ath12k: Prepare ath12k driver for Wi-Fi 8 Control path Changes

This series introduces the Wi-Fi 8 (QCN9575) control path peer management and association support in the ath12k driver. Wi-Fi 8 firmware introduces several architectural changes compared to Wi-Fi 7 that require corresponding driver updates:

- Peer lifecycle management is now architecture-specific: Wi-Fi 8 requires its own peer create/delete path while Wi-Fi 7 continues to use the existing common path. Peer operations are routed through arch callbacks so each generation can provide its own implementation without modifying the shared path.

- Peer ID assignment shifts from firmware-assigned to host-managed: Wi-Fi 8 uses a unified global peer ID space (sw_peer_id / hw_peer_id) allocated by the host before WMI peer create, eliminating the HTT peer-map event wait that Wi-Fi 7 relies on. A global_peer_id_supported flag on ath12k_dp distinguishes the two models. QCN9575 does not support peer unmap event as well, the corresponding link peer deletion will be handled in later series.

- Peer create confirmation now comes via a new WMI PEER_CREATE_CONF event instead of the HTT peer-map event. A per-architecture map_event_required hw_param gates which confirmation path is used.

- Multi-device group coordination requires CUMAC (Central UMAC) configuration. The driver selects one device as CUMAC via WMI_PDEV_SET_CUMAC_DEVICE_CMDID during hardware group initialisation, gated on WMI_TLV_SERVICE_PDEV_SET_CUMAC_DEVICE_CMD_SUPPORT.

- Maximum NSS capabilities are now advertised by firmware via a new WMI_MAC_PHY_CAPABILITIES_EXT2 TLV, allowing hardware chain count and firmware NSS limits to differ (e.g. QCN9575 5x5 hardware with 4-stream firmware limit).

- AP self peer authorisation is now required explicitly by Wi-Fi 8 firmware before traffic can flow. The driver authorises the self peer during vdev bringup; this is a no-op on Wi-Fi 7 (confirmed with firmware team).

- Management frame flow queues (MSDUQ, MPDUQ) and HOL queue parameters must be programmed by the host via new TLVs in WMI_PEER_ASSOC_CMDID. Four new arch ops (peer_assoc, link_peer_assoc, get_peer_mgmt_flowq, get_peer_holq) allow the architecture-specific datapath to participate in peer association.

Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.6-01243-QCAHKSWPL_SILICONZ-1
Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.1.c7-00108-QCAHMTSWPL_V1.0_V2.0_SILICONZ_UPSTREAM-3

Madhavan Ganesan (1):
wifi: ath12k: Refactor NSS handling to support firmware-advertised
capabilities

Ramya Gnanasekar (6):
wifi: ath12k: Refactor peer handling for Wi-Fi 8
wifi: ath12k: Introduce ml_ready flag for ML peer ID registration
tracking
wifi: ath12k: Prepare WMI to pass peer id and STA id for Wi-Fi 8
wifi: ath12k: Authorize AP self peer and use correct peer auth mode
wifi: ath12k: Add WMI peer assoc queue parameter support for Wi-Fi 8
wifi: ath12k: Add dp peer assoc arch ops and mac integration

Sriram R (3):
wifi: ath12k: update peer index translation and ML peer ID allocation
wifi: ath12k: Add peer create confirmation event support
wifi: ath12k: Add CUMAC device configuration command support

 drivers/net/wireless/ath/ath12k/core.c        |  72 +++
 drivers/net/wireless/ath/ath12k/core.h        |  11 +-
 drivers/net/wireless/ath/ath12k/dp.h          |  92 ++++
 drivers/net/wireless/ath/ath12k/dp_cmn.h      |   6 +
 drivers/net/wireless/ath/ath12k/dp_peer.c     | 171 +++----
 drivers/net/wireless/ath/ath12k/dp_peer.h     |  39 +-
 drivers/net/wireless/ath/ath12k/hw.h          |   1 +
 drivers/net/wireless/ath/ath12k/mac.c         | 309 +++++++++++--
 drivers/net/wireless/ath/ath12k/peer.c        |  65 ++-
 drivers/net/wireless/ath/ath12k/peer.h        |   2 +-
 .../net/wireless/ath/ath12k/wifi7/Makefile    |   3 +-
 drivers/net/wireless/ath/ath12k/wifi7/dp.c    |   4 +
 .../net/wireless/ath/ath12k/wifi7/dp_peer.c   |  98 ++++
 .../net/wireless/ath/ath12k/wifi7/dp_peer.h   |  18 +
 drivers/net/wireless/ath/ath12k/wifi7/hw.c    |   7 +
 drivers/net/wireless/ath/ath12k/wmi.c         | 433 ++++++++++++++++--
 drivers/net/wireless/ath/ath12k/wmi.h         | 157 +++++++
 17 files changed, 1270 insertions(+), 218 deletions(-)
 create mode 100644 drivers/net/wireless/ath/ath12k/wifi7/dp_peer.c
 create mode 100644 drivers/net/wireless/ath/ath12k/wifi7/dp_peer.h

base-commit: 68963d5cbe90d8d8a1d96b298ac86774267fa89c --
2.34.1

author
#1 lore raw

PATCH 1/10 wifi: ath12k: Refactor peer handling for Wi-Fi 8

From: Ramya Gnanasekar <[email protected]>

Wi-Fi 8 requires different peer management from the current common implementation. Separate peer lifecycle operations by architecture so each generation can provide its own peer creation and deletion.

Move Wi-Fi 7 peer create and delete implementations into its architecture-specific layer and route the common peer operations through architecture callbacks. This enables Wi-Fi 8 to provide its own peer management without changing the shared peer path.

Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.6-01243-QCAHKSWPL_SILICONZ-1
Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.1.c7-00108-QCAHMTSWPL_V1.0_V2.0_SILICONZ_UPSTREAM-3

---
 drivers/net/wireless/ath/ath12k/dp.h          |  22 ++++
 drivers/net/wireless/ath/ath12k/dp_cmn.h      |   1 +
 drivers/net/wireless/ath/ath12k/dp_peer.c     | 101 ++----------------
 drivers/net/wireless/ath/ath12k/dp_peer.h     |   9 +-
 drivers/net/wireless/ath/ath12k/mac.c         |  30 ++++--
 .../net/wireless/ath/ath12k/wifi7/Makefile    |   3 +-
 drivers/net/wireless/ath/ath12k/wifi7/dp.c    |   3 +
 .../net/wireless/ath/ath12k/wifi7/dp_peer.c   |  97 +++++++++++++++++
 .../net/wireless/ath/ath12k/wifi7/dp_peer.h   |  18 ++++
 9 files changed, 181 insertions(+), 103 deletions(-)
 create mode 100644 drivers/net/wireless/ath/ath12k/wifi7/dp_peer.c
 create mode 100644 drivers/net/wireless/ath/ath12k/wifi7/dp_peer.h
drivers/net/wireless/ath/ath12k/dp.h +22 -0
index 82724b87733a..d7a1ecd7cb0b 100644
@@ -16,6 +16,7 @@
 #define MAX_RXDMA_PER_PDEV     2
 
 struct ath12k_base;
+struct ath12k_hw;
 struct ath12k_dp_link_peer;
 struct ath12k_dp;
 struct ath12k_vif;
@@ -405,6 +406,10 @@ struct ath12k_dp_arch_ops {
 	void (*peer_rx_tid_qref_reset)(struct ath12k_base *ab, u16 peer_id, u16 tid);
 	int (*rx_tid_delete_handler)(struct ath12k_base *ab,
 				     struct ath12k_dp_rx_tid_rxq *rx_tid);
+	int (*peer_create)(struct ath12k_hw *ah,
+			   struct ath12k_dp_peer_create_params *params);
+	void (*peer_delete)(struct ath12k_hw *ah, u8 *addr,
+			    struct ieee80211_sta *sta);
 };
 
 struct ath12k_device_dp_tx_err_stats {
@@ -670,6 +675,23 @@ ath12k_dp_to_pdev_dp(struct ath12k_dp *dp, u8 pdev_idx)
 	return rcu_dereference(dp->dp_pdevs[pdev_idx]);
 }
 
+static inline int
+ath12k_dp_arch_peer_create(struct ath12k_dp *dp,
+			   struct ath12k_hw *ah,
+			   struct ath12k_dp_peer_create_params *params)
+{
+	return dp->ops->peer_create(ah, params);
+}
+
+static inline void
+ath12k_dp_arch_peer_delete(struct ath12k_dp *dp,
+			   struct ath12k_hw *ah,
+			   u8 *addr,
+			   struct ieee80211_sta *sta)
+{
+	dp->ops->peer_delete(ah, addr, sta);
+}
+
 static inline u32
 ath12k_dp_tx_comp_ring_size(const struct ath12k_dp_profile_params *p)
 {
drivers/net/wireless/ath/ath12k/dp_cmn.h +1 -0
index ff011fafc175..317da91ea92a 100644
@@ -79,6 +79,7 @@ struct ath12k_per_peer_tx_stats {
 };
 
 struct ath12k_dp_peer_create_params {
+	u8 addr[ETH_ALEN];
 	struct ieee80211_sta *sta;
 	bool is_mlo;
 	u16 peer_id;
drivers/net/wireless/ath/ath12k/dp_peer.c +11 -90

138 lines not on this page · raw message

drivers/net/wireless/ath/ath12k/dp_peer.h +5 -4
index 0a2b9d1814a5..5357b812959d 100644
@@ -185,10 +185,6 @@ int ath12k_dp_link_peer_rhash_add(struct ath12k_dp *dp,
 				  struct ath12k_dp_link_peer *peer);
 void ath12k_dp_link_peer_rhash_delete(struct ath12k_dp *dp,
 				      struct ath12k_dp_link_peer *peer);
-int ath12k_dp_peer_create(struct ath12k_dp_hw *dp_hw, u8 *addr,
-			  struct ath12k_dp_peer_create_params *params);
-void ath12k_dp_peer_delete(struct ath12k_dp_hw *dp_hw, u8 *addr,
-			   struct ieee80211_sta *sta);
 struct ath12k_dp_peer *ath12k_dp_peer_find_by_addr(struct ath12k_dp_hw *dp_hw, u8 *addr);
 struct ath12k_dp_peer *ath12k_dp_peer_find_by_addr_and_sta(struct ath12k_dp_hw *dp_hw,
 							   u8 *addr,
@@ -201,6 +197,9 @@ ath12k_dp_link_peer_find_by_peerid(struct ath12k_pdev_dp *dp_pdev, u16 peer_id);
 void ath12k_dp_link_peer_free(struct ath12k_dp_link_peer *peer);
 int ath12k_dp_peer_fixup_peer_id(struct ath12k_base *ab, const u8 *peer_addr,
 				 u16 peer_id);
+struct ath12k_dp_peer *ath12k_dp_peer_create_find(struct ath12k_dp_hw *dp_hw, u8 *addr,
+						  struct ieee80211_sta *sta,
+						  bool is_mlo);
 
 static inline struct ieee80211_sta *__must_check
 ath12k_dp_peer_get_sta(const struct ath12k_dp_peer *peer)
@@ -215,6 +214,8 @@ ath12k_dp_link_peer_get_sta(const struct ath12k_dp_link_peer *link_peer)
 		link_peer->dp_peer->sta : NULL;
 }
 
+void ath12k_dp_peer_hash_table_add(struct ath12k_dp_hw *dp_hw,
+				   struct ath12k_dp_peer *dp_peer);
 void ath12k_dp_peer_hash_table_delete(struct ath12k_dp_hw *dp_hw,
 				      struct ath12k_dp_peer *dp_peer);
 #endif
drivers/net/wireless/ath/ath12k/mac.c +22 -8
index 51ee44e72abf..4850fb6a77f5 100644
@@ -16,6 +16,7 @@
 #include "hw.h"
 #include "dp_tx.h"
 #include "dp_rx.h"
+#include "dp_peer.h"
 #include "testmode.h"
 #include "peer.h"
 #include "debugfs.h"
@@ -1269,7 +1270,8 @@ void ath12k_mac_peer_cleanup_all(struct ath12k *ar)
 	list_for_each_entry_safe_reverse(arvif, tmp_vif, &ar->arvifs, list) {
 		if ((arvif->ahvif->vdev_type == WMI_VDEV_TYPE_AP) &&
 		    (arvif->link_id < IEEE80211_MLD_MAX_NUM_LINKS)) {
-			ath12k_dp_peer_delete(dp_hw, arvif->bssid, NULL);
+			ath12k_dp_arch_peer_delete(ar->ab->dp, ar->ah, arvif->bssid,
+						   NULL);
 			arvif->num_stations = 0;
 		}
 	}
@@ -4329,7 +4331,8 @@ static void ath12k_mac_remove_link_interface(struct ieee80211_hw *hw,
 				    arvif->vdev_id, arvif->link_id, ret);
 
 		if (arvif->link_id < IEEE80211_MLD_MAX_NUM_LINKS)
-			ath12k_dp_peer_delete(&ah->dp_hw, arvif->bssid, NULL);
+			ath12k_dp_arch_peer_delete(ar->ab->dp, ah, arvif->bssid,
+						   NULL);
 	}
 	ath12k_mac_vdev_delete(ar, arvif);
 }
@@ -7824,8 +7827,16 @@ int ath12k_mac_op_sta_state(struct ieee80211_hw *hw,
 	u16 selected_links = 0;
 	u8 link_id = 0, i;
 	struct ath12k *ar;
-	int ret = -EINVAL;
+	/*
+	 * Since ath12k driver does not support cross generation Wi-Fi devices
+	 * participating in the same hardware group, all participating links
+	 * belong to the same Wi-Fi generation (Wi-Fi 7 or Wi-Fi 8) and share
+	 * the same dp->ops.
+	 * We use radio[0] to derive 'dp' and use it across this function.
+	 */
+	struct ath12k_dp *dp = ath12k_ah_to_ar(ah, 0)->ab->dp;
 	struct ath12k_dp_peer_create_params dp_params = {};
+	int ret = -EINVAL;
 
 	lockdep_assert_wiphy(hw->wiphy);
 
@@ -7869,11 +7880,12 @@ int ath12k_mac_op_sta_state(struct ieee80211_hw *hw,
 		}
 
 		dp_params.sta = sta;
+		ether_addr_copy(dp_params.addr, sta->addr);
 
 		if (vif->type == NL80211_IFTYPE_AP)
 			dp_params.ucast_ra_only = true;
 
-		ret = ath12k_dp_peer_create(&ah->dp_hw, sta->addr, &dp_params);
+		ret = ath12k_dp_arch_peer_create(dp, ah, &dp_params);
 		if (ret) {
 			ath12k_hw_warn(ah, "unable to create ath12k_dp_peer for sta %pM, ret: %d",
 				       sta->addr, ret);
@@ -7993,7 +8005,7 @@ int ath12k_mac_op_sta_state(struct ieee80211_hw *hw,
 		if (sta->mlo)
 			ath12k_mac_ml_station_remove(ahvif, ahsta);
 
-		ath12k_dp_peer_delete(&ah->dp_hw, sta->addr, sta);
+		ath12k_dp_arch_peer_delete(dp, ah, sta->addr, sta);
 	}
 
 	ret = 0;
@@ -8002,7 +8014,7 @@ int ath12k_mac_op_sta_state(struct ieee80211_hw *hw,
 free_unassign_link:
 	ath12k_mac_free_unassign_link_sta(ah, ahsta, link_id);
 peer_delete:
-	ath12k_dp_peer_delete(&ah->dp_hw, sta->addr, sta);
+	ath12k_dp_arch_peer_delete(dp, ah, sta->addr, sta);
 ml_peer_id_clear:
 	if (sta->mlo)
 		ath12k_peer_ml_free(ah, ahsta);
@@ -10589,7 +10601,8 @@ int ath12k_mac_vdev_create(struct ath12k *ar, struct ath12k_link_vif *arvif)
 		params.ucast_ra_only = true;
 
 		if (arvif->link_id < IEEE80211_MLD_MAX_NUM_LINKS) {
-			ret = ath12k_dp_peer_create(&ah->dp_hw, arvif->bssid, &params);
+			ether_addr_copy(params.addr, arvif->bssid);
+			ret = ath12k_dp_arch_peer_create(ab->dp, ah, &params);
 			if (ret) {
 				ath12k_warn(ab, "failed to vdev %d create dp_peer for AP: %d\n",
 					    arvif->vdev_id, ret);
@@ -10719,7 +10732,8 @@ int ath12k_mac_vdev_create(struct ath12k *ar, struct ath12k_link_vif *arvif)
 
 err_dp_peer_del:
 	if (dp_peer_created)
-		ath12k_dp_peer_delete(&ah->dp_hw, arvif->bssid, NULL);
+		ath12k_dp_arch_peer_delete(ab->dp, ah, arvif->bssid,
+					   NULL);
 
 err_vdev_del:
 	if (ahvif->vdev_type == WMI_VDEV_TYPE_MONITOR) {
drivers/net/wireless/ath/ath12k/wifi7/Makefile +2 -1
index 45b561cdba4b..d5ad76da4d3a 100644
@@ -15,6 +15,7 @@ ath12k_wifi7-y += core.o \
 		  hal.o \
 		  hal_qcn9274.o \
 		  hal_wcn7850.o \
-		  hal_qcc2072.o
+		  hal_qcc2072.o \
+		  dp_peer.o
 
 ath12k_wifi7-$(CONFIG_ATH12K_AHB) += ahb.o
drivers/net/wireless/ath/ath12k/wifi7/dp.c +3 -0
index 397da016bc78..b8b915884c7f 100644
@@ -10,6 +10,7 @@
 #include "hal_desc.h"
 #include "../dp_mon.h"
 #include "dp_mon.h"
+#include "dp_peer.h"
 #include "../dp_cmn.h"
 #include "dp_rx.h"
 #include "dp.h"
@@ -153,6 +154,8 @@ static const struct ath12k_dp_arch_ops ath12k_wifi7_dp_arch_ops = {
 	.peer_rx_tid_qref_setup = ath12k_wifi7_peer_rx_tid_qref_setup,
 	.peer_rx_tid_qref_reset = ath12k_wifi7_peer_rx_tid_qref_reset,
 	.rx_tid_delete_handler = ath12k_wifi7_dp_rx_tid_delete_handler,
+	.peer_create = ath12k_wifi7_dp_peer_create,
+	.peer_delete = ath12k_wifi7_dp_peer_delete,
 };
 
 /* TODO: remove export once this file is built with wifi7 ko */
drivers/net/wireless/ath/ath12k/wifi7/dp_peer.c new file +97 -0

97 lines not on this page · raw message

drivers/net/wireless/ath/ath12k/wifi7/dp_peer.h new file +18 -0
new file mode 100644
index 000000000000..0f152b05d95a
@@ -0,0 +1,18 @@
+/* SPDX-License-Identifier: BSD-3-Clause-Clear */
+/*
+ * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved.
+ * Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.
+ */
+
+#ifndef ATH12K_DP_PEER_WIFI7_H
+#define ATH12K_DP_PEER_WIFI7_H
+
+#include "../dp_cmn.h"
+#include "hw.h"
+
+int ath12k_wifi7_dp_peer_create(struct ath12k_hw *ah,
+				struct ath12k_dp_peer_create_params *params);
+void ath12k_wifi7_dp_peer_delete(struct ath12k_hw *ah, u8 *addr,
+				 struct ieee80211_sta *sta);
+
+#endif /* ATH12K_DP_PEER_WIFI7_H */

--
2.34.1

author
#2 lore raw

PATCH 2/10 wifi: ath12k: update peer index translation and ML peer ID allocation

In reply to Sriram R

In Wi-Fi 7, peer ID assignment is split: the host allocates ML peer IDs locally (and marks them with ATH12K_PEER_ML_ID_VALID), while firmware assigns link peer IDs for non-ML and link peers and notifies the host via the HTT_T2H Peer MAP event. The host must wait for this event before the dp_peer RCU table entry can be published. The two ID spaces are at different granularities (hw vs device), requiring a device-ID-based shift when computing the RCU table index for link/non-ML peers.

Wi-Fi 8 moves to a fully host-managed global peer ID model. A single unified ID space covers both ML and non-ML peers, and the host assigns the sw_peer_id before sending the WMI peer create command. HTT Peer MAP and MLO Peer MAP events are removed; there is no async firmware response for peer ID assignment. This simplifies the peer create path and eliminates the HTT event wait.

Introduce a global_peer_id_supported flag on ath12k_dp to distinguish the two models. Move the peer index to RCU table index translation into a common inline helper ath12k_dp_peer_get_peerid_index() in dp.h: when global peer ID is supported the index is the peer_id directly; otherwise the existing device-ID shift applies.

Also refactor ath12k_peer_ml_alloc() to accept the dp pointer and return an error code. On devices with global peer IDs, it sets the peer_id to ATH12K_MLO_PEER_ID_INVALID (the dp layer assigns the real ID during peer creation) and returns 0. On devices where firmware assigns the ML peer ID, it sets ATH12K_MLO_PEER_ID_PENDING. On host-allocating Wi-Fi 7 devices it allocates from the bitmap as before.

Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.6-01243-QCAHKSWPL_SILICONZ-1
Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.1.c7-00108-QCAHMTSWPL_V1.0_V2.0_SILICONZ_UPSTREAM-3

---
 drivers/net/wireless/ath/ath12k/core.h     |  4 ---
 drivers/net/wireless/ath/ath12k/dp.h       | 13 +++++++++
 drivers/net/wireless/ath/ath12k/dp_peer.c  | 17 ------------
 drivers/net/wireless/ath/ath12k/dp_peer.h  | 27 ++++++++++++++++---
 drivers/net/wireless/ath/ath12k/mac.c      | 21 +++++----------
 drivers/net/wireless/ath/ath12k/peer.c     | 31 +++++++++++++++++++---
 drivers/net/wireless/ath/ath12k/peer.h     |  2 +-
 drivers/net/wireless/ath/ath12k/wifi7/dp.c |  1 +
 8 files changed, 73 insertions(+), 43 deletions(-)
drivers/net/wireless/ath/ath12k/core.h +0 -4
index 56b509841126..5b9a247b8c40 100644
@@ -69,10 +69,6 @@
 #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
-#define ATH12K_MLO_PEER_ID_PENDING      0xFFFE
-
 #define ATH12K_INVALID_RSSI_FULL -1
 #define ATH12K_INVALID_RSSI_EMPTY -128
 
drivers/net/wireless/ath/ath12k/dp.h +13 -0
index d7a1ecd7cb0b..f439f43ed302 100644
@@ -284,6 +284,12 @@ struct ath12k_pdev_dp {
 #define DP_REO_QREF_NUM		GENMASK(31, 16)
 #define DP_MAX_PEER_ID		2047
 
+#define ATH12K_MAX_MLO_PEERS            256
+#define ATH12K_MLO_PEER_ID_INVALID      0xFFFF
+#define ATH12K_MLO_PEER_ID_PENDING      0xFFFE
+
+#define ATH12K_PEER_ML_ID_VALID  BIT(13)
+
 /* Total size of the LUT is based on 2K peers, each having reference
  * for 17tids, note each entry is of type ath12k_reo_queue_ref
  * hence total size is 2048 * 17 * 8 = 278528
@@ -531,6 +537,13 @@ struct ath12k_dp {
 	struct ath12k_hw_group *ag;
 	u8 device_id;
 
+	/*
+	 * When enabled, the device uses a single peer id allocator
+	 * common for ML and non ML peer in host instead of separate
+	 * ml peer id at host and firmware allocated link peer id/non ML peer ID
+	 */
+	bool global_peer_id_supported;
+
 	/* Lock for protection of peers and rhead_peer_addr */
 	spinlock_t dp_lock;
 
drivers/net/wireless/ath/ath12k/dp_peer.c +0 -17
index dc3da9e6d38a..7e45aef396a2 100644
@@ -458,23 +458,6 @@ ath12k_dp_peer_create_find(struct ath12k_dp_hw *dp_hw,
 }
 EXPORT_SYMBOL(ath12k_dp_peer_create_find);
 
-/*
- * Index of ath12k_dp_peer for MLO client is same as peer id of ath12k_dp_peer,
- * while for ath12k_dp_link_peer(mlo and non-mlo) and ath12k_dp_peer for
- * Non-MLO client it is derived as ((DEVICE_ID << 10) | (10 bits of peer id)).
- *
- * This is done because ml_peer_id and peer_id_table are at hw granularity,
- * while link_peer_id is at device granularity, hence in order to avoid
- * conflict this approach is followed.
- */
-#define ATH12K_DP_PEER_TABLE_DEVICE_ID_SHIFT        10
-
-u16 ath12k_dp_peer_get_peerid_index(struct ath12k_dp *dp, u16 peer_id)
-{
-	return (peer_id & ATH12K_PEER_ML_ID_VALID) ? peer_id :
-		((dp->device_id << ATH12K_DP_PEER_TABLE_DEVICE_ID_SHIFT) | peer_id);
-}
-
 struct ath12k_dp_peer *ath12k_dp_peer_find_by_peerid(struct ath12k_pdev_dp *dp_pdev,
 						     u16 peer_id)
 {
drivers/net/wireless/ath/ath12k/dp_peer.h +24 -3
index 5357b812959d..3ef0d7f3465b 100644
@@ -10,6 +10,7 @@
 #include "dp_rx.h"
 
 #define ATH12K_DP_PEER_ID_INVALID              0x3FFF
+#define ATH12K_DP_PEER_TABLE_DEVICE_ID_SHIFT  10
 
 struct ppdu_user_delayba {
 	u16 sw_peer_id;
@@ -21,8 +22,6 @@ struct ppdu_user_delayba {
 	u32 resp_rate_flags;
 };
 
-#define ATH12K_PEER_ML_ID_VALID         BIT(13)
-
 struct ath12k_rx_peer_rate_stats {
 	u64 ht_mcs_count[HAL_RX_MAX_MCS_HT + 1];
 	u64 vht_mcs_count[HAL_RX_MAX_MCS_VHT + 1];
@@ -189,7 +188,6 @@ struct ath12k_dp_peer *ath12k_dp_peer_find_by_addr(struct ath12k_dp_hw *dp_hw, u
 struct ath12k_dp_peer *ath12k_dp_peer_find_by_addr_and_sta(struct ath12k_dp_hw *dp_hw,
 							   u8 *addr,
 							   struct ieee80211_sta *sta);
-u16 ath12k_dp_peer_get_peerid_index(struct ath12k_dp *dp, u16 peer_id);
 struct ath12k_dp_peer *ath12k_dp_peer_find_by_peerid(struct ath12k_pdev_dp *dp_pdev,
 						     u16 peer_id);
 struct ath12k_dp_link_peer *
@@ -218,4 +216,27 @@ void ath12k_dp_peer_hash_table_add(struct ath12k_dp_hw *dp_hw,
 				   struct ath12k_dp_peer *dp_peer);
 void ath12k_dp_peer_hash_table_delete(struct ath12k_dp_hw *dp_hw,
 				      struct ath12k_dp_peer *dp_peer);
+
+/*
+ * When global_peer_id is supported, the index is same as the peer_id and no
+ * specific ml peer id or peer index per device is used.
+ *
+ * In other cases,
+ * Index of ath12k_dp_peer for MLO client is same as peer id of ath12k_dp_peer,
+ * while for ath12k_dp_link_peer(mlo and non-mlo) and ath12k_dp_peer for
+ * Non-MLO client it is derived as ((DEVICE_ID << 10) | (10 bits of peer id)).
+ *
+ * This is done because ml_peer_id and peer_id_table are at hw granularity,
+ * while link_peer_id is at device granularity, hence in order to avoid
+ * conflict this approach is followed.
+ */
+static inline u16
+ath12k_dp_peer_get_peerid_index(struct ath12k_dp *dp, u16 peer_id)
+{
+	if (dp->global_peer_id_supported)
+		return peer_id;
+
+	return (peer_id & ATH12K_PEER_ML_ID_VALID) ? peer_id
+		: ((dp->device_id << ATH12K_DP_PEER_TABLE_DEVICE_ID_SHIFT) | peer_id);
+}
 #endif
drivers/net/wireless/ath/ath12k/mac.c +7 -14
index 4850fb6a77f5..3baf317e375c 100644
@@ -7860,23 +7860,16 @@ int ath12k_mac_op_sta_state(struct ieee80211_hw *hw,
 		/* ML sta */
 		if (sta->mlo && !ahsta->links_map &&
 		    (hweight16(sta->valid_links) == 1)) {
-			if (ah->host_alloc_ml_id) {
-				ahsta->ml_peer_id = ath12k_peer_ml_alloc(ah);
-				if (ahsta->ml_peer_id == ATH12K_MLO_PEER_ID_INVALID) {
-					ath12k_hw_warn(ah, "unable to allocate ML peer id for sta %pM",
-						       sta->addr);
-					goto exit;
-				}
-			} else {
-				/*
-				 * firmware allocates the ML peer ID and notifies
-				 * the host via HTT_T2H_MSG_TYPE_MLO_RX_PEER_MAP
-				 */
-				ahsta->ml_peer_id = ATH12K_MLO_PEER_ID_PENDING;
+			ret = ath12k_peer_ml_alloc(ah, dp,
+						   &dp_params.peer_id);
+			if (ret) {
+				ath12k_hw_warn(ah, "unable to allocate ML peer id for sta %pM",
+					       sta->addr);
+				goto exit;
 			}
 
+			ahsta->ml_peer_id = dp_params.peer_id;
 			dp_params.is_mlo = true;
-			dp_params.peer_id = ahsta->ml_peer_id;
 		}
 
 		dp_params.sta = sta;
drivers/net/wireless/ath/ath12k/peer.c +27 -4
index 0e894408e97f..a989981dd72c 100644
@@ -327,12 +327,32 @@ int ath12k_peer_create(struct ath12k *ar, struct ath12k_link_vif *arvif,
 	return ret;
 }
 
-u16 ath12k_peer_ml_alloc(struct ath12k_hw *ah)
+int ath12k_peer_ml_alloc(struct ath12k_hw *ah, struct ath12k_dp *dp, u16 *peer_id)
 {
 	u16 ml_peer_id;
 
 	lockdep_assert_wiphy(ah->hw->wiphy);
 
+	/*
+	 * On devices that use globally unique peer IDs the peer ID is allocated
+	 * at host and is used as a common id to represent ML peer and its link peers
+	 * for MLO cases or just as the link peer id for non ML cases.
+	 */
+	if (dp->global_peer_id_supported) {
+		*peer_id = ATH12K_MLO_PEER_ID_INVALID;
+		return 0;
+	}
+
+	if (!ah->host_alloc_ml_id) {
+		/*
+		 * On devices where firmware assigns the ML peer ID, defer the
+		 * RCU table publish to the HTT_T2H_MSG_TYPE_MLO_RX_PEER_MAP
+		 * handler.
+		 */
+		*peer_id = ATH12K_MLO_PEER_ID_PENDING;
+		return 0;
+	}
+
 	for (ml_peer_id = 0; ml_peer_id < ATH12K_MAX_MLO_PEERS; ml_peer_id++) {
 		if (test_bit(ml_peer_id, ah->free_ml_peer_id_map))
 			continue;
@@ -341,10 +361,13 @@ u16 ath12k_peer_ml_alloc(struct ath12k_hw *ah)
 		break;
 	}
 
-	if (ml_peer_id == ATH12K_MAX_MLO_PEERS)
-		return ATH12K_MLO_PEER_ID_INVALID;
+	if (ml_peer_id == ATH12K_MAX_MLO_PEERS) {
+		*peer_id = ATH12K_MLO_PEER_ID_INVALID;
+		return -ENOMEM;
+	}
 
-	return ml_peer_id | ATH12K_PEER_ML_ID_VALID;
+	*peer_id = ml_peer_id | ATH12K_PEER_ML_ID_VALID;
+	return 0;
 }
 
 void ath12k_peer_ml_free(struct ath12k_hw *ah, struct ath12k_sta *ahsta)
drivers/net/wireless/ath/ath12k/peer.h +1 -1
index 3f4ac17b9aa6..c08f1e4d800d 100644
@@ -35,6 +35,6 @@ void ath12k_link_sta_rhash_delete(struct ath12k_base *ab, struct ath12k_link_sta
 int ath12k_link_sta_rhash_add(struct ath12k_base *ab, struct ath12k_link_sta *arsta);
 struct ath12k_link_sta *ath12k_link_sta_find_by_addr(struct ath12k_base *ab,
 						     const u8 *addr);
-u16 ath12k_peer_ml_alloc(struct ath12k_hw *ah);
+int ath12k_peer_ml_alloc(struct ath12k_hw *ah, struct ath12k_dp *dp, u16 *peer_id);
 void ath12k_peer_ml_free(struct ath12k_hw *ah, struct ath12k_sta *ahsta);
 #endif /* _PEER_H_ */
drivers/net/wireless/ath/ath12k/wifi7/dp.c +1 -0
index b8b915884c7f..fbdcb5bf05ab 100644
@@ -174,6 +174,7 @@ struct ath12k_dp *ath12k_wifi7_dp_device_alloc(struct ath12k_base *ab)
 	dp->hal = &ab->hal;
 
 	dp->ops = &ath12k_wifi7_dp_arch_ops;
+	dp->global_peer_id_supported = false;
 
 	return dp;
 }
Signature · 1 line
2.34.1
author
#3 lore raw

PATCH 3/10 wifi: ath12k: Add peer create confirmation event support

In reply to Sriram R

Wi-Fi 7 relies on the HTT peer-map event to confirm peer creation, but Wi-Fi 8 firmware does not send this event. Add a WMI PEER_CREATE_CONF event handler and a per-architecture map_event_required hw_param to distinguish the two families.

Wi-Fi 7 sets map_event_required true and returns immediately after the HTT peer-map event completes, since that is the exclusive confirmation signal for this path. Wi-Fi 8 sets it false and relies solely on the WMI PEER_CREATE_CONF event. Gate the PEER_CREATE_CONF event handler with !map_event_required so Wi-Fi 7 devices do not process it.

Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.6-01243-QCAHKSWPL_SILICONZ-1
Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.1.c7-00108-QCAHMTSWPL_V1.0_V2.0_SILICONZ_UPSTREAM-3

---
 drivers/net/wireless/ath/ath12k/core.c     |  1 +
 drivers/net/wireless/ath/ath12k/core.h     |  1 +
 drivers/net/wireless/ath/ath12k/hw.h       |  1 +
 drivers/net/wireless/ath/ath12k/mac.c      |  1 +
 drivers/net/wireless/ath/ath12k/peer.c     | 33 +++++++++-
 drivers/net/wireless/ath/ath12k/wifi7/hw.c |  7 +++
 drivers/net/wireless/ath/ath12k/wmi.c      | 71 ++++++++++++++++++++++
 drivers/net/wireless/ath/ath12k/wmi.h      | 23 +++++++
 8 files changed, 135 insertions(+), 3 deletions(-)
drivers/net/wireless/ath/ath12k/core.c +1 -0
index 6e0bb1fecc09..677eb6335008 100644
@@ -1567,6 +1567,7 @@ static void ath12k_core_pre_reconfigure_recovery(struct ath12k_base *ab)
 			complete(&ar->scan.started);
 			complete_all(&ar->scan.completed);
 			complete(&ar->scan.on_channel);
+			complete(&ar->peer_create_done);
 			complete(&ar->peer_assoc_done);
 			complete(&ar->peer_ext_event_done);
 			ath12k_peer_delete_wait_flush(ar);
drivers/net/wireless/ath/ath12k/core.h +1 -0
index 5b9a247b8c40..ffe686f95864 100644
@@ -693,6 +693,7 @@ struct ath12k {
 	u8 hw_link_id;
 	u8 radio_idx;
 
+	struct completion peer_create_done;
 	struct completion peer_assoc_done;
 	struct completion peer_ext_event_done;
 	struct list_head peer_delete_waits;
drivers/net/wireless/ath/ath12k/hw.h +1 -0
index b8045b33ca0d..ad6f074a1a67 100644
@@ -168,6 +168,7 @@ struct ath12k_hw_params {
 	u8 max_radios;
 	u8 max_htc_eps;
 	bool single_pdev_only:1;
+	bool map_event_required:1;
 	u32 qmi_service_ins_id;
 	u32 qmi_max_chunk_size;
 	bool internal_sleep_clock:1;
drivers/net/wireless/ath/ath12k/mac.c +1 -0
index 3baf317e375c..f494684d7eaf 100644
@@ -15286,6 +15286,7 @@ static void ath12k_mac_setup(struct ath12k *ar)
 
 	init_completion(&ar->vdev_setup_done);
 	init_completion(&ar->vdev_delete_done);
+	init_completion(&ar->peer_create_done);
 	init_completion(&ar->peer_assoc_done);
 	init_completion(&ar->peer_ext_event_done);
 	init_completion(&ar->install_key_done);
drivers/net/wireless/ath/ath12k/peer.c +30 -3
index a989981dd72c..982c62a208a3 100644
@@ -182,11 +182,36 @@ int ath12k_peer_delete(struct ath12k *ar, u32 vdev_id, u8 *addr)
 	return ret;
 }
 
-static int ath12k_wait_for_peer_created(struct ath12k *ar, int vdev_id, const u8 *addr)
+static int ath12k_wait_for_peer_map_event(struct ath12k *ar, int vdev_id, const u8 *addr)
 {
 	return ath12k_wait_for_dp_link_peer_common(ar->ab, vdev_id, addr, true);
 }
 
+static int ath12k_wait_for_peer_create_done(struct ath12k *ar, u32 vdev_id,
+					    const u8 *addr)
+{
+	struct ath12k_base *ab = ar->ab;
+	unsigned long time_left;
+
+	/*
+	 * On devices that confirm peer creation via the HTT peer-map event,
+	 * peer_create_done is not used - the peer-map is the exclusive signal.
+	 */
+	if (ab->hw_params->map_event_required)
+		return ath12k_wait_for_peer_map_event(ar, vdev_id, addr);
+
+	/* On devices that use WMI PEER_CREATE_CONF instead of HTT peer-map. */
+	time_left = wait_for_completion_timeout(&ar->peer_create_done, 3 * HZ);
+	if (!time_left) {
+		ath12k_warn(ar->ab,
+			    "timeout waiting for peer_create_done peer_addr:%pM\n",
+			    addr);
+		return -ETIMEDOUT;
+	}
+
+	return 0;
+}
+
 int ath12k_peer_create(struct ath12k *ar, struct ath12k_link_vif *arvif,
 		       struct ieee80211_sta *sta,
 		       struct ath12k_wmi_peer_create_arg *arg)
@@ -221,6 +246,8 @@ int ath12k_peer_create(struct ath12k *ar, struct ath12k_link_vif *arvif,
 	}
 	spin_unlock_bh(&dp->dp_lock);
 
+	reinit_completion(&ar->peer_create_done);
+
 	ret = ath12k_wmi_send_peer_create_cmd(ar, arg);
 	if (ret) {
 		ath12k_warn(ar->ab,
@@ -229,8 +256,8 @@ int ath12k_peer_create(struct ath12k *ar, struct ath12k_link_vif *arvif,
 		return ret;
 	}
 
-	ret = ath12k_wait_for_peer_created(ar, arg->vdev_id,
-					   arg->peer_addr);
+	ret = ath12k_wait_for_peer_create_done(ar, arg->vdev_id,
+					       arg->peer_addr);
 	if (ret)
 		return ret;
 
drivers/net/wireless/ath/ath12k/wifi7/hw.c +7 -0
index 978f2e0ce7e7..05cdb8e88827 100644
@@ -418,6 +418,7 @@ static const struct ath12k_hw_params ath12k_wifi7_hw_params[] = {
 		.max_radios = 1,
 		.max_htc_eps = 9,
 		.single_pdev_only = false,
+		.map_event_required = true,
 		.qmi_service_ins_id = ATH12K_QMI_WLFW_SERVICE_INS_ID_V01_QCN9274,
 		.qmi_max_chunk_size = SZ_2M,
 		.internal_sleep_clock = false,
@@ -517,6 +518,7 @@ static const struct ath12k_hw_params ath12k_wifi7_hw_params[] = {
 		.max_radios = 1,
 		.max_htc_eps = 9,
 		.single_pdev_only = true,
+		.map_event_required = true,
 		.qmi_service_ins_id = ATH12K_QMI_WLFW_SERVICE_INS_ID_V01_WCN7850,
 		.qmi_max_chunk_size = SZ_512K,
 		.internal_sleep_clock = true,
@@ -616,6 +618,7 @@ static const struct ath12k_hw_params ath12k_wifi7_hw_params[] = {
 		.max_radios = 2,
 		.max_htc_eps = 9,
 		.single_pdev_only = false,
+		.map_event_required = true,
 		.qmi_service_ins_id = ATH12K_QMI_WLFW_SERVICE_INS_ID_V01_QCN9274,
 		.qmi_max_chunk_size = SZ_2M,
 		.internal_sleep_clock = false,
@@ -713,6 +716,7 @@ static const struct ath12k_hw_params ath12k_wifi7_hw_params[] = {
 		.max_radios = 1,
 		.max_htc_eps = 9,
 		.single_pdev_only = false,
+		.map_event_required = true,
 		.qmi_service_ins_id = ATH12K_QMI_WLFW_SERVICE_INS_ID_V01_IPQ5332,
 		.qmi_max_chunk_size = SZ_2M,
 		.internal_sleep_clock = false,
@@ -806,6 +810,7 @@ static const struct ath12k_hw_params ath12k_wifi7_hw_params[] = {
 		.max_radios = 1,
 		.max_htc_eps = 9,
 		.single_pdev_only = true,
+		.map_event_required = true,
 		.qmi_service_ins_id = ATH12K_QMI_WLFW_SERVICE_INS_ID_V01_WCN7850,
 		.qmi_max_chunk_size = SZ_512K,
 		.internal_sleep_clock = true,
@@ -906,6 +911,7 @@ static const struct ath12k_hw_params ath12k_wifi7_hw_params[] = {
 		.max_radios = 1,
 		.max_htc_eps = 9,
 		.single_pdev_only = false,
+		.map_event_required = true,
 		.qmi_service_ins_id = ATH12K_QMI_WLFW_SERVICE_INS_ID_V01_IPQ5332,
 		.qmi_max_chunk_size = SZ_2M,
 		.internal_sleep_clock = false,
@@ -1000,6 +1006,7 @@ static const struct ath12k_hw_params ath12k_wifi7_hw_params[] = {
 		.max_radios = 1,
 		.max_htc_eps = 9,
 		.single_pdev_only = false,
+		.map_event_required = true,
 		.qmi_service_ins_id = ATH12K_QMI_WLFW_SERVICE_INS_ID_V01_QCN6432,
 		.qmi_max_chunk_size = SZ_2M,
 		.internal_sleep_clock = false,
drivers/net/wireless/ath/ath12k/wmi.c +71 -0

89 lines not on this page · raw message

drivers/net/wireless/ath/ath12k/wmi.h +23 -0
index 843f1d11f9c8..ab39c33ef61a 100644
@@ -791,6 +791,7 @@ enum wmi_tlv_event_id {
 	WMI_PEER_RESERVED9_EVENTID,
 	WMI_PEER_RESERVED10_EVENTID,
 	WMI_PEER_OPER_MODE_CHANGE_EVENTID,
+	WMI_PEER_CREATE_CONF_EVENTID = WMI_PEER_OPER_MODE_CHANGE_EVENTID + 3,
 	WMI_MGMT_RX_EVENTID = WMI_TLV_CMD(WMI_GRP_MGMT),
 	WMI_HOST_SWBA_EVENTID,
 	WMI_TBTTOFFSET_UPDATE_EVENTID,
@@ -1998,6 +1999,7 @@ enum wmi_tlv_tag {
 	WMI_TAG_PDEV_PEER_PKTLOG_FILTER_INFO,
 	WMI_TAG_SERVICE_READY_EXT2_EVENT = 0x334,
 	WMI_TAG_FILS_DISCOVERY_TMPL_CMD = 0x344,
+	WMI_TAG_PEER_CREATE_RESP_EVENT = 0x364,
 	WMI_TAG_MAC_PHY_CAPABILITIES_EXT = 0x36F,
 	WMI_TAG_PDEV_SRG_BSS_COLOR_BITMAP_CMD = 0x37b,
 	WMI_TAG_PDEV_SRG_PARTIAL_BSSID_BITMAP_CMD,
@@ -6579,6 +6581,27 @@ int ath12k_wmi_attach(struct ath12k_base *ab);
 void ath12k_wmi_detach(struct ath12k_base *ab);
 int ath12k_wmi_vdev_create(struct ath12k *ar, u8 *macaddr,
 			   struct ath12k_wmi_vdev_create_arg *arg);
+
+enum ath12k_peer_create_conf_status {
+	ATH12K_WMI_PEER_CREATE_SUCCESS,
+	ATH12K_WMI_PEER_BSS_PEER_EXISTS,
+	ATH12K_WMI_PEER_AST_FULL,
+	ATH12K_WMI_PEER_SW_PEER_ID_INVALID,
+	ATH12K_WMI_PEER_CREATE_STATUS_MAX
+};
+
+struct ath12k_wmi_peer_create_conf_event {
+	__le32 vdev_id;
+	struct ath12k_wmi_mac_addr_params peer_macaddr;
+	__le32 status;
+} __packed;
+
+struct ath12k_wmi_peer_create_conf_arg {
+	u32 vdev_id;
+	u8 mac_addr[ETH_ALEN];
+	u32 status;
+};
+
 int ath12k_wmi_send_peer_create_cmd(struct ath12k *ar,
 				    struct ath12k_wmi_peer_create_arg *arg);
 int ath12k_wmi_vdev_set_param_cmd(struct ath12k *ar, u32 vdev_id,
Signature · 1 line
2.34.1
author
#4 lore raw

PATCH 4/10 wifi: ath12k: Introduce ml_ready flag for ML peer ID registration tracking

In reply to Sriram R

From: Ramya Gnanasekar <[email protected]>

Using ATH12K_MLO_PEER_ID_INVALID as a sentinel to check whether a station is MLO is fragile since ml_peer_id can remain unset on Wi-Fi 8 devices as it uses a global peer id mechanism and hence ATH12K_MLO_PEER_ID_INVALID check becomes unreliable to check if ahsta is a ML peer or not.

Introduce an explicit ml_ready flag in ath12k_sta and set it once ml_peer_id has been initialized. On chips that use host_alloc_ml_id, ml_peer_id holds the host-allocated ID; on chips where firmware assigns the ML peer ID, ml_peer_id is set to ATH12K_MLO_PEER_ID_PENDING and on Wi-Fi 8 devices that use a global peer ID, ml_peer_id is set to ATH12K_MLO_PEER_ID_INVALID as no ML peer ID allocation is needed. Replace the ml_peer_id invalid sentinel checks with this flag.

Also, since the Wi-Fi 8 firmware doesn't support peer map events for link peer id allocation and expect to use this global peer id allocated at host, the dp peer uses this common peer id, leaving the link peer id to be unused/invalid. Hence, add a common guard for RCU table updates in dp_link_peer_assign/unassign with an ATH12K_MLO_PEER_ID_INVALID check.

Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.6-01243-QCAHKSWPL_SILICONZ-1
Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.1.c7-00108-QCAHMTSWPL_V1.0_V2.0_SILICONZ_UPSTREAM-3

---
 drivers/net/wireless/ath/ath12k/core.h    |  1 +
 drivers/net/wireless/ath/ath12k/dp_peer.c | 23 ++++++++++-------------
 drivers/net/wireless/ath/ath12k/mac.c     | 17 +++++++++--------
 drivers/net/wireless/ath/ath12k/peer.c    |  1 +
 4 files changed, 21 insertions(+), 21 deletions(-)
drivers/net/wireless/ath/ath12k/core.h +1 -0
index ffe686f95864..e1602236c3c1 100644
@@ -535,6 +535,7 @@ struct ath12k_sta {
 	u16 links_map;
 	u8 assoc_link_id;
 	u16 ml_peer_id;
+	bool ml_ready;
 	u16 free_logical_link_idx_map;
 
 	enum ieee80211_sta_state state;
drivers/net/wireless/ath/ath12k/dp_peer.c +10 -13
index 7e45aef396a2..79fc8416a59f 100644
@@ -570,13 +570,6 @@ int ath12k_dp_link_peer_assign(struct ath12k_dp *dp, struct ath12k_dp_hw *dp_hw,
 		goto err_dp_peer;
 	}
 
-	/*
-	 * Set peer_id in dp_peer for non-mlo client, peer_id for mlo client is
-	 * set during dp_peer create
-	 */
-	if (!dp_peer->is_mlo)
-		dp_peer->peer_id = peer->peer_id;
-
 	peer->dp_peer = dp_peer;
 
 	/*
@@ -590,12 +583,15 @@ int ath12k_dp_link_peer_assign(struct ath12k_dp *dp, struct ath12k_dp_hw *dp_hw,
 		dp_peer->link_id_map[peer->drv_link_id] = link_id;
 	}
 
-	peerid_index = ath12k_dp_peer_get_peerid_index(dp, peer->peer_id);
+	if (peer->peer_id != ATH12K_MLO_PEER_ID_INVALID) {
+		if (!dp_peer->is_mlo)
+			dp_peer->peer_id = peer->peer_id;
+		peerid_index = ath12k_dp_peer_get_peerid_index(dp, peer->peer_id);
+		rcu_assign_pointer(dp_hw->dp_peers[peerid_index], dp_peer);
+	}
 
 	rcu_assign_pointer(dp_peer->link_peers[peer->link_id], peer);
 
-	rcu_assign_pointer(dp_hw->dp_peers[peerid_index], dp_peer);
-
 	spin_unlock_bh(&dp_hw->peer_lock);
 
 	if (dp->hw_params->support_hw_link_id) {
@@ -658,11 +654,12 @@ void ath12k_dp_link_peer_unassign(struct ath12k_dp *dp, struct ath12k_dp_hw *dp_
 
 	ath12k_dp_peer_free_logical_link_id(dp, peer);
 
-	peerid_index = ath12k_dp_peer_get_peerid_index(dp, peer->peer_id);
-
 	rcu_assign_pointer(dp_peer->link_peers[peer->link_id], NULL);
 
-	rcu_assign_pointer(dp_hw->dp_peers[peerid_index], NULL);
+	if (peer->peer_id != ATH12K_MLO_PEER_ID_INVALID) {
+		peerid_index = ath12k_dp_peer_get_peerid_index(dp, peer->peer_id);
+		rcu_assign_pointer(dp_hw->dp_peers[peerid_index], NULL);
+	}
 
 	spin_unlock_bh(&dp_hw->peer_lock);
 
drivers/net/wireless/ath/ath12k/mac.c +9 -8
index f494684d7eaf..d61dd251eeef 100644
@@ -1241,9 +1241,13 @@ void ath12k_mac_peer_cleanup_all(struct ath12k *ar)
 		spin_lock_bh(&dp_hw->peer_lock);
 		dp_peer = peer->dp_peer;
 		if (dp_peer) {
-			peerid_index = ath12k_dp_peer_get_peerid_index(dp, peer->peer_id);
 			rcu_assign_pointer(dp_peer->link_peers[peer->link_id], NULL);
-			rcu_assign_pointer(dp_hw->dp_peers[peerid_index], NULL);
+			if (peer->peer_id != ATH12K_MLO_PEER_ID_INVALID) {
+				peerid_index =
+					ath12k_dp_peer_get_peerid_index(dp,
+									peer->peer_id);
+				rcu_assign_pointer(dp_hw->dp_peers[peerid_index], NULL);
+			}
 		}
 		spin_unlock_bh(&dp_hw->peer_lock);
 
@@ -3555,11 +3559,7 @@ static void ath12k_peer_assoc_h_mlo(struct ath12k_link_sta *arsta,
 	u8 link_id;
 	int i;
 
-	if (!sta->mlo)
-		return;
-
-	if (ah->host_alloc_ml_id &&
-	    ahsta->ml_peer_id == ATH12K_MLO_PEER_ID_INVALID)
+	if (!sta->mlo || !ahsta->ml_ready)
 		return;
 
 	ml->enabled = true;
@@ -7869,6 +7869,7 @@ int ath12k_mac_op_sta_state(struct ieee80211_hw *hw,
 			}
 
 			ahsta->ml_peer_id = dp_params.peer_id;
+			ahsta->ml_ready = true;
 			dp_params.is_mlo = true;
 		}
 
@@ -8262,7 +8263,7 @@ int ath12k_mac_op_change_sta_links(struct ieee80211_hw *hw,
 	if (new_links < old_links)
 		return 0;
 
-	if (ahsta->ml_peer_id == ATH12K_MLO_PEER_ID_INVALID) {
+	if (!ahsta->ml_ready) {
 		ath12k_hw_warn(ah, "unable to add link for ml sta %pM", sta->addr);
 		return -EINVAL;
 	}
drivers/net/wireless/ath/ath12k/peer.c +1 -0
index 982c62a208a3..b11a7c38def6 100644
@@ -411,6 +411,7 @@ void ath12k_peer_ml_free(struct ath12k_hw *ah, struct ath12k_sta *ahsta)
 		clear_bit(ahsta->ml_peer_id & ~ATH12K_PEER_ML_ID_VALID,
 			  ah->free_ml_peer_id_map);
 	ahsta->ml_peer_id = ATH12K_MLO_PEER_ID_INVALID;
+	ahsta->ml_ready = false;
 }
 
 int ath12k_peer_mlo_link_peers_delete(struct ath12k_vif *ahvif, struct ath12k_sta *ahsta)
Signature · 1 line
2.34.1
author
#5 lore raw

PATCH 5/10 wifi: ath12k: Prepare WMI to pass peer id and STA id for Wi-Fi 8

In reply to Sriram R

From: Ramya Gnanasekar <[email protected]>

On devices with global_peer_id_supported enabled, the host allocates peer_id and sta_id from local bitmaps before issuing WMI peer create. Extend the WMI peer create command to carry these host-allocated IDs so firmware can use them directly.

peer_id (sw_peer_id in firmware) is the sw peer identifier. It covers all peer types including remote peers, self peers, with additional bubble space to handle simultaneous create/delete races.

sta_id (hw_peer_id in firmware) is the hardware station index allocated exclusively for actual remote peers and its usage in firmware.

Add sta_id to ath12k_dp_peer_create_params and ath12k_dp_peer. Add peer_id and sta_id accessor helpers to retrieve the values from the dp_peer table by address and sta object. These accessor apis are planned to be used only in station association path where a valid sta object is available.
Pass the allocated IDs into the WMI peer create command when valid.

Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.6-01243-QCAHKSWPL_SILICONZ-1
Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.1.c7-00108-QCAHMTSWPL_V1.0_V2.0_SILICONZ_UPSTREAM-3

---
 drivers/net/wireless/ath/ath12k/core.h        |  2 ++
 drivers/net/wireless/ath/ath12k/dp_cmn.h      |  5 ++++
 drivers/net/wireless/ath/ath12k/dp_peer.c     | 30 +++++++++++++++++++
 drivers/net/wireless/ath/ath12k/dp_peer.h     |  3 +-
 drivers/net/wireless/ath/ath12k/mac.c         | 19 ++++++++++--
 .../net/wireless/ath/ath12k/wifi7/dp_peer.c   |  1 +
 drivers/net/wireless/ath/ath12k/wmi.c         | 13 ++++++--
 drivers/net/wireless/ath/ath12k/wmi.h         |  7 +++++
 8 files changed, 74 insertions(+), 6 deletions(-)
drivers/net/wireless/ath/ath12k/core.h +2 -0
index e1602236c3c1..796d78f84bb6 100644
@@ -69,6 +69,8 @@
 #define ATH12K_INVALID_GROUP_ID  0xFF
 #define ATH12K_INVALID_DEVICE_ID 0xFF
 
+#define ATH12K_STA_ID_INVALID		0xFFFF
+
 #define ATH12K_INVALID_RSSI_FULL -1
 #define ATH12K_INVALID_RSSI_EMPTY -128
 
drivers/net/wireless/ath/ath12k/dp_cmn.h +5 -0
index 317da91ea92a..8be1d92e1b65 100644
@@ -83,6 +83,7 @@ struct ath12k_dp_peer_create_params {
 	struct ieee80211_sta *sta;
 	bool is_mlo;
 	u16 peer_id;
+	u16 sta_id;
 	bool ucast_ra_only;
 };
 
@@ -117,4 +118,8 @@ void
 ath12k_dp_link_peer_get_sta_rate_info_stats(struct ath12k_dp *dp, const u8 *addr,
 					    struct ath12k_dp_link_peer_rate_info *info);
 void ath12k_dp_link_peer_reset_rx_stats(struct ath12k_dp *dp, const u8 *addr);
+u16 ath12k_dp_peer_get_peer_id(struct ath12k_dp_hw *dp_hw,
+			       struct ieee80211_sta *sta);
+u16 ath12k_dp_peer_get_sta_id(struct ath12k_dp_hw *dp_hw,
+			      struct ieee80211_sta *sta);
 #endif
drivers/net/wireless/ath/ath12k/dp_peer.c +30 -0
index 79fc8416a59f..e945e4fc7b59 100644
@@ -541,6 +541,36 @@ static void ath12k_dp_peer_free_logical_link_id(struct ath12k_dp *dp,
 	dp_peer->free_slot_map |= BIT(peer->drv_link_id);
 }
 
+u16 ath12k_dp_peer_get_peer_id(struct ath12k_dp_hw *dp_hw,
+			       struct ieee80211_sta *sta)
+{
+	u16 peer_id = ATH12K_MLO_PEER_ID_INVALID;
+	struct ath12k_dp_peer *dp_peer;
+
+	spin_lock_bh(&dp_hw->peer_lock);
+	dp_peer = ath12k_dp_peer_find_by_addr_and_sta(dp_hw, sta->addr, sta);
+	if (dp_peer)
+		peer_id = dp_peer->peer_id;
+	spin_unlock_bh(&dp_hw->peer_lock);
+
+	return peer_id;
+}
+
+u16 ath12k_dp_peer_get_sta_id(struct ath12k_dp_hw *dp_hw,
+			      struct ieee80211_sta *sta)
+{
+	u16 sta_id = ATH12K_STA_ID_INVALID;
+	struct ath12k_dp_peer *dp_peer;
+
+	spin_lock_bh(&dp_hw->peer_lock);
+	dp_peer = ath12k_dp_peer_find_by_addr_and_sta(dp_hw, sta->addr, sta);
+	if (dp_peer)
+		sta_id = dp_peer->sta_id;
+	spin_unlock_bh(&dp_hw->peer_lock);
+
+	return sta_id;
+}
+
 int ath12k_dp_link_peer_assign(struct ath12k_dp *dp, struct ath12k_dp_hw *dp_hw,
 			       u8 vdev_id, struct ieee80211_sta *sta, u8 *addr,
 			       u8 link_id, u32 hw_link_id)
drivers/net/wireless/ath/ath12k/dp_peer.h +2 -1
index 3ef0d7f3465b..f43c3337aa37 100644
@@ -134,7 +134,8 @@ struct ath12k_dp_peer {
 
 	u8 mcast_keyidx;
 	bool ucast_ra_only;
-	int peer_id;
+	u16 peer_id;
+	u16 sta_id;
 	struct ieee80211_sta *sta;
 
 	/*
drivers/net/wireless/ath/ath12k/mac.c +16 -3
index d61dd251eeef..a2cdcfd485e9 100644
@@ -3570,7 +3570,9 @@ static void ath12k_peer_assoc_h_mlo(struct ath12k_link_sta *arsta,
 	/*
 	 * Only chips that allocate the MLD peer ID on the host send a valid
 	 * ml_peer_id in WMI_PEER_ASSOC_CMDID. For chips where the firmware
-	 * picks the ID, leave peer_id_valid false to avoid unexpected issues.
+	 * picks the ID, leave peer_id_valid false to avoid unexpected issue.
+	 * On devices that use a single host-allocated peer ID, ml_peer_id is
+	 * not applicable and peer_id_valid is also left false.
 	 */
 	ml->peer_id_valid = ah->host_alloc_ml_id;
 	ml->logical_link_idx_valid = true;
@@ -7249,6 +7251,12 @@ static int ath12k_mac_station_add(struct ath12k *ar,
 	peer_param.peer_addr = arsta->addr;
 	peer_param.peer_type = WMI_PEER_TYPE_DEFAULT;
 	peer_param.ml_enabled = sta->mlo;
+	peer_param.peer_id = ATH12K_MLO_PEER_ID_INVALID;
+	peer_param.sta_id = ATH12K_STA_ID_INVALID;
+	if (ab->dp->global_peer_id_supported) {
+		peer_param.peer_id = ath12k_dp_peer_get_peer_id(&ar->ah->dp_hw, sta);
+		peer_param.sta_id = ath12k_dp_peer_get_sta_id(&ar->ah->dp_hw, sta);
+	}
 
 	ret = ath12k_peer_create(ar, arvif, sta, &peer_param);
 	if (ret) {
@@ -10495,13 +10503,16 @@ int ath12k_mac_vdev_create(struct ath12k *ar, struct ath12k_link_vif *arvif)
 	struct ath12k_wmi_vdev_create_arg vdev_arg = {};
 	struct ath12k_wmi_peer_create_arg peer_param = {};
 	struct ieee80211_bss_conf *link_conf = NULL;
+	struct ath12k_dp_peer_create_params params = {
+		.peer_id = ATH12K_MLO_PEER_ID_INVALID,
+		.sta_id = ATH12K_STA_ID_INVALID,
+	};
+	struct ath12k_dp_link_vif *dp_link_vif = NULL;
 	u32 param_id, param_value;
 	u16 nss;
 	int i;
 	int ret, vdev_id;
 	u8 link_id;
-	struct ath12k_dp_link_vif *dp_link_vif = NULL;
-	struct ath12k_dp_peer_create_params params = {};
 	bool dp_peer_created = false;
 
 	lockdep_assert_wiphy(hw->wiphy);
@@ -10608,6 +10619,8 @@ int ath12k_mac_vdev_create(struct ath12k *ar, struct ath12k_link_vif *arvif)
 		peer_param.vdev_id = arvif->vdev_id;
 		peer_param.peer_addr = arvif->bssid;
 		peer_param.peer_type = WMI_PEER_TYPE_DEFAULT;
+		peer_param.peer_id = params.peer_id;
+		peer_param.sta_id = params.sta_id;
 		ret = ath12k_peer_create(ar, arvif, NULL, &peer_param);
 		if (ret) {
 			ath12k_warn(ab, "failed to vdev %d create peer for AP: %d\n",
drivers/net/wireless/ath/ath12k/wifi7/dp_peer.c +1 -0
index 73034ae7d0cd..c2636e87b4c2 100644
@@ -40,6 +40,7 @@ int ath12k_wifi7_dp_peer_create(struct ath12k_hw *ah,
 	 * assigned at the time of link peer creation
 	 */
 	dp_peer->peer_id = params->is_mlo ? params->peer_id : ATH12K_DP_PEER_ID_INVALID;
+	dp_peer->sta_id = ATH12K_STA_ID_INVALID;
 	dp_peer->ucast_ra_only = params->ucast_ra_only;
 
 	dp_peer->sec_type = HAL_ENCRYPT_TYPE_OPEN;
drivers/net/wireless/ath/ath12k/wmi.c +11 -2
index 76f93a4f14b1..b51137193e1d 100644
@@ -1368,6 +1368,14 @@ 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);
 
+	if (arg->peer_id != ATH12K_MLO_PEER_ID_INVALID)
+		cmd->peer_id = cpu_to_le32(arg->peer_id);
+
+	if (arg->sta_id != ATH12K_STA_ID_INVALID) {
+		cmd->flags = cpu_to_le32(ATH12K_WMI_PEER_CREATE_FLAG_STA_ID_VALID);
+		cmd->sta_id = cpu_to_le32(arg->sta_id);
+	}
+
 	ptr = skb->data + sizeof(*cmd);
 	tlv = ptr;
 	tlv->header = ath12k_wmi_tlv_hdr(WMI_TAG_ARRAY_STRUCT,
@@ -1383,8 +1391,9 @@ int ath12k_wmi_send_peer_create_cmd(struct ath12k *ar,
 	ptr += sizeof(*ml_param);
 
 	ath12k_dbg(ar->ab, ATH12K_DBG_WMI,
-		   "WMI peer create vdev_id %d peer_addr %pM ml_flags 0x%x\n",
-		   arg->vdev_id, arg->peer_addr, ml_param->flags);
+		   "WMI peer create vdev_id %d peer_addr %pM ml_flags 0x%x peer_id %d sta_id %d\n",
+		   arg->vdev_id, arg->peer_addr, ml_param->flags,
+		   arg->peer_id, arg->sta_id);
 
 	ret = ath12k_wmi_cmd_send(wmi, skb, WMI_PEER_CREATE_CMDID);
 	if (ret) {
drivers/net/wireless/ath/ath12k/wmi.h +7 -0
index ab39c33ef61a..513974b3b4eb 100644
@@ -3197,6 +3197,8 @@ struct ath12k_wmi_peer_create_arg {
 	u32 peer_type;
 	u32 vdev_id;
 	bool ml_enabled;
+	u32 peer_id;
+	u32 sta_id;
 };
 
 struct wmi_peer_create_mlo_params {
@@ -3304,11 +3306,16 @@ enum wmi_peer_type {
 	WMI_PEER_TYPE_TDLS = 2,
 };
 
+#define ATH12K_WMI_PEER_CREATE_FLAG_STA_ID_VALID	BIT(0)
+
 struct wmi_peer_create_cmd {
 	__le32 tlv_header;
 	__le32 vdev_id;
 	struct ath12k_wmi_mac_addr_params peer_macaddr;
 	__le32 peer_type;
+	__le32 flags;
+	__le32 peer_id;
+	__le32 sta_id;
 } __packed;
 
 struct wmi_peer_delete_cmd {
Signature · 1 line
2.34.1
author
#6 lore raw

PATCH 6/10 wifi: ath12k: Add CUMAC device configuration command support

In reply to Sriram R

Central UMAC (CUMAC) designates one device in a multi-device group as the master MAC for coordinating shared resources. Add WMI command support to configure which device ID acts as CUMAC during hardware group initialisation. All devices in the group that support the command receive WMI_PDEV_SET_CUMAC_DEVICE_CMDID carrying the CUMAC device ID, so each device learns which one acts as the central coordinator.

The driver checks WMI_TLV_SERVICE_PDEV_SET_CUMAC_DEVICE_CMD_SUPPORT in the service bitmap to determine whether to send the configuration. When supported, WMI_RSRC_CFG_HOST_SVC_FLAG_CUMAC_CMD_SUPPORT_BIT is also set in the host service flags during resource config.

The first device is selected as CUMAC by default; selection logic will be extended later to pick the optimal device. Failure to configure CUMAC on any device aborts the hardware group start.

Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.6-01243-QCAHKSWPL_SILICONZ-1
Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.1.c7-00108-QCAHMTSWPL_V1.0_V2.0_SILICONZ_UPSTREAM-3

---
 drivers/net/wireless/ath/ath12k/core.c | 71 ++++++++++++++++++++
 drivers/net/wireless/ath/ath12k/core.h |  2 +
 drivers/net/wireless/ath/ath12k/mac.c  |  1 +
 drivers/net/wireless/ath/ath12k/wmi.c  | 90 ++++++++++++++++++++++++++
 drivers/net/wireless/ath/ath12k/wmi.h  | 23 +++++++
 5 files changed, 187 insertions(+)
drivers/net/wireless/ath/ath12k/core.c +71 -0
index 677eb6335008..1c2b7e4ee411 100644
@@ -1192,6 +1192,67 @@ static int ath12k_core_mlo_setup(struct ath12k_hw_group *ag)
 	return ret;
 }
 
+static int ath12k_core_send_cumac_config(struct ath12k_hw_group *ag)
+{
+	/* Select device 0 as CUMAC; selection logic to be extended later */
+	u8 cumac_device_id = 0;
+	int i;
+
+	if (ath12k_ftm_mode)
+		return 0;
+
+	for (i = 0; i < ag->num_devices; i++) {
+		struct ath12k_base *cab = ag->ab[i];
+		int j, ret;
+
+		if (!cab)
+			continue;
+
+		if (!test_bit(WMI_TLV_SERVICE_PDEV_SET_CUMAC_DEVICE_CMD_SUPPORT,
+			      cab->wmi_ab.svc_map))
+			continue;
+
+		ath12k_dbg(cab, ATH12K_DBG_BOOT,
+			   "cumac: selected device_id=%u as cumac\n",
+			   cumac_device_id);
+
+		for (j = 0; j < cab->num_radios; j++) {
+			struct ath12k *car = cab->pdevs[j].ar;
+
+			if (!car)
+				continue;
+
+			reinit_completion(&car->cumac_setup_done);
+			ret = ath12k_wmi_send_cumac_config(car, cumac_device_id);
+			if (ret) {
+				ath12k_warn(cab, "cumac: failed to send config pdev_id=%u: %d\n",
+					    car->pdev->pdev_id, ret);
+				return ret;
+			}
+
+			if (!wait_for_completion_timeout(&car->cumac_setup_done,
+							 ATH12K_CUMAC_SETUP_TIMEOUT_HZ)) {
+				ath12k_warn(cab, "cumac: timeout pdev_id=%u\n",
+					    car->pdev->pdev_id);
+				return -ETIMEDOUT;
+			}
+
+			ath12k_dbg(cab, ATH12K_DBG_BOOT,
+				   "cumac: config sent successfully pdev_id=%u\n",
+				   car->pdev->pdev_id);
+
+			/*
+			 * CUMAC config is a per-device setting. One WMI command
+			 * per device is sufficient. So break after sending
+			 * to the first active radio on the device.
+			 */
+			break;
+		}
+	}
+
+	return 0;
+}
+
 static int ath12k_core_hw_group_start(struct ath12k_hw_group *ag)
 {
 	struct ath12k_base *ab;
@@ -1200,6 +1261,12 @@ static int ath12k_core_hw_group_start(struct ath12k_hw_group *ag)
 	lockdep_assert_held(&ag->mutex);
 
 	if (test_bit(ATH12K_GROUP_FLAG_REGISTERED, &ag->flags)) {
+		ret = ath12k_core_send_cumac_config(ag);
+		if (WARN_ON(ret)) {
+			ath12k_mac_unregister(ag);
+			goto err_mac_destroy;
+		}
+
 		ret = ath12k_core_mlo_setup(ag);
 		if (WARN_ON(ret)) {
 			ath12k_mac_unregister(ag);
@@ -1212,6 +1279,10 @@ static int ath12k_core_hw_group_start(struct ath12k_hw_group *ag)
 	if (WARN_ON(ret))
 		return ret;
 
+	ret = ath12k_core_send_cumac_config(ag);
+	if (WARN_ON(ret))
+		goto err_mac_destroy;
+
 	ret = ath12k_core_mlo_setup(ag);
 	if (WARN_ON(ret))
 		goto err_mac_destroy;
drivers/net/wireless/ath/ath12k/core.h +2 -0
index 796d78f84bb6..359fda7e9eab 100644
@@ -57,6 +57,7 @@
 
 #define ATH12K_INVALID_HW_MAC_ID	0xFF
 #define ATH12K_CONNECTION_LOSS_HZ	(3 * HZ)
+#define ATH12K_CUMAC_SETUP_TIMEOUT_HZ	(3 * HZ)
 
 #define ATH12K_MON_TIMER_INTERVAL  10
 #define ATH12K_RESET_TIMEOUT_HZ			(20 * HZ)
@@ -774,6 +775,7 @@ struct ath12k {
 	struct completion fw_stats_done;
 
 	struct completion mlo_setup_done;
+	struct completion cumac_setup_done;
 	u32 mlo_setup_status;
 	u8 ftm_msgref;
 	struct ath12k_fw_stats fw_stats;
drivers/net/wireless/ath/ath12k/mac.c +1 -0
index a2cdcfd485e9..d97cb9877ecb 100644
@@ -15309,6 +15309,7 @@ static void ath12k_mac_setup(struct ath12k *ar)
 	init_completion(&ar->scan.completed);
 	init_completion(&ar->scan.on_channel);
 	init_completion(&ar->mlo_setup_done);
+	init_completion(&ar->cumac_setup_done);
 	init_completion(&ar->completed_11d_scan);
 	init_completion(&ar->regd_update_completed);
 	init_completion(&ar->thermal.wmi_sync);
drivers/net/wireless/ath/ath12k/wmi.c +90 -0

120 lines not on this page · raw message

drivers/net/wireless/ath/ath12k/wmi.h +23 -0
index 513974b3b4eb..dd14bda5d191 100644
@@ -384,6 +384,7 @@ enum wmi_tlv_cmd_id {
 	WMI_PDEV_SET_BIOS_SAR_TABLE_CMDID = 0x4044,
 	WMI_PDEV_SET_BIOS_GEO_TABLE_CMDID = 0x4045,
 	WMI_PDEV_SET_BIOS_INTERFACE_CMDID = 0x404A,
+	WMI_PDEV_SET_CUMAC_DEVICE_CMDID = 0x405D,
 	WMI_VDEV_CREATE_CMDID = WMI_TLV_CMD(WMI_GRP_VDEV),
 	WMI_VDEV_DELETE_CMDID,
 	WMI_VDEV_START_REQUEST_CMDID,
@@ -760,6 +761,7 @@ enum wmi_tlv_event_id {
 					WMI_SERVICE_READY_EXT2_EVENTID + 4,
 	WMI_PDEV_RSSI_DBM_CONVERSION_PARAMS_INFO_EVENTID =
 				WMI_PDEV_GET_HALPHY_CAL_STATUS_EVENTID + 5,
+	WMI_PDEV_SET_CUMAC_DEVICE_ID_CONFIRMATION_EVENTID = 0x4038,
 	WMI_VDEV_START_RESP_EVENTID = WMI_TLV_CMD(WMI_GRP_VDEV),
 	WMI_VDEV_STOPPED_EVENTID,
 	WMI_VDEV_INSTALL_KEY_COMPLETE_EVENTID,
@@ -2040,6 +2042,8 @@ enum wmi_tlv_tag {
 	WMI_TAG_RSSI_DBM_CONVERSION_TEMP_OFFSET_INFO,
 	WMI_TAG_HALPHY_CTRL_PATH_CMD_FIXED_PARAM = 0x442,
 	WMI_TAG_HALPHY_CTRL_PATH_EVENT_FIXED_PARAM,
+	WMI_TAG_PDEV_SET_CUMAC_DEVICE = 0x57A,
+	WMI_TAG_PDEV_SET_CUMAC_COMPLETE = 0x57B,
 	WMI_TAG_MAX
 };
 
@@ -2289,6 +2293,8 @@ enum wmi_tlv_service {
 	WMI_TLV_SERVICE_THERM_THROT_5_LEVELS = 429,
 	WMI_TLV_SERVICE_ETH_OFFLOAD = 461,
 
+	WMI_TLV_SERVICE_PDEV_SET_CUMAC_DEVICE_CMD_SUPPORT = 520,
+
 	WMI_MAX_EXT2_SERVICE,
 };
 
@@ -2578,6 +2584,7 @@ struct wmi_init_cmd {
 
 #define WMI_RSRC_CFG_HOST_SVC_FLAG_REG_CC_EXT_SUPPORT_BIT 4
 #define WMI_RSRC_CFG_HOST_SVC_FLAG_REO_QREF_SUPPORT_BIT   12
+#define WMI_RSRC_CFG_HOST_SVC_FLAG_CUMAC_CMD_SUPPORT_BIT  27
 #define WMI_RSRC_CFG_FLAGS2_RX_PEER_METADATA_VERSION		GENMASK(5, 4)
 #define WMI_RSRC_CFG_FLAG1_BSS_CHANNEL_INFO_64	BIT(5)
 #define WMI_RSRC_CFG_FLAGS2_CALC_NEXT_DTIM_COUNT_SET      BIT(9)
@@ -6793,6 +6800,22 @@ int ath12k_wmi_send_mlo_link_set_active_cmd(struct ath12k_base *ab,
 					    struct wmi_mlo_link_set_active_arg *param);
 int ath12k_wmi_simulate_incumbent_signal_interference(struct ath12k *ar,
 						      u32 chan_bw_interference_bitmap);
+struct wmi_send_cumac_cmd {
+	__le32 tlv_header;
+	__le32 pdev_id;
+	__le32 cumac_device_id;
+} __packed;
+
+enum wmi_cumac_device_id_status {
+	WMI_PDEV_SET_CUMAC_DEVICE_ID_SUCCESS = 0,
+};
+
+struct wmi_mlo_send_cumac_complete_event {
+	__le32 pdev_id;
+	__le32 status;
+} __packed;
+
+int ath12k_wmi_send_cumac_config(struct ath12k *ar, u32 cumac_device_id);
 int ath12k_wmi_alloc(void);
 void ath12k_wmi_free(void);
 
Signature · 1 line
2.34.1
author
#7 lore raw

PATCH 7/10 wifi: ath12k: Refactor NSS handling to support firmware-advertised capabilities

In reply to Sriram R

From: Madhavan Ganesan <[email protected]>

The maximum number of spatial streams (NSS) supported by firmware may differ from the hardware chain count. For example, QCN9575 5x5 hardware supports a maximum of 4 spatial streams in single PHY mode despite having 5 physical chains.

Wi-Fi 8 Firmware advertises maximum TX/RX NSS capabilities via the WMI_MAC_PHY_CAPABILITIES_EXT2 structure to address this issue and uses new nss_info field for max_tx_nss and max_rx_nss provides this information. A value of zero means the capability was not advertised and the driver falls back to the chainmask count.

This capability is currently only advertised by QCN9575 firmware and existing devices that do not send WMI_TAG_MAC_PHY_CAPABILITIES_EXT2 are unaffected.

Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.6-01243-QCAHKSWPL_SILICONZ-1
Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.1.c7-00108-QCAHMTSWPL_V1.0_V2.0_SILICONZ_UPSTREAM-3

---
 drivers/net/wireless/ath/ath12k/core.h |   2 +
 drivers/net/wireless/ath/ath12k/mac.c  |  32 ++++++--
 drivers/net/wireless/ath/ath12k/wmi.c  | 108 +++++++++++++++++++++++++
 drivers/net/wireless/ath/ath12k/wmi.h  |  33 ++++++++
 4 files changed, 170 insertions(+), 5 deletions(-)
drivers/net/wireless/ath/ath12k/core.h +2 -0
index 359fda7e9eab..04faee8ac057 100644
@@ -858,6 +858,8 @@ struct ath12k_pdev_cap {
 	u32 mld_cap;
 	bool nss_ratio_enabled;
 	u8 nss_ratio_info;
+	u8 max_tx_nss;
+	u8 max_rx_nss;
 };
 
 struct mlo_timestamp {
drivers/net/wireless/ath/ath12k/mac.c +27 -5
index d97cb9877ecb..e9d337b54316 100644
@@ -2361,6 +2361,28 @@ ath12k_peer_assoc_h_vht_limit(u16 tx_mcs_set,
 	return tx_mcs_set;
 }
 
+static u32 ath12k_effective_tx_chains(struct ath12k *ar, u32 chainmask)
+{
+	u32 chains = hweight32(chainmask);
+
+	/* max_tx_nss == 0 means firmware did not advertise a cap; use chainmask */
+	if (ar->pdev->cap.max_tx_nss)
+		return min_t(u32, chains, ar->pdev->cap.max_tx_nss);
+
+	return chains;
+}
+
+static u32 ath12k_effective_rx_chains(struct ath12k *ar, u32 chainmask)
+{
+	u32 chains = hweight32(chainmask);
+
+	/* max_rx_nss == 0 means firmware did not advertise a cap; use chainmask */
+	if (ar->pdev->cap.max_rx_nss)
+		return min_t(u32, chains, ar->pdev->cap.max_rx_nss);
+
+	return chains;
+}
+
 static u8 ath12k_get_nss_160mhz(struct ath12k *ar,
 				u8 max_nss)
 {
@@ -9208,7 +9230,7 @@ static int __ath12k_set_antenna(struct ath12k *ar, u32 tx_ant, u32 rx_ant)
 		return ret;
 	}
 
-	ar->num_tx_chains = hweight32(tx_ant);
+	ar->num_tx_chains = ath12k_effective_tx_chains(ar, tx_ant);
 
 	ret = ath12k_wmi_pdev_set_param(ar, WMI_PDEV_PARAM_RX_CHAIN_MASK,
 					rx_ant, ar->pdev->pdev_id);
@@ -9218,7 +9240,7 @@ static int __ath12k_set_antenna(struct ath12k *ar, u32 tx_ant, u32 rx_ant)
 		return ret;
 	}
 
-	ar->num_rx_chains = hweight32(rx_ant);
+	ar->num_rx_chains = ath12k_effective_rx_chains(ar, rx_ant);
 
 	/* Reload HT/VHT/HE capability */
 	ath12k_mac_setup_ht_vht_cap(ar, &ar->pdev->cap, NULL);
@@ -10586,7 +10608,7 @@ int ath12k_mac_vdev_create(struct ath12k *ar, struct ath12k_link_vif *arvif)
 
 	ath12k_mac_update_vif_offload(arvif);
 
-	nss = hweight32(ar->cfg_tx_chainmask) ? : 1;
+	nss = ath12k_effective_tx_chains(ar, ar->cfg_tx_chainmask) ? : 1;
 	ret = ath12k_wmi_vdev_set_param_cmd(ar, arvif->vdev_id,
 					    WMI_VDEV_PARAM_NSS, nss);
 	if (ret) {
@@ -15287,8 +15309,8 @@ static void ath12k_mac_setup(struct ath12k *ar)
 
 	ar->cfg_tx_chainmask = pdev->cap.tx_chain_mask;
 	ar->cfg_rx_chainmask = pdev->cap.rx_chain_mask;
-	ar->num_tx_chains = hweight32(pdev->cap.tx_chain_mask);
-	ar->num_rx_chains = hweight32(pdev->cap.rx_chain_mask);
+	ar->num_tx_chains = ath12k_effective_tx_chains(ar, pdev->cap.tx_chain_mask);
+	ar->num_rx_chains = ath12k_effective_rx_chains(ar, pdev->cap.rx_chain_mask);
 	ar->scan.arvif = NULL;
 	ar->vdev_id_11d_scan = ATH12K_11D_INVALID_VDEV_ID;
 
drivers/net/wireless/ath/ath12k/wmi.c +108 -0

132 lines not on this page · raw message

drivers/net/wireless/ath/ath12k/wmi.h +33 -0
index dd14bda5d191..5fad7749cd5f 100644
@@ -2042,6 +2042,7 @@ enum wmi_tlv_tag {
 	WMI_TAG_RSSI_DBM_CONVERSION_TEMP_OFFSET_INFO,
 	WMI_TAG_HALPHY_CTRL_PATH_CMD_FIXED_PARAM = 0x442,
 	WMI_TAG_HALPHY_CTRL_PATH_EVENT_FIXED_PARAM,
+	WMI_TAG_MAC_PHY_CAPABILITIES_EXT2 = 0x526,
 	WMI_TAG_PDEV_SET_CUMAC_DEVICE = 0x57A,
 	WMI_TAG_PDEV_SET_CUMAC_COMPLETE = 0x57B,
 	WMI_TAG_MAX
@@ -2820,6 +2821,8 @@ enum wmi_channel_width {
 
 #define WMI_MAX_EHTCAP_MAC_SIZE  2
 #define WMI_MAX_EHTCAP_PHY_SIZE  3
+#define WMI_MAX_UHRCAP_MAC_SIZE  4
+#define WMI_MAX_UHRCAP_PHY_SIZE  8
 #define WMI_MAX_EHTCAP_RATE_SET  3
 
 /* Used for EHT MCS-NSS array. Data at each array index follows the format given
@@ -2884,6 +2887,30 @@ struct ath12k_wmi_caps_ext_params {
 	__le32 mld_capability;
 } __packed;
 
+struct ath12k_wmi_caps_ext2_params {
+	__le32 hw_mode_id;
+	__le32 pdev_and_hw_link_ids;
+	__le32 phy_id;
+	__le32 wireless_modes_ext;
+	__le32 uhr_cap_mac_info_2ghz[WMI_MAX_UHRCAP_MAC_SIZE];
+	__le32 uhr_cap_mac_info_5ghz[WMI_MAX_UHRCAP_MAC_SIZE];
+	__le32 uhr_cap_phy_info_2ghz[WMI_MAX_UHRCAP_PHY_SIZE];
+	__le32 uhr_cap_phy_info_5ghz[WMI_MAX_UHRCAP_PHY_SIZE];
+	__le32 npca_capability;
+	struct ath12k_wmi_ppe_threshold_params uhr_ppet_2ghz;
+	struct ath12k_wmi_ppe_threshold_params uhr_ppet_5ghz;
+	/*
+	 * nss_info:
+	 * Bits  3:0  - Maximum supported Tx NSS
+	 * Bits  7:4  - Maximum supported Rx NSS
+	 * Bits 31:8  - Reserved
+	 */
+	__le32 nss_info;
+} __packed;
+
+#define WMI_MAC_PHY_CAPABILITIES_EXT2_MAX_TX_NSS_MASK	GENMASK(3, 0)
+#define WMI_MAC_PHY_CAPABILITIES_EXT2_MAX_RX_NSS_MASK	GENMASK(7, 4)
+
 /* 2 word representation of MAC addr */
 struct ath12k_wmi_mac_addr_params {
 	u8 addr[ETH_ALEN];
@@ -6749,6 +6776,12 @@ ath12k_wmi_caps_ext_get_hw_link_id(const struct ath12k_wmi_caps_ext_params *para
 	return le32_get_bits(param->pdev_and_hw_link_ids, WMI_CAPS_PARAMS_HW_LINK_ID);
 }
 
+static inline u32
+ath12k_wmi_caps_ext2_get_pdev_id(const struct ath12k_wmi_caps_ext2_params *param)
+{
+	return le32_get_bits(param->pdev_and_hw_link_ids, WMI_CAPS_PARAMS_PDEV_ID);
+}
+
 static inline u32
 ath12k_wmi_mac_phy_get_pdev_id(const struct ath12k_wmi_mac_phy_caps_params *param)
 {
Signature · 1 line
2.34.1
author
#8 lore raw

PATCH 8/10 wifi: ath12k: Authorize AP self peer and use correct peer auth mode

In reply to Sriram R

From: Ramya Gnanasekar <[email protected]>

AP vdevs rely on a self peer entry in firmware, but that peer is not explicitly authorized. Wi-Fi 8 firmware requires the host to explicitly authorize the self peer before traffic can flow.

Authorize self peer based on the AP mode during vdev bringup sequence and abort vdev-up on authorization failure rather than continuing with an unauthorized self peer. This is a no-op in Wi-Fi 7 firmware when sent to the self peer.

Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.6-01243-QCAHKSWPL_SILICONZ-1
Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.1.c7-00108-QCAHMTSWPL_V1.0_V2.0_SILICONZ_UPSTREAM-3

---
 drivers/net/wireless/ath/ath12k/core.h |  1 +
 drivers/net/wireless/ath/ath12k/mac.c  | 33 ++++++++++++++++++++++++++
 drivers/net/wireless/ath/ath12k/wmi.h  |  5 ++++
 3 files changed, 39 insertions(+)
drivers/net/wireless/ath/ath12k/core.h +1 -0
index 04faee8ac057..1945eb1415fb 100644
@@ -339,6 +339,7 @@ struct ath12k_link_vif {
 	int txpower;
 	bool rsnie_present;
 	bool wpaie_present;
+	bool self_peer_authorized;
 	u8 vdev_stats_id;
 	u32 punct_bitmap;
 	u8 link_id;
drivers/net/wireless/ath/ath12k/mac.c +33 -0
index e9d337b54316..c2e6e9601092 100644
@@ -1897,6 +1897,32 @@ static int ath12k_mac_setup_bcn_tmpl(struct ath12k_link_vif *arvif)
 	return ret;
 }
 
+static int ath12k_mac_authorize_self_peer(struct ath12k_link_vif *arvif)
+{
+	struct ath12k *ar = arvif->ar;
+	enum wmi_peer_authorize_mode mode;
+	int ret;
+
+	if (arvif->self_peer_authorized)
+		return 0;
+
+	if (arvif->rsnie_present || arvif->wpaie_present)
+		mode = WMI_PEER_AUTHORIZE_MODE_SECURED;
+	else
+		mode = WMI_PEER_AUTHORIZE_MODE_OPEN;
+
+	ret = ath12k_wmi_set_peer_param(ar, arvif->bssid, arvif->vdev_id,
+					WMI_PEER_AUTHORIZE, mode);
+	if (ret) {
+		ath12k_warn(ar->ab, "unable to authorize self peer %pM vdev %d: %d\n",
+			    arvif->bssid, arvif->vdev_id, ret);
+		return ret;
+	}
+
+	arvif->self_peer_authorized = true;
+	return 0;
+}
+
 static void ath12k_control_beaconing(struct ath12k_link_vif *arvif,
 				     struct ieee80211_bss_conf *info)
 {
@@ -1914,6 +1940,7 @@ static void ath12k_control_beaconing(struct ath12k_link_vif *arvif,
 				    arvif->vdev_id, ret);
 
 		arvif->is_up = false;
+		arvif->self_peer_authorized = false;
 		return;
 	}
 
@@ -1929,6 +1956,12 @@ static void ath12k_control_beaconing(struct ath12k_link_vif *arvif,
 
 	ether_addr_copy(arvif->bssid, info->addr);
 
+	if (ahvif->vdev_type == WMI_VDEV_TYPE_AP) {
+		ret = ath12k_mac_authorize_self_peer(arvif);
+		if (ret)
+			return;
+	}
+
 	params.vdev_id = arvif->vdev_id;
 	params.aid = ahvif->aid;
 	params.bssid = arvif->bssid;
drivers/net/wireless/ath/ath12k/wmi.h +5 -0
index 5fad7749cd5f..e8c9717ecfbb 100644
@@ -2335,6 +2335,11 @@ enum wmi_peer_param {
 	WMI_PEER_CHWIDTH_PUNCTURE_20MHZ_BITMAP = 39,
 };
 
+enum wmi_peer_authorize_mode {
+	WMI_PEER_AUTHORIZE_MODE_SECURED = 1,
+	WMI_PEER_AUTHORIZE_MODE_OPEN = 2,
+};
+
 #define WMI_PEER_PUNCTURE_BITMAP		GENMASK(23, 8)
 
 enum wmi_slot_time {
Signature · 1 line
2.34.1
author
#9 lore raw

PATCH 9/10 wifi: ath12k: Add WMI peer assoc queue parameter support for Wi-Fi 8

In reply to Sriram R

From: Ramya Gnanasekar <[email protected]>

In the Wi-Fi 8 architecture, firmware no longer self-allocates management frame flow queues. The host driver is responsible for allocating these queues and providing their details to firmware through new TLVs appended to WMI_PEER_ASSOC_CMDID.

Add support for passing the following queue parameters during peer association:

- management MPDUQ parameters containing the queue address and PN counter address
- management MSDUQ parameters containing the queue address, link ID and management flow type (one per MLO link)
- HOL (Head-of-Line) queue parameters containing the dedicated HOL TID, peer ID, MSDU and MPDU queue types, corresponding queue addresses and PN counter address

Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.6-01243-QCAHKSWPL_SILICONZ-1
Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.1.c7-00108-QCAHMTSWPL_V1.0_V2.0_SILICONZ_UPSTREAM-3

---
 drivers/net/wireless/ath/ath12k/wmi.c | 151 +++++++++++++++++++++-----
 drivers/net/wireless/ath/ath12k/wmi.h |  66 +++++++++++
 2 files changed, 190 insertions(+), 27 deletions(-)
drivers/net/wireless/ath/ath12k/wmi.c +124 -27
index c07fa37d1c0c..3c160e41c110 100644
@@ -2319,6 +2319,9 @@ int ath12k_wmi_send_peer_assoc_cmd(struct ath12k *ar,
 	struct ath12k_wmi_eht_rate_set_params *eht_mcs;
 	struct wmi_peer_assoc_mlo_params *ml_params;
 	struct wmi_peer_assoc_mlo_partner_info_params *partner_info;
+	struct wmi_peer_assoc_msduq_params *msduq_params;
+	struct wmi_peer_assoc_mpduq_params *mpduq_params;
+	struct wmi_peer_assoc_holq_params *holq_params;
 	struct sk_buff *skb;
 	struct wmi_tlv *tlv;
 	void *ptr;
@@ -2346,6 +2349,23 @@ int ath12k_wmi_send_peer_assoc_cmd(struct ath12k *ar,
 	else
 		len += (2 * TLV_HDR_SIZE);
 
+	/* TTLM placeholder TLV (zero-length; non-MLO has no TTLM entries) */
+	len += TLV_HDR_SIZE;
+
+	/* Operating mode dummy TLV */
+	len += TLV_HDR_SIZE;
+
+	if (arg->flowq_args.enabled)
+		len += TLV_HDR_SIZE + sizeof(*mpduq_params) + TLV_HDR_SIZE +
+		       (arg->flowq_args.num_links * sizeof(*msduq_params));
+	else
+		len += (2 * TLV_HDR_SIZE);
+
+	if (arg->holq_args.enabled)
+		len += TLV_HDR_SIZE + sizeof(*holq_params);
+	else
+		len += TLV_HDR_SIZE;
+
 	skb = ath12k_wmi_alloc_skb(wmi->wmi_ab, len);
 	if (!skb)
 		return -ENOMEM;
@@ -2548,39 +2568,116 @@ int ath12k_wmi_send_peer_assoc_cmd(struct ath12k *ar,
 	tlv->header = ath12k_wmi_tlv_hdr(WMI_TAG_ARRAY_STRUCT, len);
 	ptr += TLV_HDR_SIZE;
 
-	if (len == 0)
-		goto send;
+	if (len) {
+		for (i = 0; i < arg->ml.num_partner_links; i++) {
+			u32 cmd = WMI_TAG_MLO_PARTNER_LINK_PARAMS_PEER_ASSOC;
 
-	for (i = 0; i < arg->ml.num_partner_links; i++) {
-		u32 cmd = WMI_TAG_MLO_PARTNER_LINK_PARAMS_PEER_ASSOC;
+			partner_info = ptr;
+			partner_info->tlv_header =
+				ath12k_wmi_tlv_cmd_hdr(cmd, sizeof(*partner_info));
+			partner_info->vdev_id =
+				cpu_to_le32(arg->ml.partner_info[i].vdev_id);
+			partner_info->hw_link_id =
+				cpu_to_le32(arg->ml.partner_info[i].hw_link_id);
+			partner_info->flags = cpu_to_le32(ATH12K_WMI_FLAG_MLO_ENABLED);
+
+			if (arg->ml.partner_info[i].assoc_link)
+				partner_info->flags |=
+					cpu_to_le32(ATH12K_WMI_FLAG_MLO_ASSOC_LINK);
+
+			if (arg->ml.partner_info[i].primary_umac)
+				partner_info->flags |=
+					cpu_to_le32(ATH12K_WMI_FLAG_MLO_PRIMARY_UMAC);
+
+			if (arg->ml.partner_info[i].logical_link_idx_valid) {
+				v = cpu_to_le32(ATH12K_WMI_FLAG_MLO_LINK_ID_VALID);
+				partner_info->flags |= v;
+			}
 
-		partner_info = ptr;
-		partner_info->tlv_header = ath12k_wmi_tlv_cmd_hdr(cmd,
-								  sizeof(*partner_info));
-		partner_info->vdev_id = cpu_to_le32(arg->ml.partner_info[i].vdev_id);
-		partner_info->hw_link_id =
-			cpu_to_le32(arg->ml.partner_info[i].hw_link_id);
-		partner_info->flags = cpu_to_le32(ATH12K_WMI_FLAG_MLO_ENABLED);
-
-		if (arg->ml.partner_info[i].assoc_link)
-			partner_info->flags |=
-				cpu_to_le32(ATH12K_WMI_FLAG_MLO_ASSOC_LINK);
-
-		if (arg->ml.partner_info[i].primary_umac)
-			partner_info->flags |=
-				cpu_to_le32(ATH12K_WMI_FLAG_MLO_PRIMARY_UMAC);
-
-		if (arg->ml.partner_info[i].logical_link_idx_valid) {
-			v = cpu_to_le32(ATH12K_WMI_FLAG_MLO_LINK_ID_VALID);
-			partner_info->flags |= v;
+			partner_info->logical_link_idx =
+				cpu_to_le32(arg->ml.partner_info[i].logical_link_idx);
+			ptr += sizeof(*partner_info);
+		}
+	}
+
+	/* TTLM placeholder (zero-length ARRAY_STRUCT; non-MLO has no TTLM entries) */
+	tlv = ptr;
+	tlv->header = ath12k_wmi_tlv_hdr(WMI_TAG_ARRAY_STRUCT, 0);
+	ptr += TLV_HDR_SIZE;
+
+	/* Operating mode dummy TLV */
+	tlv = ptr;
+	tlv->header = ath12k_wmi_tlv_hdr(WMI_TAG_ARRAY_STRUCT, 0);
+	ptr += TLV_HDR_SIZE;
+
+	len = arg->flowq_args.enabled ? sizeof(*mpduq_params) : 0;
+	tlv = ptr;
+	tlv->header = ath12k_wmi_tlv_hdr(WMI_TAG_ARRAY_STRUCT, len);
+	ptr += TLV_HDR_SIZE;
+	if (arg->flowq_args.enabled) {
+		mpduq_params = ptr;
+		mpduq_params->tlv_header =
+			ath12k_wmi_tlv_cmd_hdr(WMI_TAG_MGMT_MPDU_FLOWQ_PARAMS, len);
+		mpduq_params->mgmt_mpduq_address =
+			cpu_to_le32(arg->flowq_args.mpduq_args.mgmt_mpduq_address);
+		mpduq_params->pn_addr_39_32 =
+			cpu_to_le32(arg->flowq_args.mpduq_args.pn_addr_39_32);
+		mpduq_params->pn_addr_31_0 =
+			cpu_to_le32(arg->flowq_args.mpduq_args.pn_addr_31_0);
+		ptr += sizeof(*mpduq_params);
+	}
+
+	len = arg->flowq_args.enabled ?
+				(arg->flowq_args.num_links * sizeof(*msduq_params)) : 0;
+	tlv = ptr;
+	tlv->header = ath12k_wmi_tlv_hdr(WMI_TAG_ARRAY_STRUCT, len);
+	ptr += TLV_HDR_SIZE;
+	if (arg->flowq_args.enabled) {
+		for (i = 0; i < arg->flowq_args.num_links; i++) {
+			struct ath12k_wmi_peer_assoc_msduq_arg *msduq;
+			u32 cmd_tag = WMI_TAG_MGMT_MSDU_FLOWQ_PARAMS;
+
+			msduq = &arg->flowq_args.msduq_args[i];
+			msduq_params = ptr;
+			msduq_params->tlv_header =
+				ath12k_wmi_tlv_cmd_hdr(cmd_tag, sizeof(*msduq_params));
+			msduq_params->mgmt_msduq_address =
+				cpu_to_le32(msduq->mgmt_msduq_address);
+			msduq_params->msdu_type =
+				le32_encode_bits(msduq->link_id, WMI_MGMTQ_LINK_ID);
+			msduq_params->msdu_type |=
+				le32_encode_bits(msduq->flow_type, WMI_MGMTQ_MSDU_TYPE);
+			ptr += sizeof(*msduq_params);
 		}
+	}
 
-		partner_info->logical_link_idx =
-			cpu_to_le32(arg->ml.partner_info[i].logical_link_idx);
-		ptr += sizeof(*partner_info);
+	len = arg->holq_args.enabled ? sizeof(*holq_params) : 0;
+	tlv = ptr;
+	tlv->header = ath12k_wmi_tlv_hdr(WMI_TAG_ARRAY_STRUCT, len);
+	ptr += TLV_HDR_SIZE;
+	if (arg->holq_args.enabled) {
+		holq_params = ptr;
+		holq_params->tlv_header =
+			ath12k_wmi_tlv_cmd_hdr(WMI_TAG_HOL_MSDU_FLOWQ_PARAMS, len);
+		holq_params->mpduq_msduq_number =
+			le32_encode_bits(arg->holq_args.peer_id, WMI_HOLQ_PEER_ID);
+		holq_params->mpduq_msduq_number |=
+			le32_encode_bits(arg->holq_args.tid, WMI_HOLQ_TID);
+		holq_params->mpduq_msduq_number |=
+			le32_encode_bits(arg->holq_args.mpdu_type, WMI_HOLQ_MPDU_TYPE);
+		holq_params->mpduq_msduq_number |=
+			le32_encode_bits(arg->holq_args.msdu_type, WMI_HOLQ_MSDU_TYPE);
+		holq_params->mpduq_address =
+			cpu_to_le32(arg->holq_args.mpduq_address);
+		holq_params->msduq_address =
+			cpu_to_le32(arg->holq_args.msduq_address);
+		holq_params->pn_addr_39_32 =
+			cpu_to_le32(arg->holq_args.pn_addr_39_32);
+		holq_params->pn_addr_31_0 =
+			cpu_to_le32(arg->holq_args.pn_addr_31_0);
+		ptr += sizeof(*holq_params);
 	}
 
-send:
 	ath12k_dbg(ar->ab, ATH12K_DBG_WMI,
 		   "wmi peer assoc vdev id %d assoc id %d peer mac %pM peer_flags %x rate_caps %x peer_caps %x listen_intval %d ht_caps %x max_mpdu %d nss %d phymode %d peer_mpdu_density %d vht_caps %x he cap_info %x he ops %x he cap_info_ext %x he phy %x %x %x peer_bw_rxnss_override %x peer_flags_ext %x eht mac_cap %x %x eht phy_cap %x %x %x peer_eht_ops %x\n",
 		   cmd->vdev_id, cmd->peer_associd, arg->peer_mac,
drivers/net/wireless/ath/ath12k/wmi.h +66 -0

90 lines not on this page · raw message

Signature · 1 line
2.34.1
author
#10 lore raw

PATCH 10/10 wifi: ath12k: Add dp peer assoc arch ops and mac integration

In reply to Sriram R

From: Ramya Gnanasekar <[email protected]>

Wi-Fi 8 devices require host-programmed management frame queue addresses in the WMI PEER_ASSOC command and need the datapath layer to participate in peer association. Without this, management traffic fails to flow after association on such devices.

Introduce four new arch ops: peer_assoc, link_peer_assoc, get_peer_mgmt_flowq, and get_peer_holq so the architecture-specific datapath can participate in the peer association sequence.

peer_assoc and link_peer_assoc return 0 (treated as success/no-op) when the op is unregistered, since Wi-Fi 7 has no dp participation in peer assoc. get_peer_mgmt_flowq and get_peer_holq return -EOPNOTSUPP when unregistered; ath12k_peer_assoc_h_flowq() and ath12k_peer_assoc_h_holq() treat -EOPNOTSUPP as disabled and return 0, so peer association is not aborted, as expected for Wi-Fi 7 devices.

Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.6-01243-QCAHKSWPL_SILICONZ-1
Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.1.c7-00108-QCAHMTSWPL_V1.0_V2.0_SILICONZ_UPSTREAM-3

---
 drivers/net/wireless/ath/ath12k/dp.h  |  57 ++++++++++
 drivers/net/wireless/ath/ath12k/mac.c | 155 ++++++++++++++++++++++++--
 2 files changed, 201 insertions(+), 11 deletions(-)
drivers/net/wireless/ath/ath12k/dp.h +57 -0
index f439f43ed302..bac433ad0a7a 100644
@@ -24,6 +24,7 @@ struct ath12k_link_vif;
 struct ath12k_ext_irq_grp;
 struct ath12k_dp_rx_tid;
 struct ath12k_dp_rx_tid_rxq;
+struct ath12k_dp_vif;
 
 struct ath12k_dp_profile_params {
 	u32 tx_comp_ring_size;
@@ -416,6 +417,16 @@ struct ath12k_dp_arch_ops {
 			   struct ath12k_dp_peer_create_params *params);
 	void (*peer_delete)(struct ath12k_hw *ah, u8 *addr,
 			    struct ieee80211_sta *sta);
+	int (*peer_assoc)(struct ath12k_dp *dp, struct ath12k_dp_hw *dp_hw,
+			  struct ath12k_dp_vif *dp_vif, u8 *addr);
+	int (*link_peer_assoc)(struct ath12k_dp *dp, struct ath12k_dp_hw *dp_hw,
+			       u8 *addr, u32 hw_link_id);
+	int (*get_peer_mgmt_flowq)(struct ath12k_dp *dp, struct ath12k_dp_hw *dp_hw,
+				   u8 *addr,
+				   struct ath12k_wmi_peer_assoc_flowq_arg *flowq_args);
+	int (*get_peer_holq)(struct ath12k_dp *dp, struct ath12k_dp_hw *dp_hw,
+			     u8 *addr,
+			     struct ath12k_wmi_peer_assoc_holq_arg *holq_args);
 };
 
 struct ath12k_device_dp_tx_err_stats {
@@ -705,6 +716,52 @@ ath12k_dp_arch_peer_delete(struct ath12k_dp *dp,
 	dp->ops->peer_delete(ah, addr, sta);
 }
 
+static inline int ath12k_dp_arch_peer_assoc(struct ath12k_dp *dp,
+					    struct ath12k_dp_hw *dp_hw,
+					    struct ath12k_dp_vif *dp_vif,
+					    u8 *addr)
+{
+	if (dp->ops && dp->ops->peer_assoc)
+		return dp->ops->peer_assoc(dp, dp_hw, dp_vif, addr);
+
+	return 0;
+}
+
+static inline int
+ath12k_dp_arch_link_peer_assoc(struct ath12k_dp *dp,
+			       struct ath12k_dp_hw *dp_hw,
+			       u8 *addr, u32 hw_link_id)
+{
+	if (dp->ops && dp->ops->link_peer_assoc)
+		return dp->ops->link_peer_assoc(dp, dp_hw, addr, hw_link_id);
+
+	return 0;
+}
+
+static inline int
+ath12k_dp_arch_get_peer_mgmt_flowq(struct ath12k_dp *dp,
+				   struct ath12k_dp_hw *dp_hw,
+				   u8 *addr,
+				   struct ath12k_wmi_peer_assoc_flowq_arg *flowq_args)
+{
+	if (dp->ops && dp->ops->get_peer_mgmt_flowq)
+		return dp->ops->get_peer_mgmt_flowq(dp, dp_hw, addr, flowq_args);
+
+	return -EOPNOTSUPP;
+}
+
+static inline int
+ath12k_dp_arch_get_peer_holq(struct ath12k_dp *dp,
+			     struct ath12k_dp_hw *dp_hw,
+			     u8 *addr,
+			     struct ath12k_wmi_peer_assoc_holq_arg *holq_args)
+{
+	if (dp->ops && dp->ops->get_peer_holq)
+		return dp->ops->get_peer_holq(dp, dp_hw, addr, holq_args);
+
+	return -EOPNOTSUPP;
+}
+
 static inline u32
 ath12k_dp_tx_comp_ring_size(const struct ath12k_dp_profile_params *p)
 {
drivers/net/wireless/ath/ath12k/mac.c +144 -11

227 lines not on this page · raw message

Signature · 1 line
2.34.1