Sfoglia il codice sorgente

qcacmn: Add WMI changes to send the T2LM command to FW

Add WMI changes to send TID-to-link mapping to FW as part of peer assoc
command and as part of WMI_PEER_TID_TO_LINK_MAP_CMDID.

Change-Id: Ia3a8fb10d49e1d54d6f4f418be3f684bc0147c5c
CRs-Fixed: 3183734
Shashikala Prabhu 3 anni fa
parent
commit
a12a2c47c8

+ 13 - 1
wmi/inc/wmi_unified_11be_api.h

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2021, The Linux Foundation. All rights reserved.
- * Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
@@ -53,4 +53,16 @@ QDF_STATUS
 wmi_send_mlo_link_set_active_cmd(wmi_unified_t wmi_handle,
 				 struct mlo_link_set_active_param *param);
 #endif /*WLAN_FEATURE_11BE_MLO*/
+
+#if defined(WLAN_FEATURE_11BE) && defined(WLAN_FEATURE_T2LM)
+/**
+ * wmi_send_mlo_peer_tid_to_link_map_cmd() - send TID-to-link mapping command
+ * @wmi: WMI handle for this pdev
+ * @params: Pointer to TID-to-link mapping params
+ */
+QDF_STATUS wmi_send_mlo_peer_tid_to_link_map_cmd(
+		wmi_unified_t wmi,
+		struct wmi_host_tid_to_link_map_params *params);
+#endif /* defined(WLAN_FEATURE_11BE) && defined(WLAN_FEATURE_T2LM) */
+
 #endif /*_WMI_UNIFIED_11BE_API_H_*/

+ 4 - 3
wmi/inc/wmi_unified_11be_setup_api.h

@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2021, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
@@ -14,8 +15,8 @@
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
-#ifndef _WMI_UNIFIED_11BE_API_H_
-#define _WMI_UNIFIED_11BE_API_H_
+#ifndef _WMI_UNIFIED_11BE_SETUP_API_H_
+#define _WMI_UNIFIED_11BE_SETUP_API_H_
 
 #include <wmi_unified_11be_param.h>
 
@@ -76,4 +77,4 @@ wmi_extract_mlo_teardown_cmpl_event(wmi_unified_t wmi_handle,
 				    uint8_t *buf,
 				    struct wmi_mlo_teardown_cmpl_params *param);
 #endif /*WLAN_FEATURE_11BE_MLO*/
-#endif /*_WMI_UNIFIED_11BE_API_H_*/
+#endif /*_WMI_UNIFIED_11BE_SETUP_API_H_*/

+ 28 - 0
wmi/inc/wmi_unified_11be_tlv.h

@@ -118,6 +118,22 @@ uint8_t *peer_assoc_add_mlo_params(uint8_t *buf_ptr,
  */
 uint8_t *peer_assoc_add_ml_partner_links(uint8_t *buf_ptr,
 					 struct peer_assoc_params *req);
+/**
+ * peer_assoc_t2lm_params_size() - Get T2LM param size in peer assoc
+ * @req: pointer to peer create request param
+ *
+ *  Return: size of ML params in peer create cmd
+ */
+size_t peer_assoc_t2lm_params_size(struct peer_assoc_params *req);
+/**
+ *  peer_assoc_add_tid_to_link_map() - Add TID-to-link mapping in peer assoc cmd
+ *  @buf_ptr: pointer to peer assoc cmd buffer.
+ *  @req: pointer to peer assoc request param
+ *
+ *  Return: pointer to new offset of cmd buffer
+ */
+uint8_t *peer_assoc_add_tid_to_link_map(uint8_t *buf_ptr,
+					struct peer_assoc_params *req);
 /** wmi_11be_tlv_attach_tlv - Attach 11be relaated callbacks
  *  @wmi_handle: WMI handle
  */
@@ -201,6 +217,18 @@ static uint8_t *peer_assoc_add_ml_partner_links(uint8_t *buf_ptr,
 	return buf_ptr + WMI_TLV_HDR_SIZE;
 }
 
+static size_t peer_assoc_t2lm_params_size(struct peer_assoc_params *req)
+{
+	return WMI_TLV_HDR_SIZE;
+}
+
+static uint8_t *peer_assoc_add_tid_to_link_map(uint8_t *buf_ptr,
+					       struct peer_assoc_params *req)
+{
+	WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0);
+	return buf_ptr + WMI_TLV_HDR_SIZE;
+}
+
 static void wmi_11be_attach_tlv(wmi_unified_t wmi_handle)
 { }
 #endif /*WLAN_FEATURE_11BE_MLO*/

