Browse Source

qcacmn: Extract htt_msdu_idx_to_qtype_map for TX ILP

Extract htt_msdu_idx_to_qtype_map array from wmi service ready
ext2 event, it is needed for DP TX ILP feature enablement.

Change-Id: I64766f5b6ebc6632ce4994a8d53224d98beb5879
CRs-Fixed: 3445507
Jinwei Chen 2 years ago
parent
commit
a3697f6b7c

+ 2 - 0
target_if/core/inc/target_if.h

@@ -205,6 +205,7 @@ struct target_version_info {
  * @pdev_id_to_phy_id_map: pdev id to phy id map
  * @is_pdevid_to_phyid_map: true if @pdev_id_to_phy_id_map is valid
  * @scan_radio_caps: scan radio capabilities
+ * @msdu_idx_qtype_map: HTT msdu index to qtype mapping table
  * @device_mode: Global Device mode
  * @sbs_lower_band_end_freq: sbs lower band end frequency
  * @health_mon_param: health monitor params
@@ -241,6 +242,7 @@ struct tgt_info {
 	uint8_t pdev_id_to_phy_id_map[WLAN_UMAC_MAX_PDEVS];
 	bool is_pdevid_to_phyid_map;
 	struct wlan_psoc_host_scan_radio_caps *scan_radio_caps;
+	uint8_t *msdu_idx_qtype_map;
 	uint32_t device_mode;
 	uint32_t sbs_lower_band_end_freq;
 #ifdef HEALTH_MON_SUPPORT

+ 1 - 0
target_if/core/src/target_if_main.c

@@ -792,6 +792,7 @@ QDF_STATUS target_if_free_psoc_tgt_info(struct wlan_objmgr_psoc *psoc)
 	init_deinit_dbr_ring_cap_free(tgt_psoc_info);
 	init_deinit_spectral_scaling_params_free(tgt_psoc_info);
 	init_deinit_scan_radio_cap_free(tgt_psoc_info);
+	init_deinit_msdu_idx_qtype_map_free(tgt_psoc_info);
 
 	qdf_event_destroy(&tgt_psoc_info->info.event);
 

+ 3 - 0
target_if/init_deinit/inc/service_ready_param.h

@@ -472,6 +472,8 @@ struct wlan_psoc_host_service_ext_param {
  * @ul_mumimo_rx_5g: UL MUMIMO Rx support for 5GHz
  * @ul_mumimo_rx_6g: UL MUMIMO Rx support for 6GHz
  * @afc_dev_type: AFC deployment type
+ * @num_msdu_idx_qtype_map: Number of HTT_MSDUQ_INDEX to HTT_MSDU_QTYPE
+ *                          mapping
  */
 struct wlan_psoc_host_service_ext2_param {
 	uint8_t reg_db_version_major;
@@ -499,6 +501,7 @@ struct wlan_psoc_host_service_ext2_param {
 #if defined(CONFIG_AFC_SUPPORT)
 	enum reg_afc_dev_deploy_type afc_dev_type;
 #endif
+	uint32_t num_msdu_idx_qtype_map;
 };
 
 #endif /* _SERVICE_READY_PARAM_H_*/

+ 27 - 0
target_if/init_deinit/inc/service_ready_util.h

@@ -234,6 +234,17 @@ QDF_STATUS init_deinit_dbr_ring_cap_free(
 QDF_STATUS init_deinit_scan_radio_cap_free(
 				struct target_psoc_info *tgt_psoc_info);
 
+/**
+ * init_deinit_msdu_idx_qtype_map_free() - free msdu index to qtype map
+ * @tgt_psoc_info: target psoc info object
+ *
+ * API to free msdu index to qtype map information.
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS init_deinit_msdu_idx_qtype_map_free(
+				struct target_psoc_info *tgt_psoc_info);
+
 /**
  * init_deinit_spectral_scaling_params_free() - free Spectral scaling params
  * @tgt_psoc_info: target psoc info object
@@ -305,6 +316,22 @@ int init_deinit_populate_scan_radio_cap_ext2(wmi_unified_t handle,
 					     uint8_t *event,
 					     struct tgt_info *info);
 
+/**
+ * init_deinit_populate_msdu_idx_qtype_map_ext2() - populate msdu index to
+ *                                                  qtype map from service
+ *                                                  ready ext2 event
+ * @handle: WMI handle pointer
+ * @event: event buffer received from FW
+ * @info: tgt_info object
+ *
+ * API to populate HTT msdu index to qtype map from service ready ext2 event.
+ *
+ * Return: zero on successful population or non-zero failure
+ */
+int init_deinit_populate_msdu_idx_qtype_map_ext2(wmi_unified_t handle,
+						 uint8_t *event,
+						 struct tgt_info *info);
+
 #ifdef WLAN_SUPPORT_TWT
 /**
  * init_deinit_populate_twt_cap_ext2() - populate twt capabilities from service

+ 8 - 0
target_if/init_deinit/src/init_event_handler.c

@@ -528,6 +528,14 @@ static int init_deinit_service_ext2_ready_event_handler(ol_scn_t scn_handle,
 		goto exit;
 	}
 
+	err_code = init_deinit_populate_msdu_idx_qtype_map_ext2(wmi_handle,
+								event, info);
+
+	if (err_code) {
+		target_if_err("failed to populate msdu index qtype map ext2");
+		goto exit;
+	}
+
 	err_code = init_deinit_populate_twt_cap_ext2(psoc, wmi_handle, event,
 						     info);
 

+ 60 - 0
target_if/init_deinit/src/service_ready_util.c

@@ -937,6 +937,66 @@ QDF_STATUS init_deinit_scan_radio_cap_free(
 
 qdf_export_symbol(init_deinit_scan_radio_cap_free);
 
+int init_deinit_populate_msdu_idx_qtype_map_ext2(wmi_unified_t wmi_handle,
+						 uint8_t *event,
+						 struct tgt_info *info)
+{
+	uint8_t *msdu_qtype;
+	uint32_t num_msdu_idx_qtype_map;
+	uint8_t msdu_idx;
+	QDF_STATUS status;
+
+	if (!event) {
+		target_if_err("Invalid event buffer");
+		return -EINVAL;
+	}
+
+	num_msdu_idx_qtype_map =
+		info->service_ext2_param.num_msdu_idx_qtype_map;
+	target_if_debug("num msdu_idx to qtype map = %d",
+			num_msdu_idx_qtype_map);
+
+	if (!num_msdu_idx_qtype_map)
+		return 0;
+
+	info->msdu_idx_qtype_map = qdf_mem_malloc(sizeof(uint8_t) *
+						  num_msdu_idx_qtype_map);
+
+	if (!info->msdu_idx_qtype_map) {
+		target_if_err("Failed to allocate memory for msdu idx qtype map");
+		return -EINVAL;
+	}
+
+	for (msdu_idx = 0; msdu_idx < num_msdu_idx_qtype_map; msdu_idx++) {
+		msdu_qtype = &info->msdu_idx_qtype_map[msdu_idx];
+		status = wmi_extract_msdu_idx_qtype_map_service_ready_ext2(
+				wmi_handle, event, msdu_idx, msdu_qtype);
+		if (QDF_IS_STATUS_ERROR(status)) {
+			target_if_err("Extraction of msdu idx qtype map failed");
+			goto free_and_return;
+		}
+	}
+
+	return 0;
+
+free_and_return:
+	qdf_mem_free(info->msdu_idx_qtype_map);
+	info->msdu_idx_qtype_map = NULL;
+
+	return qdf_status_to_os_return(status);
+}
+
+QDF_STATUS init_deinit_msdu_idx_qtype_map_free(
+		struct target_psoc_info *tgt_psoc_info)
+{
+	qdf_mem_free(tgt_psoc_info->info.msdu_idx_qtype_map);
+	tgt_psoc_info->info.msdu_idx_qtype_map = NULL;
+
+	return QDF_STATUS_SUCCESS;
+}
+
+qdf_export_symbol(init_deinit_msdu_idx_qtype_map_free);
+
 static bool init_deinit_regdmn_160mhz_support(
 		struct wlan_psoc_host_hal_reg_capabilities_ext *hal_cap)
 {

+ 17 - 0
wmi/inc/wmi_unified_api.h

@@ -3857,6 +3857,23 @@ QDF_STATUS wmi_extract_scan_radio_cap_service_ready_ext2(
 			uint8_t *evt_buf, uint8_t idx,
 			struct wlan_psoc_host_scan_radio_caps *param);
 
+/**
+ * wmi_extract_msdu_idx_qtype_map_service_ready_ext2: Extract HTT MSDU index
+ *                                                    to qtype map received
+ *                                                    through extended service
+ *                                                    ready2 event
+ * @wmi_handle: WMI handle
+ * @evt_buf: Event buffer
+ * @idx: HTT MSDU index in array
+ * @msdu_qtype: MSDU Qtype pointer
+ *
+ * Return: QDF status of operation
+ */
+QDF_STATUS wmi_extract_msdu_idx_qtype_map_service_ready_ext2(
+			wmi_unified_t wmi_handle,
+			uint8_t *evt_buf, uint8_t idx,
+			uint8_t *msdu_qtype);
+
 /**
  * wmi_extract_sw_cal_ver_ext2: Extract sw cal version received through
  *                              extended service ready2 event

+ 5 - 0
wmi/inc/wmi_unified_priv.h

@@ -2253,6 +2253,11 @@ QDF_STATUS (*extract_scan_radio_cap_service_ready_ext2)(
 			uint8_t *evt_buf, uint8_t idx,
 			struct wlan_psoc_host_scan_radio_caps *param);
 
+QDF_STATUS (*extract_msdu_idx_qtype_map_service_ready_ext2)(
+			wmi_unified_t wmi_handle,
+			uint8_t *evt_buf, uint8_t idx,
+			uint8_t *msdu_qtype);
+
 QDF_STATUS (*extract_sw_cal_ver_ext2)(wmi_unified_t wmi_handle,
 				      uint8_t *event,
 				      struct wmi_host_sw_cal_ver *cal);

+ 14 - 0
wmi/src/wmi_unified_api.c

@@ -2747,6 +2747,20 @@ QDF_STATUS wmi_extract_scan_radio_cap_service_ready_ext2(
 	return QDF_STATUS_E_FAILURE;
 }
 
+QDF_STATUS wmi_extract_msdu_idx_qtype_map_service_ready_ext2(
+			wmi_unified_t wmi_handle,
+			uint8_t *evt_buf, uint8_t idx,
+			uint8_t *msdu_qtype)
+{
+	if (wmi_handle->ops->extract_msdu_idx_qtype_map_service_ready_ext2)
+		return wmi_handle->ops->
+		       extract_msdu_idx_qtype_map_service_ready_ext2(
+				wmi_handle,
+				evt_buf, idx, msdu_qtype);
+
+	return QDF_STATUS_E_FAILURE;
+}
+
 QDF_STATUS wmi_extract_sw_cal_ver_ext2(wmi_unified_t wmi_handle,
 				       uint8_t *event,
 				       struct wmi_host_sw_cal_ver *cal)

+ 38 - 0
wmi/src/wmi_unified_tlv.c

@@ -14278,6 +14278,9 @@ extract_service_ready_ext2_tlv(wmi_unified_t wmi_handle, uint8_t *event,
 
 	param->num_dbr_ring_caps = param_buf->num_dma_ring_caps;
 
+	param->num_msdu_idx_qtype_map =
+				param_buf->num_htt_msdu_idx_to_qtype_map;
+
 	if (param_buf->nan_cap)
 		param->max_ndp_sessions =
 			param_buf->nan_cap->max_ndp_sessions;
@@ -14922,6 +14925,39 @@ static QDF_STATUS extract_scan_radio_cap_service_ready_ext2_tlv(
 	return QDF_STATUS_SUCCESS;
 }
 
+static QDF_STATUS extract_msdu_idx_qtype_map_service_ready_ext2_tlv(
+			wmi_unified_t wmi_handle,
+			uint8_t *event, uint8_t idx,
+			uint8_t *msdu_qtype)
+{
+	WMI_SERVICE_READY_EXT2_EVENTID_param_tlvs *param_buf;
+	wmi_htt_msdu_idx_to_htt_msdu_qtype *msdu_idx_to_qtype;
+	uint8_t wmi_htt_msdu_idx;
+
+	param_buf = (WMI_SERVICE_READY_EXT2_EVENTID_param_tlvs *)event;
+	if (!param_buf)
+		return QDF_STATUS_E_INVAL;
+
+	if (idx >= param_buf->num_htt_msdu_idx_to_qtype_map)
+		return QDF_STATUS_E_INVAL;
+
+	msdu_idx_to_qtype = &param_buf->htt_msdu_idx_to_qtype_map[idx];
+	wmi_htt_msdu_idx =
+		WMI_HTT_MSDUQ_IDX_TO_MSDUQ_QTYPE_INDEX_GET(
+					msdu_idx_to_qtype->index_and_type);
+	if (wmi_htt_msdu_idx != idx) {
+		wmi_err("wmi_htt_msdu_idx 0x%x is not same as idx 0x%x",
+			wmi_htt_msdu_idx, idx);
+		return QDF_STATUS_E_INVAL;
+	}
+
+	*msdu_qtype =
+		WMI_HTT_MSDUQ_IDX_TO_MSDUQ_QTYPE_TYPE_GET(
+					msdu_idx_to_qtype->index_and_type);
+
+	return QDF_STATUS_SUCCESS;
+}
+
 static QDF_STATUS extract_sw_cal_ver_ext2_tlv(wmi_unified_t wmi_handle,
 					      uint8_t *event,
 					      struct wmi_host_sw_cal_ver *cal)
@@ -20805,6 +20841,8 @@ struct wmi_ops tlv_ops =  {
 				extract_dbr_ring_cap_service_ready_ext2_tlv,
 	.extract_scan_radio_cap_service_ready_ext2 =
 				extract_scan_radio_cap_service_ready_ext2_tlv,
+	.extract_msdu_idx_qtype_map_service_ready_ext2 =
+			extract_msdu_idx_qtype_map_service_ready_ext2_tlv,
 	.extract_sw_cal_ver_ext2 = extract_sw_cal_ver_ext2_tlv,
 	.extract_sar_cap_service_ready_ext =
 				extract_sar_cap_service_ready_ext_tlv,