Browse Source

qcacld-3.0: FISA init code movement

Move the FISA initialization code to DP
component.

Change-Id: Idaf0d195ea3f24f8d4294eba19d71d5cc9dbc528
CRs-Fixed: 3512041
Rakesh Pillai 1 năm trước cách đây
mục cha
commit
1fe1ac7688

+ 6 - 0
components/dp/core/inc/wlan_dp_priv.h

@@ -523,6 +523,8 @@ struct dp_direct_link_context {
  * @arp_connectivity_map: ARP connectivity map
  * @rx_wake_lock: rx wake lock
  * @ol_enable: Enable/Disable offload
+ * @fst_cmem_base: FST base in CMEM
+ * @fst_in_cmem: Flag indicating if FST is in CMEM or not
  */
 struct wlan_dp_psoc_context {
 	struct wlan_objmgr_psoc *psoc;
@@ -601,6 +603,10 @@ struct wlan_dp_psoc_context {
 	qdf_mutex_t dp_direct_link_lock;
 	struct dp_direct_link_context *dp_direct_link_ctx;
 #endif
+#ifdef WLAN_SUPPORT_RX_FISA
+	uint64_t fst_cmem_base;
+	bool fst_in_cmem;
+#endif
 };
 
 #ifdef WLAN_DP_PROFILE_SUPPORT

+ 49 - 1
components/dp/core/src/wlan_dp_fisa_rx.h

@@ -1,6 +1,6 @@
 /*
  * Copyright (c) 2020-2021, The Linux Foundation. All rights reserved.
- * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
+ * Copyright (c) 2022-2023 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
@@ -15,8 +15,11 @@
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
+#ifdef WLAN_SUPPORT_RX_FISA
 #include <dp_types.h>
+#endif
 #include <qdf_status.h>
+#include <wlan_dp_priv.h>
 
 //#define FISA_DEBUG_ENABLE
 
@@ -44,6 +47,9 @@
 #define FISA_MIN_L4_AND_DATA_LEN \
 	(FISA_UDP_HDR_LEN + FISA_MIN_UDP_DATA_LEN)
 
+/* CMEM size for FISA FST 16K */
+#define DP_CMEM_FST_SIZE 16384
+
 #define IPSEC_PORT 500
 #define IPSEC_NAT_PORT 4500
 #define DNS_SERVER_PORT 53
@@ -145,6 +151,38 @@ void dp_fisa_rx_fst_update_work(void *arg);
  */
 void dp_suspend_fse_cache_flush(struct dp_soc *soc);
 
+/**
+ * dp_rx_fst_attach() - Initialize Rx FST and setup necessary parameters
+ * @dp_ctx: DP component context
+ *
+ * Return: Handle to flow search table entry
+ */
+QDF_STATUS dp_rx_fst_attach(struct wlan_dp_psoc_context *dp_ctx);
+
+/**
+ * dp_rx_fst_target_config() - Configure RX OLE FSE engine in HW
+ * @dp_ctx: DP component context
+ *
+ * Return: Success
+ */
+QDF_STATUS dp_rx_fst_target_config(struct wlan_dp_psoc_context *dp_ctx);
+
+/**
+ * dp_rx_fisa_config() - Configure FISA related settings
+ * @dp_ctx: DP component context
+ *
+ * Return: QDF_STATUS
+ */
+QDF_STATUS dp_rx_fisa_config(struct wlan_dp_psoc_context *dp_ctx);
+
+/**
+ * dp_rx_fst_detach() - De-initialize Rx FST
+ * @dp_ctx: DP component context
+ *
+ * Return: None
+ */
+void dp_rx_fst_detach(struct wlan_dp_psoc_context *dp_ctx);
+
 /**
  * dp_resume_fse_cache_flush() - Resume FSE cache flush
  * @soc: core txrx main context
@@ -152,6 +190,16 @@ void dp_suspend_fse_cache_flush(struct dp_soc *soc);
  * Return: None
  */
 void dp_resume_fse_cache_flush(struct dp_soc *soc);
+
+/**
+ * dp_rx_flow_send_fst_fw_setup() - Program FST parameters in FW/HW post-attach
+ * @soc: SoC handle
+ * @pdev: Pdev handle
+ *
+ * Return: Success when fst parameters are programmed in FW, error otherwise
+ */
+QDF_STATUS dp_rx_flow_send_fst_fw_setup(struct dp_soc *soc,
+					struct dp_pdev *pdev);
 #else
 static QDF_STATUS dp_rx_dump_fisa_stats(struct dp_soc *soc)
 {

+ 92 - 2
components/dp/core/src/wlan_dp_main.c

@@ -62,6 +62,7 @@ static struct wlan_dp_memory_profile_ctx wlan_dp_1x1_he80_1kqam[] = {
 /* Global data structure to save profile info */
 static struct wlan_dp_memory_profile_info g_dp_profile_info;
 #endif
+#include <wlan_dp_fisa_rx.h>
 
 /* Global DP context */
 static struct wlan_dp_psoc_context *gp_dp_ctx;
@@ -1576,6 +1577,66 @@ bool dp_is_data_stall_event_enabled(uint32_t evt)
 	return false;
 }
 
+#ifdef WLAN_SUPPORT_RX_FISA
+static inline QDF_STATUS
+wlan_dp_rx_fisa_attach_target(struct wlan_dp_psoc_context *dp_ctx)
+{
+	QDF_STATUS status;
+
+	status = dp_rx_fst_target_config(dp_ctx);
+	if (status != QDF_STATUS_SUCCESS &&
+	    status != QDF_STATUS_E_NOSUPPORT) {
+		dp_err("Failed to send htt fst setup config message to target");
+		return status;
+	}
+
+	if (status == QDF_STATUS_SUCCESS) {
+		status = dp_rx_fisa_config(dp_ctx);
+		if (QDF_IS_STATUS_ERROR(status)) {
+			dp_err("Failed to send htt FISA config message to target");
+			return status;
+		}
+	}
+
+	return status;
+}
+
+static inline QDF_STATUS
+wlan_dp_rx_fisa_attach(struct wlan_dp_psoc_context *dp_ctx)
+{
+	return dp_rx_fst_attach(dp_ctx);
+}
+
+static inline void wlan_dp_rx_fisa_detach(struct wlan_dp_psoc_context *dp_ctx)
+{
+	return dp_rx_fst_detach(dp_ctx);
+}
+
+static inline void
+wlan_dp_rx_fisa_cmem_attach(struct wlan_dp_psoc_context *dp_ctx)
+{
+	dp_ctx->fst_cmem_base = cdp_get_fst_cem_base(dp_ctx->cdp_soc,
+						     DP_CMEM_FST_SIZE);
+}
+#else
+static inline QDF_STATUS
+wlan_dp_rx_fisa_attach(struct wlan_dp_psoc_context *dp_ctx)
+{
+	return QDF_STATUS_SUCCESS;
+}
+
+static inline QDF_STATUS
+wlan_dp_rx_fisa_detach(struct wlan_dp_psoc_context *dp_ctx)
+{
+	return QDF_STATUS_SUCCESS;
+}
+
+static inline void
+wlan_dp_rx_fisa_cmem_attach(struct wlan_dp_psoc_context *dp_ctx)
+{
+}
+#endif
+
 QDF_STATUS __wlan_dp_runtime_suspend(ol_txrx_soc_handle soc, uint8_t pdev_id)
 {
 	return cdp_runtime_suspend(soc, pdev_id);
@@ -1599,11 +1660,13 @@ QDF_STATUS __wlan_dp_bus_resume(ol_txrx_soc_handle soc, uint8_t pdev_id)
 void *wlan_dp_txrx_soc_attach(struct dp_txrx_soc_attach_params *params,
 			      bool *is_wifi3_0_target)
 {
+	struct wlan_dp_psoc_context *dp_ctx;
 	void *dp_soc = NULL;
 	struct hif_opaque_softc *hif_context;
 	HTC_HANDLE htc_ctx = cds_get_context(QDF_MODULE_ID_HTC);
 	qdf_device_t qdf_ctx = cds_get_context(QDF_MODULE_ID_QDF_DEVICE);
 
+	dp_ctx = dp_get_context();
 	hif_context = cds_get_context(QDF_MODULE_ID_HIF);
 
 	if (TARGET_TYPE_QCA6290 == params->target_type ||
@@ -1651,6 +1714,12 @@ void *wlan_dp_txrx_soc_attach(struct dp_txrx_soc_attach_params *params,
 					params->dp_ol_if_ops);
 	}
 
+	if (!dp_soc)
+		return NULL;
+
+	dp_ctx->cdp_soc = dp_soc;
+	wlan_dp_rx_fisa_cmem_attach(dp_ctx);
+
 	return dp_soc;
 
 err_soc_detach:
@@ -1668,15 +1737,22 @@ void wlan_dp_txrx_soc_detach(ol_txrx_soc_handle soc)
 
 QDF_STATUS wlan_dp_txrx_attach_target(ol_txrx_soc_handle soc, uint8_t pdev_id)
 {
+	struct wlan_dp_psoc_context *dp_ctx;
 	QDF_STATUS qdf_status;
 	int errno;
 
+	dp_ctx = dp_get_context();
+
 	qdf_status = cdp_soc_attach_target(soc);
 	if (QDF_IS_STATUS_ERROR(qdf_status)) {
 		dp_err("Failed to attach soc target; status:%d", qdf_status);
 		return qdf_status;
 	}
 
+	qdf_status = wlan_dp_rx_fisa_attach_target(dp_ctx);
+	if (QDF_IS_STATUS_ERROR(qdf_status))
+		return qdf_status;
+
 	errno = cdp_pdev_attach_target(soc, pdev_id);
 	if (errno) {
 		dp_err("Failed to attach pdev target; errno:%d", errno);
@@ -1695,6 +1771,7 @@ QDF_STATUS wlan_dp_txrx_pdev_attach(ol_txrx_soc_handle soc)
 {
 	struct wlan_dp_psoc_context *dp_ctx;
 	struct cdp_pdev_attach_params pdev_params = { 0 };
+	QDF_STATUS qdf_status;
 
 	dp_ctx =  dp_get_context();
 
@@ -1702,8 +1779,20 @@ QDF_STATUS wlan_dp_txrx_pdev_attach(ol_txrx_soc_handle soc)
 	pdev_params.qdf_osdev = cds_get_context(QDF_MODULE_ID_QDF_DEVICE);
 	pdev_params.pdev_id = 0;
 
-	return cdp_pdev_attach(cds_get_context(QDF_MODULE_ID_SOC),
-			       &pdev_params);
+	qdf_status = cdp_pdev_attach(cds_get_context(QDF_MODULE_ID_SOC),
+				     &pdev_params);
+	if (QDF_IS_STATUS_ERROR(qdf_status))
+		return qdf_status;
+
+	/* FISA Attach */
+	qdf_status = wlan_dp_rx_fisa_attach(dp_ctx);
+	if (QDF_IS_STATUS_ERROR(qdf_status)) {
+		wlan_dp_txrx_pdev_detach(cds_get_context(QDF_MODULE_ID_SOC),
+					 OL_TXRX_PDEV_ID, false);
+		return qdf_status;
+	}
+
+	return qdf_status;
 }
 
 QDF_STATUS wlan_dp_txrx_pdev_detach(ol_txrx_soc_handle soc, uint8_t pdev_id,
@@ -1712,6 +1801,7 @@ QDF_STATUS wlan_dp_txrx_pdev_detach(ol_txrx_soc_handle soc, uint8_t pdev_id,
 	struct wlan_dp_psoc_context *dp_ctx;
 
 	dp_ctx =  dp_get_context();
+	wlan_dp_rx_fisa_detach(dp_ctx);
 	return cdp_pdev_detach(soc, pdev_id, force);
 }
 

+ 47 - 24
components/dp/core/src/wlan_dp_rx_fst.c

@@ -26,6 +26,7 @@
 #include "dp_internal.h"
 #include "hif.h"
 #include "wlan_dp_rx_thread.h"
+#include <wlan_dp_fisa_rx.h>
 
 /* Timeout in milliseconds to wait for CMEM FST HTT response */
 #define DP_RX_FST_CMEM_RESP_TIMEOUT 2000
@@ -274,19 +275,13 @@ static void dp_rx_sw_ft_hist_deinit(struct dp_fisa_rx_sw_ft *sw_ft,
 }
 #endif
 
-/**
- * dp_rx_fst_attach() - Initialize Rx FST and setup necessary parameters
- * @soc: SoC handle
- * @pdev: Pdev handle
- *
- * Return: Handle to flow search table entry
- */
-QDF_STATUS dp_rx_fst_attach(struct dp_soc *soc, struct dp_pdev *pdev)
+QDF_STATUS dp_rx_fst_attach(struct wlan_dp_psoc_context *dp_ctx)
 {
+	struct dp_soc *soc = (struct dp_soc *)dp_ctx->cdp_soc;
+	struct wlan_cfg_dp_soc_ctxt *cfg = soc->wlan_cfg_ctx;
 	struct dp_rx_fst *fst;
 	struct dp_fisa_rx_sw_ft *ft_entry;
 	uint8_t *hash_key;
-	struct wlan_cfg_dp_soc_ctxt *cfg = soc->wlan_cfg_ctx;
 	int i = 0;
 	QDF_STATUS status;
 
@@ -429,13 +424,6 @@ static void dp_rx_fst_check_cmem_support(struct dp_soc *soc)
 	fst->fst_in_cmem = true;
 }
 
-/**
- * dp_rx_flow_send_fst_fw_setup() - Program FST parameters in FW/HW post-attach
- * @soc: SoC handle
- * @pdev: Pdev handle
- *
- * Return: Success when fst parameters are programmed in FW, error otherwise
- */
 QDF_STATUS dp_rx_flow_send_fst_fw_setup(struct dp_soc *soc,
 					struct dp_pdev *pdev)
 {
@@ -488,15 +476,9 @@ QDF_STATUS dp_rx_flow_send_fst_fw_setup(struct dp_soc *soc,
 	return status;
 }
 
-/**
- * dp_rx_fst_detach() - De-initialize Rx FST
- * @soc: SoC handle
- * @pdev: Pdev handle
- *
- * Return: None
- */
-void dp_rx_fst_detach(struct dp_soc *soc, struct dp_pdev *pdev)
+void dp_rx_fst_detach(struct wlan_dp_psoc_context *dp_ctx)
 {
+	struct dp_soc *soc = (struct dp_soc *)dp_ctx->cdp_soc;
 	struct dp_rx_fst *dp_fst;
 
 	dp_fst = soc->rx_fst;
@@ -570,6 +552,47 @@ void dp_rx_fst_requeue_wq(struct dp_soc *soc)
 	dp_info("requeued defer fst update task");
 }
 
+QDF_STATUS dp_rx_fst_target_config(struct wlan_dp_psoc_context *dp_ctx)
+{
+	struct dp_soc *soc = (struct dp_soc *)dp_ctx->cdp_soc;
+	QDF_STATUS status;
+	struct dp_rx_fst *fst = soc->rx_fst;
+
+	/* Check if it is enabled in the INI */
+	if (!soc->fisa_enable) {
+		dp_err("RX FISA feature is disabled");
+		return QDF_STATUS_E_NOSUPPORT;
+	}
+
+	status = dp_rx_flow_send_fst_fw_setup(soc, soc->pdev_list[0]);
+	if (QDF_IS_STATUS_ERROR(status)) {
+		dp_err("dp_rx_flow_send_fst_fw_setup failed %d",
+		       status);
+		return status;
+	}
+
+	if (dp_ctx->fst_cmem_base) {
+		dp_ctx->fst_in_cmem = true;
+		dp_rx_fst_update_cmem_params(soc, fst->max_entries,
+					     dp_ctx->fst_cmem_base & 0xffffffff,
+					     dp_ctx->fst_cmem_base >> 32);
+	}
+	return status;
+}
+
+#define FISA_MAX_TIMEOUT 0xffffffff
+#define FISA_DISABLE_TIMEOUT 0
+QDF_STATUS dp_rx_fisa_config(struct wlan_dp_psoc_context *dp_ctx)
+{
+	struct dp_soc *soc = (struct dp_soc *)dp_ctx->cdp_soc;
+	struct dp_htt_rx_fisa_cfg fisa_config;
+
+	fisa_config.pdev_id = 0;
+	fisa_config.fisa_timeout = FISA_MAX_TIMEOUT;
+
+	return dp_htt_rx_fisa_config(soc->pdev_list[0], &fisa_config);
+}
+
 #else /* WLAN_SUPPORT_RX_FISA */
 
 #endif /* !WLAN_SUPPORT_RX_FISA */