Ver Fonte

qcacmn: Support dma_ring_caps info processing

EXT2 event carries the dma_ring_caps info.Necessary
support to process the same is being provided.

Change-Id: Id8ef1840470b272db00fa5e8f98d1fe9dc273a7e
Debasis Das há 5 anos atrás
pai
commit
285561b9ab

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

@@ -176,6 +176,7 @@ struct target_version_info {
  * @service_ext2_param: service ready ext2 event params
  * @service_ext_param: ext service params
  * @mac_phy_cap: phy caps array
+ * @dbr_ring_cap: dbr_ring capability info
  * @reg_cap: regulatory caps array
  * @scaling_params: Spectral bin scaling parameters
  * @num_mem_chunks: number of mem chunks allocated
@@ -1291,6 +1292,26 @@ static inline struct wlan_psoc_host_service_ext_param
 	return &psoc_info->info.service_ext_param;
 }
 
+/**
+ * target_psoc_get_num_dbr_ring_caps() - get no of dbr_ring_caps
+ * @psoc_info:  pointer to structure target_psoc_info
+ *
+ * API to get num_dbr_ring_caps
+ *
+ * Return: no of dbr_ring_caps
+ */
+static inline uint32_t target_psoc_get_num_dbr_ring_caps
+		(struct target_psoc_info *psoc_info)
+{
+	if (!psoc_info)
+		return 0;
+
+	if (psoc_info->info.service_ext_param.num_dbr_ring_caps)
+		return psoc_info->info.service_ext_param.num_dbr_ring_caps;
+
+	return psoc_info->info.service_ext2_param.num_dbr_ring_caps;
+}
+
 /**
  * target_psoc_get_mac_phy_cap_for_mode() - get mac_phy_cap for a hw-mode
  * @psoc_info:  pointer to structure target_psoc_info

+ 2 - 6
target_if/direct_buf_rx/src/target_if_direct_buf_rx_main.c

@@ -43,7 +43,6 @@ static uint8_t get_num_dbr_modules_per_pdev(struct wlan_objmgr_pdev *pdev)
 	struct wlan_psoc_host_dbr_ring_caps *dbr_ring_cap;
 	uint8_t num_dbr_ring_caps, cap_idx, pdev_id, num_modules;
 	struct target_psoc_info *tgt_psoc_info;
-	struct wlan_psoc_host_service_ext_param *ext_svc_param;
 
 	psoc = wlan_pdev_get_psoc(pdev);
 
@@ -57,8 +56,7 @@ static uint8_t get_num_dbr_modules_per_pdev(struct wlan_objmgr_pdev *pdev)
 		direct_buf_rx_err("target_psoc_info is null");
 		return 0;
 	}
-	ext_svc_param = target_psoc_get_service_ext_param(tgt_psoc_info);
-	num_dbr_ring_caps = ext_svc_param->num_dbr_ring_caps;
+	num_dbr_ring_caps = target_psoc_get_num_dbr_ring_caps(tgt_psoc_info);
 	dbr_ring_cap = target_psoc_get_dbr_ring_caps(tgt_psoc_info);
 	pdev_id = wlan_objmgr_pdev_get_pdev_id(pdev);
 	num_modules = 0;
@@ -81,7 +79,6 @@ static QDF_STATUS populate_dbr_cap_mod_param(struct wlan_objmgr_pdev *pdev,
 	enum DBR_MODULE mod_id = mod_param->mod_id;
 	uint32_t num_dbr_ring_caps, pdev_id;
 	struct target_psoc_info *tgt_psoc_info;
-	struct wlan_psoc_host_service_ext_param *ext_svc_param;
 
 	psoc = wlan_pdev_get_psoc(pdev);
 
@@ -96,8 +93,7 @@ static QDF_STATUS populate_dbr_cap_mod_param(struct wlan_objmgr_pdev *pdev,
 		return QDF_STATUS_E_INVAL;
 	}
 
-	ext_svc_param = target_psoc_get_service_ext_param(tgt_psoc_info);
-	num_dbr_ring_caps = ext_svc_param->num_dbr_ring_caps;
+	num_dbr_ring_caps = target_psoc_get_num_dbr_ring_caps(tgt_psoc_info);
 	dbr_ring_cap = target_psoc_get_dbr_ring_caps(tgt_psoc_info);
 	pdev_id = wlan_objmgr_pdev_get_pdev_id(pdev);
 

+ 2 - 1
target_if/init_deinit/inc/service_ready_param.h

@@ -354,13 +354,14 @@ struct wlan_psoc_host_service_ext_param {
  * reg_db_version_minor: REG DB version minor number
  * bdf_reg_db_version_major: BDF REG DB version major number
  * bdf_reg_db_version_minor: BDF REG DB version minor number
+ * @num_dbr_ring_caps: Number of direct buf rx ring capabilities
  */
 struct wlan_psoc_host_service_ext2_param {
 	uint8_t reg_db_version_major;
 	uint8_t reg_db_version_minor;
 	uint8_t bdf_reg_db_version_major;
 	uint8_t bdf_reg_db_version_minor;
-
+	uint32_t num_dbr_ring_caps;
 };
 
 #endif /* _SERVICE_READY_PARAM_H_*/

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