+ 34 - 0
wmi/inc/wmi_unified_param.h

@@ -1075,6 +1075,36 @@ typedef struct {
 	uint32_t mac_addr47to32;
 } wmi_host_mac_addr;
 
+#if defined(WLAN_FEATURE_11BE) && defined(WLAN_FEATURE_T2LM)
+/**
+ * struct wlan_host_t2lm_of_tids - TID-to-link mapping info
+ * @direction:  0 - Downlink, 1 - uplink 2 - Both uplink and downlink
+ * @default_link_mapping: value 1 indicates the default T2LM, where all the TIDs
+ *                        are mapped to all the links.
+ *                        value 0 indicates the preferred T2LM mapping
+ * @t2lm_provisioned_links: Indicates TID to link mapping of all the TIDS.
+ */
+struct wlan_host_t2lm_of_tids {
+	enum wlan_t2lm_direction direction;
+	bool default_link_mapping;
+	uint16_t t2lm_provisioned_links[T2LM_MAX_NUM_TIDS];
+};
+
+/**
+ * struct wmi_host_tid_to_link_map_params - TID-to-link mapping params
+ * @pdev_id: Pdev id
+ * @peer_macaddr: link peer macaddr
+ * @num_dir: number of directions for which T2LM info is available
+ * @t2lm_info: TID-to-link mapping info for the given directions
+ */
+struct wmi_host_tid_to_link_map_params {
+	uint8_t pdev_id;
+	uint8_t peer_macaddr[QDF_MAC_ADDR_SIZE];
+	uint8_t num_dir;
+	struct wlan_host_t2lm_of_tids t2lm_info[WLAN_T2LM_MAX_DIRECTION];
+};
+#endif /* defined(WLAN_FEATURE_11BE) && defined(WLAN_FEATURE_T2LM) */
+
 #ifdef WLAN_FEATURE_11BE_MLO
 /**
  * struct peer_assoc_mlo_params - MLO assoc params
@@ -1191,6 +1221,7 @@ struct peer_assoc_ml_partner_links {
  * @akm: AKM info
  * @peer_assoc_mlo_params mlo_params: MLO assoc params
  * @peer_assoc_ml_partner_links: MLO patner links
+ * @t2lm_params: TID-to-link mapping params
  */
 struct peer_assoc_params {
 	uint32_t vdev_id;
@@ -1277,6 +1308,9 @@ struct peer_assoc_params {
 #endif
 	uint8_t peer_dms_capable:1,
 		reserved:7;
+#if defined(WLAN_FEATURE_11BE) && defined(WLAN_FEATURE_T2LM)
+	struct wmi_host_tid_to_link_map_params t2lm_params;
+#endif
 };
 
 /**

+ 6 - 0
wmi/inc/wmi_unified_priv.h

@@ -2980,6 +2980,12 @@ QDF_STATUS
 (*send_vdev_pn_mgmt_rxfilter_cmd)(wmi_unified_t wmi_handle,
 				  struct vdev_pn_mgmt_rxfilter_params *params);
 
+#if defined(WLAN_FEATURE_11BE) && defined(WLAN_FEATURE_T2LM)
+QDF_STATUS (*send_mlo_peer_tid_to_link_map)(
+		wmi_unified_t wmi_handle,
+		struct wmi_host_tid_to_link_map_params *params);
+#endif /* defined(WLAN_FEATURE_11BE) && defined(WLAN_FEATURE_T2LM) */
+
 QDF_STATUS
 (*extract_pktlog_decode_info_event)(wmi_unified_t wmi_handle, void *evt_buf,
 				    uint8_t *pdev_id, uint8_t *software_image,

+ 13 - 1
wmi/src/wmi_unified_11be_api.c

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2021, The Linux Foundation. All rights reserved.
- * Copyright (c) 2021 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
@@ -58,3 +58,15 @@ wmi_send_mlo_link_set_active_cmd(wmi_unified_t wmi,
 
 	return QDF_STATUS_E_FAILURE;
 }
+
+#if defined(WLAN_FEATURE_11BE) && defined(WLAN_FEATURE_T2LM)
+QDF_STATUS wmi_send_mlo_peer_tid_to_link_map_cmd(
+		wmi_unified_t wmi,
+		struct wmi_host_tid_to_link_map_params *params)
+{
+	if (wmi->ops->send_mlo_peer_tid_to_link_map)
+		return wmi->ops->send_mlo_peer_tid_to_link_map(wmi, params);
+
+	return QDF_STATUS_E_FAILURE;
+}
+#endif /* defined(WLAN_FEATURE_11BE) && defined(WLAN_FEATURE_T2LM) */

+ 185 - 0
wmi/src/wmi_unified_11be_tlv.c

@@ -493,6 +493,187 @@ extract_mlo_link_set_active_resp_tlv(wmi_unified_t wmi_handle, void *evt_buf,
 	return QDF_STATUS_SUCCESS;
 }
 
+#if defined(WLAN_FEATURE_11BE) && defined(WLAN_FEATURE_T2LM)
+size_t peer_assoc_t2lm_params_size(struct peer_assoc_params *req)
+{
+	size_t peer_assoc_t2lm_size = WMI_TLV_HDR_SIZE +
+		(req->t2lm_params.num_dir * T2LM_MAX_NUM_TIDS *
+		 (sizeof(wmi_peer_assoc_tid_to_link_map)));
+
+	return peer_assoc_t2lm_size;
+}
+
+void peer_assoc_populate_t2lm_tlv(wmi_peer_assoc_tid_to_link_map *cmd,
+				  struct wlan_host_t2lm_of_tids *t2lm,
+				  uint8_t tid_num)
+{
+	WMITLV_SET_HDR(&cmd->tlv_header,
+		       WMITLV_TAG_STRUC_wmi_peer_assoc_tid_to_link_map,
+		       WMITLV_GET_STRUCT_TLVLEN(
+				   wmi_peer_assoc_tid_to_link_map));
+
+	/* Populate TID number */
+	WMI_TID_TO_LINK_MAP_TID_NUM_SET(cmd->tid_to_link_map_info, tid_num);
+
+	/* Populate the direction */
+	WMI_TID_TO_LINK_MAP_DIR_SET(cmd->tid_to_link_map_info,
+				    t2lm->direction);
+
+	/* Populate the default link mapping value */
+	WMI_TID_TO_LINK_MAP_DEFAULT_MAPPING_SET(
+			cmd->tid_to_link_map_info,
+			t2lm->default_link_mapping);
+
+	/* Populate the T2LM provisioned links for the corresponding TID
+	 * number.
+	 */
+	WMI_TID_TO_LINK_MAP_LINK_MASK_SET(
+			cmd->tid_to_link_map_info,
+			t2lm->t2lm_provisioned_links[tid_num]);
+
+	wmi_debug("Add T2LM TLV: tid_to_link_map_info:%x",
+		  cmd->tid_to_link_map_info);
+}
+
+uint8_t *peer_assoc_add_tid_to_link_map(uint8_t *buf_ptr,
+					struct peer_assoc_params *req)
+{
+	struct wmi_host_tid_to_link_map_params *t2lm_params = &req->t2lm_params;
+	wmi_peer_assoc_tid_to_link_map *cmd;
+	uint8_t dir = 0;
+	uint8_t tid_num = 0;
+
+	WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC,
+		       (req->t2lm_params.num_dir * T2LM_MAX_NUM_TIDS *
+		       sizeof(wmi_peer_assoc_tid_to_link_map)));
+	buf_ptr += sizeof(uint32_t);
+
+	for (dir = 0; dir < t2lm_params->num_dir; dir++) {
+		wmi_debug("Add T2LM TLV for peer: " QDF_MAC_ADDR_FMT " direction:%d",
+				QDF_MAC_ADDR_REF(t2lm_params->peer_macaddr),
+				dir);
+		for (tid_num = 0; tid_num < T2LM_MAX_NUM_TIDS; tid_num++) {
+			cmd = (wmi_peer_assoc_tid_to_link_map *)buf_ptr;
+			peer_assoc_populate_t2lm_tlv(
+					cmd, &t2lm_params->t2lm_info[dir],
+					tid_num);
+			buf_ptr += sizeof(wmi_peer_assoc_tid_to_link_map);
+		}
+	}
+
+	return buf_ptr;
+}
+
+QDF_STATUS send_mlo_peer_tid_to_link_map_cmd_tlv(
+		wmi_unified_t wmi_handle,
+		struct wmi_host_tid_to_link_map_params *params)
+{
+	wmi_peer_tid_to_link_map_fixed_param *cmd;
+	wmi_tid_to_link_map *t2lm;
+	wmi_buf_t buf;
+	uint8_t *buf_ptr;
+	QDF_STATUS ret = QDF_STATUS_SUCCESS;
+	uint32_t buf_len = 0;
+	uint8_t dir = 0;
+	uint8_t tid_num = 0;
+
+	buf_len = sizeof(wmi_peer_tid_to_link_map_fixed_param) +
+		WMI_TLV_HDR_SIZE + (params->num_dir * T2LM_MAX_NUM_TIDS *
+		 sizeof(wmi_tid_to_link_map));
+
+	buf = wmi_buf_alloc(wmi_handle, buf_len);
+	if (!buf) {
+		wmi_err("wmi buf alloc failed for mlo_peer_mac: "
+				QDF_MAC_ADDR_FMT,
+				QDF_MAC_ADDR_REF(params->peer_macaddr));
+		return QDF_STATUS_E_NOMEM;
+	}
+
+	buf_ptr = (uint8_t *)wmi_buf_data(buf);
+	cmd = (wmi_peer_tid_to_link_map_fixed_param *)buf_ptr;
+
+	WMITLV_SET_HDR(&cmd->tlv_header,
+		       WMITLV_TAG_STRUC_wmi_peer_tid_to_link_map_fixed_param,
+		       WMITLV_GET_STRUCT_TLVLEN(
+			   wmi_peer_tid_to_link_map_fixed_param));
+
+	cmd->pdev_id = wmi_handle->ops->convert_pdev_id_host_to_target(
+			wmi_handle, params->pdev_id);
+
+	WMI_CHAR_ARRAY_TO_MAC_ADDR(params->peer_macaddr, &cmd->link_macaddr);
+
+	buf_ptr += sizeof(wmi_peer_tid_to_link_map_fixed_param);
+
+	WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC,
+		       (params->num_dir * T2LM_MAX_NUM_TIDS *
+		       sizeof(wmi_tid_to_link_map)));
+	buf_ptr += sizeof(uint32_t);
+
+	for (dir = 0; dir < params->num_dir; dir++) {
+		wmi_debug("Add T2LM TLV for peer: " QDF_MAC_ADDR_FMT " direction:%d",
+				QDF_MAC_ADDR_REF(params->peer_macaddr), dir);
+
+		for (tid_num = 0; tid_num < T2LM_MAX_NUM_TIDS; tid_num++) {
+			t2lm = (wmi_tid_to_link_map *)buf_ptr;
+
+			WMITLV_SET_HDR(&t2lm->tlv_header,
+				       WMITLV_TAG_STRUC_wmi_tid_to_link_map,
+				       WMITLV_GET_STRUCT_TLVLEN(
+					   wmi_tid_to_link_map));
+
+			/* Populate TID number */
+			WMI_TID_TO_LINK_MAP_TID_NUM_SET(
+					t2lm->tid_to_link_map_info, tid_num);
+
+			/* Populate the direction */
+			WMI_TID_TO_LINK_MAP_DIR_SET(
+					t2lm->tid_to_link_map_info,
+					params->t2lm_info[dir].direction);
+
+			/* Populate the default link mapping value */
+			WMI_TID_TO_LINK_MAP_DEFAULT_MAPPING_SET(
+					t2lm->tid_to_link_map_info,
+					params->t2lm_info[dir].default_link_mapping);
+
+			/* Populate the T2LM provisioned links for the
+			 * corresponding TID number.
+			 */
+			WMI_TID_TO_LINK_MAP_LINK_MASK_SET(
+					t2lm->tid_to_link_map_info,
+					params->t2lm_info[dir].t2lm_provisioned_links[tid_num]);
+
+			buf_ptr += sizeof(wmi_tid_to_link_map);
+
+			wmi_debug("Add T2LM TLV: tid_to_link_map_info:%x",
+				  t2lm->tid_to_link_map_info);
+		}
+	}
+
+	wmi_mtrace(WMI_MLO_PEER_TID_TO_LINK_MAP_CMDID, cmd->pdev_id, 0);
+	ret = wmi_unified_cmd_send(wmi_handle, buf, buf_len,
+				   WMI_MLO_PEER_TID_TO_LINK_MAP_CMDID);
+	if (ret) {
+		wmi_err("Failed to send T2LM command to FW: %d mlo_peer_mac: " QDF_MAC_ADDR_FMT,
+				ret, QDF_MAC_ADDR_REF(params->peer_macaddr));
+		wmi_buf_free(buf);
+	}
+
+	return ret;
+}
+#else
+size_t peer_assoc_t2lm_params_size(struct peer_assoc_params *req)
+{
+	return WMI_TLV_HDR_SIZE;
+}
+
+uint8_t *peer_assoc_add_tid_to_link_map(uint8_t *buf_ptr,
+					       struct peer_assoc_params *req)
+{
+	WMITLV_SET_HDR(buf_ptr, WMITLV_TAG_ARRAY_STRUC, 0);
+	return buf_ptr + WMI_TLV_HDR_SIZE;
+}
+#endif /* defined(WLAN_FEATURE_11BE) && defined(WLAN_FEATURE_T2LM) */
+
 #ifdef WLAN_MLO_MULTI_CHIP
 QDF_STATUS mlo_setup_cmd_send_tlv(struct wmi_unified *wmi_handle,
 				  struct wmi_mlo_setup_params *param)
