Sfoglia il codice sorgente

qcacmn: Add support for CFR in adrastea target

Add the init and deinit CFR pdev api for adrastea target type.
cfr_adrastea_init_pdev api enables the CFR feature if both host and
firmware supports the feature, initialises the cfr pdev structure
and streamfs.

Also during allocation of memory requested by firmware, skip smaller
chunks memory allocation for CFR capture requested memory as firmware
expects contiguous memory.

Change-Id: Ib893dc8a845fea990a11e95e98d8a656f7df12ba
CRs-Fixed: 2687057
Surabhi Vishnoi 5 anni fa
parent
commit
d2c2a6aec6

+ 78 - 0
target_if/cfr/inc/target_if_cfr_adrastea.h

@@ -0,0 +1,78 @@
+
+/*
+ * Copyright (c) 2020 The Linux Foundation. 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 copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/**
+ * DOC : target_if_cfr_adrastea.h
+ *
+ * Target interface of CFR for ADRASTEA implementation
+ *
+ */
+
+#ifndef _TARGET_IF_CFR_ADRASTEA_H
+#define _TARGET_IF_CFR_ADRASTEA_H
+
+/* Max size:
+ * 532 = 112 bytes(csi_cfr_header) + 416 bytes(cfr payload) + 4 bytes(trailer)
+ */
+#define STREAMFS_MAX_SUBBUF_ADRASTEA 532
+
+#define STREAMFS_NUM_BUF_SUBBUF_ADRASTEA 255
+
+#ifdef WLAN_CFR_ADRASTEA
+/**
+ * cfr_adrastea_init_pdev() - Init pdev cfr for ADRASTEA
+ * @psoc: pointer to psoc object
+ * @pdev: pointer to pdev object
+ *
+ * Init pdev cfr parameters
+ *
+ * Return: QDF status
+ */
+QDF_STATUS cfr_adrastea_init_pdev(struct wlan_objmgr_psoc *psoc,
+				  struct wlan_objmgr_pdev *pdev);
+
+/**
+ * cfr_adrastea_deinit_pdev() - De-init pdev cfr for ADRASTEA
+ * @psoc: pointer to psoc object
+ * @pdev: pointer to pdev object
+ *
+ * Deinit pdev cfr parameters
+ *
+ * Return: QDF status
+ */
+QDF_STATUS cfr_adrastea_deinit_pdev(struct wlan_objmgr_psoc *psoc,
+				    struct wlan_objmgr_pdev *pdev);
+#else
+static inline
+QDF_STATUS cfr_adrastea_init_pdev(struct wlan_objmgr_psoc *psoc,
+				  struct wlan_objmgr_pdev *pdev)
+{
+	return QDF_STATUS_SUCCESS;
+}
+
+static inline
+QDF_STATUS cfr_adrastea_deinit_pdev(struct wlan_objmgr_psoc *psoc,
+				    struct wlan_objmgr_pdev *pdev)
+{
+	return QDF_STATUS_SUCCESS;
+}
+#endif
+
+#endif /* _TARGET_IF_CFR_ADRASTEA_H */
+

+ 5 - 0
target_if/cfr/src/target_if_cfr.c

@@ -29,6 +29,7 @@
 #include <target_if_cfr_6018.h>
 #ifdef CFR_USE_FIXED_FOLDER
 #include "target_if_cfr_6490.h"
+#include "target_if_cfr_adrastea.h"
 #include "wlan_reg_services_api.h"
 #else
 #include <target_if_cfr_8074v2.h>