@@ -179,6 +179,22 @@ int init_deinit_populate_dbr_ring_cap(struct wlan_objmgr_psoc *psoc,
 				      wmi_unified_t handle, uint8_t *event,
 				      struct tgt_info *info);
 
+/**
+ * init_deinit_populate_dbr_ring_cap_ext2() - populate dbr ring capability
+ *                                            from ext2 event
+ * @psoc: PSOC object
+ * @handle: WMI handle pointer
+ * @event: event buffer received from FW
+ * @info: tgt_info object
+ *
+ * API to populate dbr ring capability
+ *
+ * Return: zero on successful parsing of dbr ring capability or failure
+ */
+int init_deinit_populate_dbr_ring_cap_ext2(struct wlan_objmgr_psoc *psoc,
+					   wmi_unified_t handle, uint8_t *event,
+					   struct tgt_info *info);
+
 /**
  * init_deinit_populate_spectral_bin_scale_params() - populate Spectral scaling
  * @psoc: PSOC object

+ 16 - 4
target_if/init_deinit/src/init_event_handler.c

@@ -233,6 +233,15 @@ static int init_deinit_service_ext2_ready_event_handler(ol_scn_t scn_handle,
 	if (err_code)
 		goto exit;
 
+	/* dbr_ring_caps could have already come as part of EXT event */
+	if (info->service_ext2_param.num_dbr_ring_caps) {
+		err_code = init_deinit_populate_dbr_ring_cap_ext2(psoc,
+								  wmi_handle,
+								  event, info);
+		if (err_code)
+			goto exit;
+	}
+
 	/* send init command */
 	init_deinit_set_send_init_cmd(psoc, tgt_hdl);
 
@@ -315,10 +324,13 @@ static int init_deinit_service_ext_ready_event_handler(ol_scn_t scn_handle,
 			goto exit;
 	}
 
-	err_code = init_deinit_populate_dbr_ring_cap(psoc, wmi_handle,
-						event, info);
-	if (err_code)
-		goto exit;
+	/* dbr_ring_caps can be absent if enough space is not available */
+	if (info->service_ext_param.num_dbr_ring_caps) {
+		err_code = init_deinit_populate_dbr_ring_cap(psoc, wmi_handle,
+							     event, info);
+		if (err_code)
+			goto exit;
+	}
 
 	err_code = init_deinit_populate_spectral_bin_scale_params(psoc,
 								  wmi_handle,

+ 54 - 1
target_if/init_deinit/src/service_ready_util.c

@@ -379,7 +379,6 @@ int init_deinit_populate_dbr_ring_cap(struct wlan_objmgr_psoc *psoc,
 	QDF_STATUS status = QDF_STATUS_SUCCESS;
 
 	num_dbr_ring_caps = info->service_ext_param.num_dbr_ring_caps;
-
 	target_if_debug("Num DMA Capabilities = %d", num_dbr_ring_caps);
 
 	if (!num_dbr_ring_caps)
@@ -411,6 +410,60 @@ free_and_return:
 	return qdf_status_to_os_return(status);
 }
 
+int init_deinit_populate_dbr_ring_cap_ext2(struct wlan_objmgr_psoc *psoc,
+					   wmi_unified_t handle, uint8_t *event,
+					   struct tgt_info *info)
+
+{
+	uint8_t cap_idx;
+	uint32_t num_dbr_ring_caps;
+	QDF_STATUS status = QDF_STATUS_SUCCESS;
+	struct wlan_psoc_host_dbr_ring_caps *param;
+
+	/*
+	 * If FW had already sent this info as part of EXT event,
+	 * we need to discard the same and use the info from EXT2.
+	 */
+	if (info->service_ext_param.num_dbr_ring_caps) {
+		target_if_debug("dbr_ring_caps already populated");
+		info->service_ext_param.num_dbr_ring_caps = 0;
+		qdf_mem_free(info->dbr_ring_cap);
+		info->dbr_ring_cap = NULL;
+	}
+
+	num_dbr_ring_caps = info->service_ext2_param.num_dbr_ring_caps;
+	target_if_debug("Num DMA Capabilities = %d", num_dbr_ring_caps);
+
+	if (!num_dbr_ring_caps)
+		return 0;
+
+	info->dbr_ring_cap = qdf_mem_malloc(
+				sizeof(struct wlan_psoc_host_dbr_ring_caps) *
+				num_dbr_ring_caps);
+
+	if (!info->dbr_ring_cap)
+		return -EINVAL;
+
+	for (cap_idx = 0; cap_idx < num_dbr_ring_caps; cap_idx++) {
+		param = &info->dbr_ring_cap[cap_idx];
+		status = wmi_extract_dbr_ring_cap_service_ready_ext2(handle,
+								     event,
+								     cap_idx,
+								     param);
+		if (QDF_IS_STATUS_ERROR(status)) {
+			target_if_err("Extraction of DMA cap failed");
+			goto free_and_return;
+		}
+	}
+
+	return 0;
+
+free_and_return:
+	qdf_mem_free(info->dbr_ring_cap);
+	info->dbr_ring_cap = NULL;
+
+	return qdf_status_to_os_return(status);
+}
 int init_deinit_populate_spectral_bin_scale_params(
 			struct wlan_objmgr_psoc *psoc, wmi_unified_t handle,
 			uint8_t *event, struct tgt_info *info)