From 0e86934fd2c05e77ecfd6b8e82b549835dbc63b1 Mon Sep 17 00:00:00 2001 From: Ashish Kumar Dhanotiya Date: Wed, 14 Nov 2018 16:35:57 +0530 Subject: [PATCH] qcacld-3.0: Add driver command to dump function call mapping Add driver command support to dump all the function call mapping which is cached in global buffer. Change-Id: I03b2162ccda171005e6fa8a7bb09cbf9c4819421 CRs-Fixed: 2677976 --- Kbuild | 3 ++ configs/default_defconfig | 3 ++ core/hdd/src/wlan_hdd_ioctl.c | 67 +++++++++++++++++++++++++++++++++++ core/hdd/src/wlan_hdd_main.c | 37 +++++++++++++++++++ 4 files changed, 110 insertions(+) diff --git a/Kbuild b/Kbuild index 06528050cfc8..53e9c4754188 100644 --- a/Kbuild +++ b/Kbuild @@ -733,6 +733,7 @@ QDF_OBJS := \ $(QDF_LINUX_OBJ_DIR)/qdf_delayed_work.o \ $(QDF_LINUX_OBJ_DIR)/qdf_event.o \ $(QDF_LINUX_OBJ_DIR)/qdf_file.o \ + $(QDF_LINUX_OBJ_DIR)/qdf_func_tracker.o \ $(QDF_LINUX_OBJ_DIR)/qdf_idr.o \ $(QDF_LINUX_OBJ_DIR)/qdf_list.o \ $(QDF_LINUX_OBJ_DIR)/qdf_lock.o \ @@ -3197,6 +3198,8 @@ cppflags-$(CONFIG_ENABLE_SMMU_S1_TRANSLATION) += -DENABLE_SMMU_S1_TRANSLATION #Flag to enable/disable MTRACE feature cppflags-$(CONFIG_ENABLE_MTRACE_LOG) += -DENABLE_MTRACE_LOG +cppflags-$(CONFIG_FUNC_CALL_MAP) += -DFUNC_CALL_MAP + #Flag to enable/disable Adaptive 11r feature cppflags-$(CONFIG_ADAPTIVE_11R) += -DWLAN_ADAPTIVE_11R diff --git a/configs/default_defconfig b/configs/default_defconfig index e440eb1c90f7..f520dbc6fab5 100644 --- a/configs/default_defconfig +++ b/configs/default_defconfig @@ -862,6 +862,9 @@ CONFIG_ENABLE_MTRACE_LOG := y #Flag to enable nud tracking feature CONFIG_WLAN_NUD_TRACKING := y +#Flag to enable/Disable Function call trace +CONFIG_FUNC_CALL_MAP := n + #Flag to enable wbuff feature CONFIG_WLAN_WBUFF := y diff --git a/core/hdd/src/wlan_hdd_ioctl.c b/core/hdd/src/wlan_hdd_ioctl.c index 0d91f1d28f6c..db71280f27dd 100644 --- a/core/hdd/src/wlan_hdd_ioctl.c +++ b/core/hdd/src/wlan_hdd_ioctl.c @@ -45,6 +45,7 @@ #include "hif.h" #include "wlan_scan_ucfg_api.h" #include "wlan_reg_ucfg_api.h" +#include "qdf_func_tracker.h" #if defined(LINUX_QCMBR) #define SIOCIOCTLTX99 (SIOCDEVPRIVATE+13) @@ -6798,6 +6799,69 @@ static int drv_cmd_get_ani_level(struct hdd_adapter *adapter, return 0; } #endif + +#ifdef FUNC_CALL_MAP +static int drv_cmd_get_function_call_map(struct hdd_adapter *adapter, + struct hdd_context *hdd_ctx, + uint8_t *command, + uint8_t command_len, + struct hdd_priv_data *priv_data) +{ + char *cc_buf = qdf_mem_malloc(QDF_FUNCTION_CALL_MAP_BUF_LEN); + uint8_t *param; + int temp_int; + + param = strnchr(command, strlen(command), ' '); + /*no argument after the command*/ + if (NULL == param) + return -EINVAL; + + /*no space after the command*/ + else if (SPACE_ASCII_VALUE != *param) + return -EINVAL; + + param++; + + /*removing empty spaces*/ + while ((SPACE_ASCII_VALUE == *param) && ('\0' != *param)) + param++; + + /*no argument followed by spaces*/ + if ('\0' == *param) + return -EINVAL; + + /*getting the first argument */ + if (sscanf(param, "%d ", &temp_int) != 1) { + hdd_err("No option given"); + return -EINVAL; + } + + if (temp_int < 0 || temp_int > 1) { + hdd_err("Invalid option given"); + return -EINVAL; + } + + /* Read the buffer */ + if (temp_int) { + /* + * These logs are required as these indicates the start and end of the + * dump for the auto script to parse + */ + hdd_info("Function call map dump start"); + qdf_get_func_call_map(cc_buf); + qdf_trace_hex_dump(QDF_MODULE_ID_HDD, QDF_TRACE_LEVEL_INFO, + cc_buf, QDF_FUNCTION_CALL_MAP_BUF_LEN); + hdd_info("Function call map dump end"); + } else { + qdf_clear_func_call_map(); + hdd_info("Function call map clear"); + } + qdf_mem_free(cc_buf); + + return 0; +} +#endif + /* * The following table contains all supported WLAN HDD * IOCTL driver commands and the handler for each of them. @@ -6907,6 +6971,9 @@ static const struct hdd_drv_cmd hdd_drv_cmds[] = { {"SET_DISABLE_CHANNEL_LIST", drv_cmd_set_disable_chan_list, true}, {"GET_DISABLE_CHANNEL_LIST", drv_cmd_get_disable_chan_list, false}, {"GET_ANI_LEVEL", drv_cmd_get_ani_level, false}, +#ifdef FUNC_CALL_MAP + {"GET_FUNCTION_CALL_MAP", drv_cmd_get_function_call_map, true}, +#endif {"STOP", drv_cmd_dummy, false}, /* Deprecated commands */ {"RXFILTER-START", drv_cmd_dummy, false}, diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index bef6d949fd1f..6566b2282187 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -161,6 +161,8 @@ #include "wlan_mlme_ucfg_api.h" #include "wlan_fwol_ucfg_api.h" #include "wlan_policy_mgr_ucfg.h" +#include "qdf_func_tracker.h" + #ifdef CNSS_GENL #include #endif @@ -6468,6 +6470,36 @@ hdd_peer_cleanup(struct hdd_context *hdd_ctx, struct hdd_adapter *adapter) hdd_debug("peer_cleanup_done wait fail"); } +#ifdef FUNC_CALL_MAP + +/** + * hdd_dump_func_call_map() - Dump the function call map + * + * Return: None + */ + +static void hdd_dump_func_call_map(void) +{ + char *cc_buf; + + cc_buf = qdf_mem_malloc(QDF_FUNCTION_CALL_MAP_BUF_LEN); + /* + * These logs are required as these indicates the start and end of the + * dump for the auto script to parse + */ + hdd_info("Function call map dump start"); + qdf_get_func_call_map(cc_buf); + qdf_trace_hex_dump(QDF_MODULE_ID_HDD, + QDF_TRACE_LEVEL_INFO, cc_buf, QDF_FUNCTION_CALL_MAP_BUF_LEN); + hdd_info("Function call map dump end"); + qdf_mem_free(cc_buf); +} +#else +static inline void hdd_dump_func_call_map(void) +{ +} +#endif + QDF_STATUS hdd_stop_adapter(struct hdd_context *hdd_ctx, struct hdd_adapter *adapter) { @@ -6784,6 +6816,8 @@ QDF_STATUS hdd_stop_adapter(struct hdd_context *hdd_ctx, adapter->scan_info.default_scan_ies_len = 0; } + /* This function should be invoked at the end of this api*/ + hdd_dump_func_call_map(); hdd_exit(); return QDF_STATUS_SUCCESS; @@ -8456,6 +8490,9 @@ void hdd_wlan_exit(struct hdd_context *hdd_ctx) #ifdef FEATURE_WLAN_CH_AVOID mutex_destroy(&hdd_ctx->avoid_freq_lock); #endif + + /* This function should be invoked at the end of this api*/ + hdd_dump_func_call_map(); } /**