@@ -205,6 +206,8 @@ int target_if_cfr_init_pdev(struct wlan_objmgr_psoc *psoc,
 
 	if (target_type == TARGET_TYPE_QCA6490) {
 		status = cfr_6490_init_pdev(psoc, pdev);
+	} else if (target_type == TARGET_TYPE_ADRASTEA) {
+		status = cfr_adrastea_init_pdev(psoc, pdev);
 	} else {
 		cfr_info("unsupport chip");
 		status = QDF_STATUS_SUCCESS;
@@ -223,6 +226,8 @@ int target_if_cfr_deinit_pdev(struct wlan_objmgr_psoc *psoc,
 
 	if (target_type == TARGET_TYPE_QCA6490) {
 		status = cfr_6490_deinit_pdev(psoc, pdev);
+	} else if (target_type == TARGET_TYPE_ADRASTEA) {
+		status = cfr_adrastea_deinit_pdev(psoc, pdev);
 	} else {
 		cfr_info("unsupport chip");
 		status = QDF_STATUS_SUCCESS;

+ 163 - 0
target_if/cfr/src/target_if_cfr_adrastea.c

@@ -0,0 +1,163 @@
+/*
+ * Copyright (c) 2020 The Linux Foundation. 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 copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/**
+ * DOC : target_if_cfr_adrastea.c
+ *
+ * Target interface of CFR for Adrastea implementation
+ *
+ */
+
+#include <cdp_txrx_ctrl.h>
+#include <qdf_nbuf.h>
+#include "target_if_cfr.h"
+#include "init_deinit_lmac.h"
+#include <wlan_objmgr_psoc_obj.h>
+#include "wlan_cfr_utils_api.h"
+#include "target_if_cfr_adrastea.h"
+#include "cfg_ucfg_api.h"
+#include "cfr_cfg.h"
+#include <target_if.h>
+
+#ifdef WLAN_CFR_ADRASTEA
+QDF_STATUS cfr_adrastea_init_pdev(struct wlan_objmgr_psoc *psoc,
+				  struct wlan_objmgr_pdev *pdev)
+{
+	struct pdev_cfr *cfr_pdev;
+	struct psoc_cfr *cfr_psoc;
+	struct wmi_unified *wmi_handle = NULL;
+	struct target_psoc_info *tgt_hdl;
+	struct tgt_info *info;
+	bool cfr_capable;
+	int num_mem_chunks, idx;
+	u32 *read_index;
+
+	if (!psoc || !pdev) {
+		cfr_err("null pdev or psoc");
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	cfr_pdev = wlan_objmgr_pdev_get_comp_private_obj(
+					pdev, WLAN_UMAC_COMP_CFR);
+	if (!cfr_pdev) {
+		cfr_err("null pdev cfr");
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	cfr_psoc = wlan_objmgr_psoc_get_comp_private_obj(
+					psoc, WLAN_UMAC_COMP_CFR);
+
+	if (!cfr_psoc) {
+		cfr_err("null psoc cfr");
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	if (wlan_cfr_is_feature_disabled(pdev)) {
+		cfr_pdev->is_cfr_capable = 0;
+		cfr_psoc->is_cfr_capable = 0;
+		cfr_info("cfr disabled");
+		return QDF_STATUS_SUCCESS;
+	}
+
+	wmi_handle = lmac_get_pdev_wmi_handle(pdev);
+	if (!wmi_handle) {
+		cfr_err("null wmi handle");
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	cfr_capable = wmi_service_enabled(wmi_handle,
+					  wmi_service_cfr_capture_support);
+	cfr_pdev->is_cfr_capable = cfr_capable;
+	cfr_psoc->is_cfr_capable = cfr_capable;
+	cfr_pdev->chip_type = CFR_CAPTURE_RADIO_ADRASTEA;
+	cfr_pdev->cfr_max_sta_count = MAX_CFR_ENABLED_CLIENTS;
+	cfr_pdev->subbuf_size = STREAMFS_MAX_SUBBUF_ADRASTEA;
+	cfr_pdev->num_subbufs = STREAMFS_NUM_BUF_SUBBUF_ADRASTEA;
+	cfr_pdev->pdev_obj = pdev;
+	cfr_psoc->psoc_obj = psoc;
+
+	if (!cfr_capable) {
+		cfr_err("FW doesn't support CFR");
+		return QDF_STATUS_SUCCESS;
+	}
+
+	tgt_hdl = wlan_psoc_get_tgt_if_handle(psoc);
+
+	info = &(tgt_hdl->info);
+	num_mem_chunks = info->num_mem_chunks;
+
+	/*
+	 * Copy the host mem chunk info allocated during init
+	 * for CFR capture in cfr pdev
+	 */
+	for (idx = 0; idx < num_mem_chunks; idx++) {
+		if (info->mem_chunks[idx].req_id ==
+					CFR_CAPTURE_HOST_MEM_REQ_ID) {
+			cfr_pdev->cfr_mem_chunk.vaddr =
+						info->mem_chunks[idx].vaddr;
+			cfr_pdev->cfr_mem_chunk.paddr =
+						info->mem_chunks[idx].paddr;
+			cfr_pdev->cfr_mem_chunk.req_id =
+						info->mem_chunks[idx].req_id;
+			cfr_pdev->cfr_mem_chunk.len = info->mem_chunks[idx].len;
+
+			/* Initialize the read index with default value */
+			read_index = (u32 *)info->mem_chunks[idx].vaddr;
+			(*read_index) = CFR_HOST_MEM_READ_INDEX_DEFAULT;
+			break;
+		}
+	}
+
+	if (idx == num_mem_chunks) {
+		cfr_err("Host mem chunks for CFR req id not allocated\n");
+		cfr_pdev->is_cfr_capable = 0;
+		cfr_psoc->is_cfr_capable = 0;
+		return QDF_STATUS_SUCCESS;
+	}
+
+	return QDF_STATUS_SUCCESS;
+}
+
+QDF_STATUS cfr_adrastea_deinit_pdev(struct wlan_objmgr_psoc *psoc,
+				    struct wlan_objmgr_pdev *pdev)
+{
+	struct pdev_cfr *pcfr;
+
+	if (!psoc || !pdev) {
+		cfr_err("null pdev or psoc");
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	pcfr = wlan_objmgr_pdev_get_comp_private_obj(
+					pdev, WLAN_UMAC_COMP_CFR);
+	if (!pcfr) {
+		cfr_err("null pdev cfr");
+		return QDF_STATUS_E_FAILURE;
+	}
+
+	if (!pcfr->is_cfr_capable) {
+		cfr_info("cfr disabled or FW not support");
+		return QDF_STATUS_SUCCESS;
+	}
+
+	qdf_mem_zero(&pcfr->cfr_mem_chunk,
+		     sizeof(struct cfr_wmi_host_mem_chunk));
+
+	return QDF_STATUS_SUCCESS;
+}
+#endif

+ 1 - 0
target_if/init_deinit/inc/init_cmd_api.h

@@ -31,6 +31,7 @@
 #define TXBF_CV_POOL0 2
 #define TXBF_CV_POOL1 3
 #define TXBF_CV_POOL2 4
+#define CFR_CAPTURE_HOST_MEM_REQ_ID 9
 #define HOST_CONTIGUOUS_MEM_CHUNK_REQUIRED 0x8
 
 /**

+ 4 - 3
target_if/init_deinit/src/init_cmd_api.c

@@ -69,12 +69,13 @@ static uint32_t init_deinit_alloc_host_mem_chunk(struct wlan_objmgr_psoc *psoc,
 		return 0;
 
 	/*
-	 * We have skip smaller chunks memory allocation for TXBF_CV buffer
-	 * as Firmware is expecting continuous memory
+	 * We have skip smaller chunks memory allocation for TXBF_CV and
+	 * CFR_CAPTURE buffer as Firmware is expecting continuous memory
 	 */
 	if (!((num_unit_info & HOST_CONTIGUOUS_MEM_CHUNK_REQUIRED) &&
 	      (req_id == TXBF_CV_POOL0 || req_id == TXBF_CV_POOL1 ||
-	      req_id == TXBF_CV_POOL2))) {
+	      req_id == TXBF_CV_POOL2 ||
+	      req_id == CFR_CAPTURE_HOST_MEM_REQ_ID))) {
 		ichunk = ((num_units * unit_len) >>
 			HOST_MEM_CHUNK_MAX_SIZE_POWER2);
 		if (ichunk)

+ 1 - 0
umac/cfr/dispatcher/inc/wlan_cfr_ucfg_api.h

@@ -22,6 +22,7 @@
 #include <wlan_objmgr_peer_obj.h>
 #include <wlan_objmgr_pdev_obj.h>
 #include <wlan_cfr_public_structs.h>
+#include <wlan_cfr_utils_api.h>
 
 #define MAX_CFR_PRD        (10*60*1000)        /* 10 minutes */
 

+ 4 - 1
umac/cfr/dispatcher/inc/wlan_cfr_utils_api.h

@@ -44,6 +44,8 @@
 #define DBR_EVENT_TIMEOUT_IN_MS_CFR 1
 #define DBR_NUM_RESP_PER_EVENT_CFR 1
 #define MAX_CFR_ENABLED_CLIENTS 10
+#define CFR_CAPTURE_HOST_MEM_REQ_ID 9
+#define CFR_HOST_MEM_READ_INDEX_DEFAULT 8
 #ifdef WLAN_ENH_CFR_ENABLE
 #define MAX_CFR_MU_USERS 4
 #define NUM_CHAN_CAPTURE_STATUS 4
@@ -93,6 +95,7 @@ enum cfrradiotype {
 	CFR_CAPTURE_RADIO_CYP,
 	CFR_CAPTURE_RADIO_HSP,
 	CFR_CAPTURE_RADIO_PINE,
+	CFR_CAPTURE_RADIO_ADRASTEA,
 	CFR_CAPTURE_RADIO_MAX = 0xFF,
 };
 
@@ -234,7 +237,7 @@ struct psoc_cfr {
  */
 struct cfr_wmi_host_mem_chunk {
 	uint32_t *vaddr;
-	uint32_t paddr;
+	qdf_dma_addr_t paddr;
 	uint32_t len;
 	uint32_t req_id;
 };