ソースを参照

qcacld-3.0: Refactor Ramdump API and PKTLOG API

Ramdump collection can be supported by buses other than PCIe, hence
move it to main files so other buses can also access those API's.

PKTLOG is a DataPath Feature, HIF doesn't need to have any info
of it. Move pktlog implementation to HTT folder.

Change-Id: I113ef9bb44438cd7a1ba70799ce7e72f2eaa7121
CRs-Fixed: 967765
Komal Seelam 9 年 前
コミット
c4b2863aa8

+ 35 - 6
core/bmi/src/ol_fw.c

@@ -479,19 +479,48 @@ static int ol_transfer_bin_file(struct ol_softc *scn, ATH_BIN_FILE file,
 
 static struct ol_softc *ramdump_scn;
 
+/**
+ * struct ramdump_info: Structure to hold ramdump information
+ * @base: Base address for Ramdump collection
+ * @size: Size of the dump
+ *
+ * Ramdump information.
+ */
+struct ramdump_info {
+        void *base;
+        unsigned long size;
+};
+
+#if defined(CONFIG_CNSS) && !defined(QCA_WIFI_3_0)
+static inline void ol_get_ramdump_mem(struct ramdump_info *info)
+{
+	info->base = cnss_get_virt_ramdump_mem(&info->size);
+}
+#else
+static inline void ol_get_ramdump_mem(struct ramdump_info *info) { }
+#endif
+
 int ol_copy_ramdump(struct ol_softc *scn)
 {
-	int ret;
+	int ret = -1;
+
+	struct ramdump_info *info = cdf_mem_malloc(sizeof(struct ramdump_info));
+
+	if (!info) {
+		BMI_ERR("%s Memory for Ramdump Allocation failed", __func__);
+		return -ENOMEM;
+	}
+
+	ol_get_ramdump_mem(info);
 
-	if (!scn->ramdump_base || !scn->ramdump_size) {
+	if (!info->base || !info->size) {
 		BMI_ERR("%s:ramdump collection fail", __func__);
-		ret = -EACCES;
-		goto out;
+		return -EACCES;
 	}
 
-	ret = ol_target_coredump(scn, scn->ramdump_base, scn->ramdump_size);
+	ret = ol_target_coredump(scn, info->base, info->size);
 
-out:
+	cdf_mem_free(info);
 	return ret;
 }
 

+ 54 - 3
core/dp/txrx/ol_txrx.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011-2015 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2011-2016 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -71,7 +71,11 @@
 #include <ol_tx_queue.h>
 #include <ol_txrx.h>
 #include "wma.h"
-
+#ifndef REMOVE_PKT_LOG
+#include "pktlog_ac.h"
+#endif
+#include <cds_concurrency.h>
+#include "epping_main.h"
 
 
 /*=== function definitions ===*/
@@ -440,6 +444,50 @@ fail0:
 	return NULL;
 }
 
+#if !defined(REMOVE_PKT_LOG) && !defined(QVIT)
+/**
+ * htt_pkt_log_init() - API to initialize packet log
+ * @handle: pdev handle
+ * @scn: HIF context
+ *
+ * Return: void
+ */
+void htt_pkt_log_init(struct ol_txrx_pdev_t *handle, void *scn)
+{
+	if (handle->pkt_log_init)
+		return;
+
+	if (cds_get_conparam() != CDF_GLOBAL_FTM_MODE &&
+			!WLAN_IS_EPPING_ENABLED(cds_get_conparam())) {
+		ol_pl_sethandle(&handle->pl_dev, scn);
+		if (pktlogmod_init(scn))
+			cdf_print("%s: pktlogmod_init failed", __func__);
+		else
+			handle->pkt_log_init = true;
+	}
+}
+
+/**
+ * htt_pktlogmod_exit() - API to cleanup pktlog info
+ * @handle: Pdev handle
+ * @scn: HIF Context
+ *
+ * Return: void
+ */
+void htt_pktlogmod_exit(struct ol_txrx_pdev_t *handle, void *scn)
+{
+	if (scn && cds_get_conparam() != CDF_GLOBAL_FTM_MODE &&
+		!WLAN_IS_EPPING_ENABLED(cds_get_conparam()) &&
+			handle->pkt_log_init) {
+		pktlogmod_exit(scn);
+		handle->pkt_log_init = false;
+	}
+}
+#else
+void htt_pkt_log_init(ol_txrx_pdev_handle handle, void *ol_sc) { }
+void htt_pktlogmod_exit(ol_txrx_pdev_handle handle, void *sc)  { }
+#endif
+
 /**
  * ol_txrx_pdev_attach() - attach txrx pdev
  * @pdev: txrx pdev
@@ -871,6 +919,7 @@ ol_txrx_pdev_attach(ol_txrx_pdev_handle pdev)
 	ol_tx_throttle_init(pdev);
 	ol_tso_seg_list_init(pdev, desc_pool_size);
 	ol_tx_register_flow_control(pdev);
+	htt_pkt_log_init(pdev, osc);
 
 	return 0;            /* success */
 
@@ -911,6 +960,7 @@ A_STATUS ol_txrx_pdev_attach_target(ol_txrx_pdev_handle pdev)
 void ol_txrx_pdev_detach(ol_txrx_pdev_handle pdev, int force)
 {
 	int i;
+	struct ol_softc *osc =  cds_get_context(CDF_MODULE_ID_HIF);
 
 	/*checking to ensure txrx pdev structure is not NULL */
 	if (!pdev) {
@@ -923,8 +973,9 @@ void ol_txrx_pdev_detach(ol_txrx_pdev_handle pdev, int force)
 	/* check that the pdev has no vdevs allocated */
 	TXRX_ASSERT1(TAILQ_EMPTY(&pdev->vdev_list));
 
-	OL_RX_REORDER_TIMEOUT_CLEANUP(pdev);
+	htt_pktlogmod_exit(pdev, osc);
 
+	OL_RX_REORDER_TIMEOUT_CLEANUP(pdev);
 #ifdef QCA_SUPPORT_TX_THROTTLE
 	/* Thermal Mitigation */
 	cdf_softirq_timer_cancel(&pdev->tx_throttle.phase_timer);

+ 2 - 1
core/dp/txrx/ol_txrx_types.h

@@ -466,7 +466,8 @@ struct ol_txrx_pdev_t {
 	/* WDI subscriber's event list */
 	wdi_event_subscribe **wdi_event_list;
 
-#ifndef REMOVE_PKT_LOG
+#if !defined(REMOVE_PKT_LOG) && !defined(QVIT)
+	bool pkt_log_init;
 	/* Pktlog pdev */
 	struct ol_pktlog_dev_t *pl_dev;
 #endif /* #ifndef REMOVE_PKT_LOG */

+ 0 - 5
core/hdd/src/wlan_hdd_driver_ops.c

@@ -318,7 +318,6 @@ static void wlan_hdd_remove(void)
 	hif_ctx = cds_get_context(CDF_MODULE_ID_HIF);
 
 	hif_disable_power_management(hif_ctx);
-	hif_pktlogmod_exit(hif_ctx);
 
 	if (WLAN_IS_EPPING_ENABLED(cds_get_conparam())) {
 		epping_disable();
@@ -353,10 +352,6 @@ static void wlan_hdd_shutdown(void)
 	/* this is for cases, where shutdown invoked from CNSS */
 	cds_set_recovery_in_progress(true);
 
-	if (cds_get_conparam() != CDF_GLOBAL_FTM_MODE &&
-	    !WLAN_IS_EPPING_ENABLED(cds_get_conparam()))
-		hif_pktlogmod_exit(hif_ctx);
-
 	if (!cds_wait_for_external_threads_completion(__func__))
 		hdd_err("Host is not ready for SSR, attempting anyway");
 

+ 0 - 2
core/wmi/wmi_unified.c

@@ -838,8 +838,6 @@ int wmi_unified_cmd_send(wmi_unified_t wmi_handle, wmi_buf_t buf, int len,
 		pr_err("\n%s: hostcredits = %d\n", __func__,
 		       wmi_get_host_credits(wmi_handle));
 		htc_dump_counter_info(wmi_handle->htc_handle);
-		/* dump_ce_register(scn); */
-		/* dump_ce_debug_register(scn->hif_sc); */
 		cdf_atomic_dec(&wmi_handle->pending_cmds);
 		pr_err("%s: MAX 1024 WMI Pending cmds reached.\n", __func__);
 		CDF_BUG(0);

+ 9 - 9
target/inc/cepci.h

@@ -106,15 +106,15 @@ struct CE_pipe_config {
  * HIA Map Definition
  */
 struct host_interest_area_t {
-	uint32_t hi_interconnect_state;
-	uint32_t hi_early_alloc;
-	uint32_t hi_option_flag2;
-	uint32_t hi_board_data;
-	uint32_t hi_board_data_initialized;
-	uint32_t hi_failure_state;
-	uint32_t hi_rddi_msi_num;
-	uint32_t hi_pcie_perst_couple_en;
-	uint32_t hi_sw_protocol_version;
+	A_UINT32 hi_interconnect_state;
+	A_UINT32 hi_early_alloc;
+	A_UINT32 hi_option_flag2;
+	A_UINT32 hi_board_data;
+	A_UINT32 hi_board_data_initialized;
+	A_UINT32 hi_failure_state;
+	A_UINT32 hi_rddi_msi_num;
+	A_UINT32 hi_pcie_perst_couple_en;
+	A_UINT32 hi_sw_protocol_version;
 };
 
 struct shadow_reg_cfg {