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
diff --git a/Kbuild b/Kbuild
index c45699c..a90e799 100644
--- a/Kbuild
+++ b/Kbuild
@@ -622,6 +622,7 @@
$(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 \
@@ -3002,6 +3003,8 @@
#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 daa6c4e..b20070c 100644
--- a/configs/default_defconfig
+++ b/configs/default_defconfig
@@ -812,6 +812,9 @@
#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 67179fd..2b6ea66 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)
@@ -7876,6 +7877,69 @@
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.
@@ -7994,6 +8058,9 @@
{"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 8dc7931..7707fd4 100644
--- a/core/hdd/src/wlan_hdd_main.c
+++ b/core/hdd/src/wlan_hdd_main.c
@@ -162,6 +162,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 <net/cnss_nl.h>
#endif
@@ -6481,6 +6483,36 @@
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)
{
@@ -6798,6 +6830,8 @@
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;
@@ -8567,6 +8601,9 @@
#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();
}
/**