From c4b2863aa8e20b0a1be66919914f55ff3bfff5f4 Mon Sep 17 00:00:00 2001 From: Komal Seelam Date: Wed, 3 Feb 2016 15:02:18 +0530 Subject: [PATCH] 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 --- core/bmi/src/ol_fw.c | 43 ++++++++++++++++++---- core/dp/txrx/ol_txrx.c | 57 ++++++++++++++++++++++++++++-- core/dp/txrx/ol_txrx_types.h | 3 +- core/hdd/src/wlan_hdd_driver_ops.c | 5 --- core/wmi/wmi_unified.c | 2 -- target/inc/cepci.h | 18 +++++----- 6 files changed, 101 insertions(+), 27 deletions(-) diff --git a/core/bmi/src/ol_fw.c b/core/bmi/src/ol_fw.c index bcf07c0a1a..93d92a0c27 100644 --- a/core/bmi/src/ol_fw.c +++ b/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; - if (!scn->ramdump_base || !scn->ramdump_size) { - BMI_ERR("%s:ramdump collection fail", __func__); - ret = -EACCES; - goto out; + struct ramdump_info *info = cdf_mem_malloc(sizeof(struct ramdump_info)); + + if (!info) { + BMI_ERR("%s Memory for Ramdump Allocation failed", __func__); + return -ENOMEM; } - ret = ol_target_coredump(scn, scn->ramdump_base, scn->ramdump_size); + ol_get_ramdump_mem(info); -out: + if (!info->base || !info->size) { + BMI_ERR("%s:ramdump collection fail", __func__); + return -EACCES; + } + + ret = ol_target_coredump(scn, info->base, info->size); + + cdf_mem_free(info); return ret; } diff --git a/core/dp/txrx/ol_txrx.c b/core/dp/txrx/ol_txrx.c index f1aa269bcc..785be89a96 100644 --- a/core/dp/txrx/ol_txrx.c +++ b/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 #include #include "wma.h" - +#ifndef REMOVE_PKT_LOG +#include "pktlog_ac.h" +#endif +#include +#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); diff --git a/core/dp/txrx/ol_txrx_types.h b/core/dp/txrx/ol_txrx_types.h index eab2ca0093..c6569ce753 100644 --- a/core/dp/txrx/ol_txrx_types.h +++ b/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 */ diff --git a/core/hdd/src/wlan_hdd_driver_ops.c b/core/hdd/src/wlan_hdd_driver_ops.c index 0627f9e7ae..55195a7c3f 100644 --- a/core/hdd/src/wlan_hdd_driver_ops.c +++ b/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"); diff --git a/core/wmi/wmi_unified.c b/core/wmi/wmi_unified.c index 2270e602f3..6ebc2ca9df 100644 --- a/core/wmi/wmi_unified.c +++ b/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); diff --git a/target/inc/cepci.h b/target/inc/cepci.h index 9cebbc590d..1050836aeb 100644 --- a/target/inc/cepci.h +++ b/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 {