@@ -698,4 +879,8 @@ void wmi_11be_attach_tlv(wmi_unified_t wmi_handle)
 		extract_mlo_link_set_active_resp_tlv;
 	ops->send_mlo_link_set_active_cmd =
 		send_mlo_link_set_active_cmd_tlv;
+#if defined(WLAN_FEATURE_11BE) && defined(WLAN_FEATURE_T2LM)
+	ops->send_mlo_peer_tid_to_link_map =
+		send_mlo_peer_tid_to_link_map_cmd_tlv;
+#endif /* defined(WLAN_FEATURE_11BE) && defined(WLAN_FEATURE_T2LM) */
 }

+ 4 - 1
wmi/src/wmi_unified_tlv.c

@@ -2954,7 +2954,8 @@ static QDF_STATUS send_peer_assoc_cmd_tlv(wmi_unified_t wmi_handle,
 		(sizeof(wmi_he_rate_set) * param->peer_he_mcs_count
 		+ WMI_TLV_HDR_SIZE)
 		+ wmi_eht_peer_assoc_params_len(param) +
-		peer_assoc_mlo_params_size(param);
+		peer_assoc_mlo_params_size(param) +
+		peer_assoc_t2lm_params_size(param);
 
 	buf = wmi_buf_alloc(wmi_handle, len);
 	if (!buf)
@@ -3097,6 +3098,8 @@ static QDF_STATUS send_peer_assoc_cmd_tlv(wmi_unified_t wmi_handle,
 
 	buf_ptr = peer_assoc_add_ml_partner_links(buf_ptr, param);
 
+	buf_ptr = peer_assoc_add_tid_to_link_map(buf_ptr, param);
+
 	wmi_mtrace(WMI_PEER_ASSOC_CMDID, cmd->vdev_id, 0);
 	ret = wmi_unified_cmd_send(wmi_handle, buf, len,
 				   WMI_PEER_ASSOC_CMDID);