qcacmn: Add shared print_ctrl_obj for qdf_trace_msg
At this point lot of Win code already uses QDF_TRACE macro. It will be difficult to translate QDF_TRACE to qdf_trace_msg unless all the modules (already using QDF_TRACE) make changes to use the qdf_print_ctrl framework. Until that happens, we can have a shared object temporarily so that wlan_log_to_user and hence user space logging of messages can be in place Change-Id: Ia149b86de8c2c36ed1c8508570b31db25f6bc41e CRs-Fixed: 2018767
This commit is contained in:

committed by
Sandeep Puligilla

parent
87686d9a2f
commit
3318807269
11
qdf/Kbuild
11
qdf/Kbuild
@@ -21,7 +21,6 @@ INCS += -Inbuf/linux -Inet/linux -Ios/linux
|
||||
INCS += -I$(WLAN_TOP)/../../include
|
||||
INCS += -I$(WLAN_TOP)/cmn_dev/qdf/inc
|
||||
INCS += -I$(WLAN_TOP)/cmn_dev/qdf/linux/src
|
||||
|
||||
INCS += -I$(obj)/$(HOST_CMN_CONVG_PTT)/inc \
|
||||
-I$(obj)/$(HOST_CMN_CONVG_NLINK)/inc \
|
||||
-I$(obj)/$(HOST_CMN_CONVG_LOGGING)/inc \
|
||||
@@ -38,15 +37,17 @@ INCS += -I$(obj)/$(HOST_CMN_CONVG_PTT)/inc \
|
||||
-I$(obj)/$(DEPTH)/cmn_dev/umac/global_umac_dispatcher/lmac_if/inc \
|
||||
-I$(obj)/$(DEPTH)/cmn_dev/umac/cmn_services/mgmt_txrx/dispatcher/inc \
|
||||
-I$(obj)/$(DEPTH)/offload/hw/include \
|
||||
-I$(obj)/$(DEPTH)/umac/base
|
||||
-I$(obj)/$(DEPTH)/umac/base \
|
||||
-I$(obj)/$(DEPTH)/cmn_dev/umac/cmn_services/cmn_defs/inc \
|
||||
-I$(obj)/$(DEPTH)/cmn_dev/umac/scan/dispatcher/inc \
|
||||
-I$(obj)/$(DEPTH)/hal/linux \
|
||||
-I$(obj)/$(DEPTH)/lmac/ath_dev
|
||||
|
||||
|
||||
|
||||
obj-m += qdf.o
|
||||
|
||||
EXTRA_CFLAGS+= $(INCS) $(COPTS) -Wno-unused-function
|
||||
ifeq ($(LOGGING_UTILS_SUPPORT),1)
|
||||
EXTRA_CFLAGS+= -DWLAN_LOGGING_SOCK_SVC_ENABLE=1
|
||||
endif
|
||||
|
||||
ifeq ($(strip ${QCA_PARTNER_MAKE_F_SUPPORT}),1)
|
||||
MOD_CFLAGS = -D"KBUILD_STR(s)=\#s" -D"KBUILD_BASENAME=KBUILD_STR(qdf.mod)" -D"KBUILD_MODNAME=KBUILD_STR(qdf)"
|
||||
|
@@ -598,6 +598,15 @@ int qdf_print_ctrl_register(const struct category_info *cinfo,
|
||||
void *custom_ctx,
|
||||
const char *pctrl_name);
|
||||
|
||||
/**
|
||||
* qdf_shared_print_ctrl_init() - Initialize the shared print ctrl obj with
|
||||
* all categories set to the default level
|
||||
*
|
||||
* Return : void
|
||||
*
|
||||
*/
|
||||
void qdf_shared_print_ctrl_init(void);
|
||||
|
||||
/**
|
||||
* qdf_print_setup() - Setup default values to all the print control objects
|
||||
*
|
||||
@@ -619,6 +628,15 @@ QDF_STATUS qdf_print_setup(void);
|
||||
*/
|
||||
QDF_STATUS qdf_print_ctrl_cleanup(unsigned int idx);
|
||||
|
||||
/**
|
||||
* qdf_print_ctrl_shared_cleanup() - Clean up of the shared object
|
||||
*
|
||||
* Cleanup the shared print-ctrl-object
|
||||
*
|
||||
* Return : void
|
||||
*/
|
||||
void qdf_shared_print_ctrl_cleanup(void);
|
||||
|
||||
/**
|
||||
* qdf_print_set_category_verbose() - Enable/Disable category for a
|
||||
* print control object with
|
||||
|
@@ -33,6 +33,13 @@
|
||||
#if !defined(__QDF_TYPES_H)
|
||||
#define __QDF_TYPES_H
|
||||
|
||||
#ifndef CONFIG_MCL
|
||||
#if !defined(__printf)
|
||||
#define __printf(a, b)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
/* Include Files */
|
||||
#include <i_qdf_types.h>
|
||||
|
||||
@@ -481,7 +488,6 @@ enum tQDF_GLOBAL_CON_MODE {
|
||||
#define QDF_IS_EPPING_ENABLED(mode) (mode == QDF_GLOBAL_EPPING_MODE)
|
||||
|
||||
|
||||
#ifdef CONFIG_MCL
|
||||
/**
|
||||
* qdf_trace_msg()- logging API
|
||||
* @module: Module identifier. A member of the QDF_MODULE_ID enumeration that
|
||||
@@ -504,6 +510,7 @@ enum tQDF_GLOBAL_CON_MODE {
|
||||
void __printf(3, 4) qdf_trace_msg(QDF_MODULE_ID module, QDF_TRACE_LEVEL level,
|
||||
char *str_format, ...);
|
||||
|
||||
#ifdef CONFIG_MCL
|
||||
#define qdf_print(args...) \
|
||||
QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR, ## args)
|
||||
|
||||
|
@@ -67,8 +67,8 @@
|
||||
printk("\n"); \
|
||||
} \
|
||||
} while (0)
|
||||
#define QDF_TRACE(x, log_level, args...) \
|
||||
qdf_trace(log_level, args)
|
||||
|
||||
#define QDF_TRACE qdf_trace_msg
|
||||
|
||||
#define QDF_TRACE_HEX_DUMP qdf_trace_hex_dump
|
||||
#endif /* CONFIG_MCL */
|
||||
|
@@ -50,6 +50,7 @@ MODULE_LICENSE("Dual BSD/GPL");
|
||||
static int __init
|
||||
qdf_mod_init(void)
|
||||
{
|
||||
qdf_shared_print_ctrl_init();
|
||||
qdf_logging_init();
|
||||
qdf_perfmod_init();
|
||||
return 0;
|
||||
@@ -66,6 +67,7 @@ qdf_mod_exit(void)
|
||||
{
|
||||
qdf_perfmod_exit();
|
||||
qdf_logging_exit();
|
||||
qdf_shared_print_ctrl_cleanup();
|
||||
}
|
||||
module_exit(qdf_mod_exit);
|
||||
|
||||
|
@@ -39,13 +39,13 @@
|
||||
#define QDF_TRACE_LEVEL_TO_MODULE_BITMASK(_level) ((1 << (_level)))
|
||||
|
||||
#include <wlan_logging_sock_svc.h>
|
||||
static int qdf_pidx = -1;
|
||||
#ifdef CONFIG_MCL
|
||||
|
||||
#include "qdf_time.h"
|
||||
#include "qdf_mc_timer.h"
|
||||
|
||||
/* Global qdf print id */
|
||||
static int qdf_pidx = -1;
|
||||
|
||||
/* Preprocessor definitions and constants */
|
||||
|
||||
@@ -1706,6 +1706,24 @@ EXPORT_SYMBOL(qdf_dp_trace_dump_all);
|
||||
|
||||
#endif
|
||||
|
||||
#else /* CONFIG_MCL */
|
||||
|
||||
void qdf_trace_msg(QDF_MODULE_ID module, QDF_TRACE_LEVEL level,
|
||||
char *str_format, ...)
|
||||
{
|
||||
va_list val;
|
||||
|
||||
va_start(val, str_format);
|
||||
/*
|
||||
* TODO: remove this hack when modules start using the qdf_print_ctrl
|
||||
* framework.
|
||||
* Any newly added code that wishes to use QDF_TRACE needs to adapt
|
||||
* to the framework, and using it this way is not encouraged.
|
||||
*/
|
||||
qdf_trace_msg_cmn(qdf_pidx, module, level, str_format, val);
|
||||
va_end(val);
|
||||
}
|
||||
EXPORT_SYMBOL(qdf_trace_msg);
|
||||
#endif /* CONFIG_MCL */
|
||||
|
||||
struct qdf_print_ctrl print_ctrl_obj[MAX_PRINT_CONFIG_SUPPORTED];
|
||||
@@ -1792,6 +1810,15 @@ struct category_name_info g_qdf_category_name[MAX_SUPPORTED_CATEGORY] = {
|
||||
[QDF_MODULE_ID_ANY] = {"ANY"},
|
||||
};
|
||||
|
||||
#ifdef CONFIG_MCL
|
||||
#define print_to_console(str)
|
||||
#else
|
||||
static inline void print_to_console(char *str_buffer)
|
||||
{
|
||||
pr_err("%s\n", str_buffer);
|
||||
}
|
||||
#endif
|
||||
|
||||
void qdf_trace_msg_cmn(unsigned int idx,
|
||||
QDF_MODULE_ID category,
|
||||
QDF_TRACE_LEVEL verbose,
|
||||
@@ -1855,6 +1882,7 @@ void qdf_trace_msg_cmn(unsigned int idx,
|
||||
#if defined(WLAN_LOGGING_SOCK_SVC_ENABLE)
|
||||
wlan_log_to_user(verbose, (char *)str_buffer,
|
||||
strlen(str_buffer));
|
||||
print_to_console(str_buffer);
|
||||
#else
|
||||
pr_err("%s\n", str_buffer);
|
||||
#endif
|
||||
@@ -1969,6 +1997,40 @@ int qdf_print_ctrl_register(const struct category_info *cinfo,
|
||||
}
|
||||
EXPORT_SYMBOL(qdf_print_ctrl_register);
|
||||
|
||||
#ifndef CONFIG_MCL
|
||||
void qdf_shared_print_ctrl_cleanup(void)
|
||||
{
|
||||
qdf_print_ctrl_cleanup(qdf_pidx);
|
||||
}
|
||||
EXPORT_SYMBOL(qdf_shared_print_ctrl_cleanup);
|
||||
|
||||
extern int qdf_dbg_mask;
|
||||
void qdf_shared_print_ctrl_init(void)
|
||||
{
|
||||
int i;
|
||||
QDF_TRACE_LEVEL level;
|
||||
struct category_info *cinfo = qdf_mem_malloc((sizeof(*cinfo))*
|
||||
MAX_SUPPORTED_CATEGORY);
|
||||
if (cinfo == NULL) {
|
||||
pr_info("ERROR!! qdf_mem_malloc failed. \
|
||||
Shared Print Ctrl object not initialized \
|
||||
\nQDF_TRACE messages may not be logged/displayed");
|
||||
return;
|
||||
}
|
||||
for (i = 0; i < MAX_SUPPORTED_CATEGORY; i++) {
|
||||
cinfo[i].category_verbose_mask = 0;
|
||||
for (level = QDF_TRACE_LEVEL_NONE; level <= qdf_dbg_mask; level++) {
|
||||
cinfo[i].category_verbose_mask |=
|
||||
QDF_TRACE_LEVEL_TO_MODULE_BITMASK(level);
|
||||
}
|
||||
}
|
||||
qdf_pidx = qdf_print_ctrl_register(cinfo, NULL, NULL,
|
||||
"LOG_SHARED_OBJ");
|
||||
qdf_mem_free(cinfo);
|
||||
}
|
||||
EXPORT_SYMBOL(qdf_shared_print_ctrl_init);
|
||||
#endif
|
||||
|
||||
QDF_STATUS qdf_print_set_category_verbose(unsigned int idx,
|
||||
QDF_MODULE_ID category,
|
||||
QDF_TRACE_LEVEL verbose,
|
||||
|
@@ -351,6 +351,16 @@ static int wlan_add_user_log_radio_time_stamp(char *tbuf, size_t tbuf_sz,
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_MCL
|
||||
static inline void print_to_console(char *tbuf, char *to_be_sent)
|
||||
{
|
||||
pr_info("%s %s\n", tbuf, to_be_sent);
|
||||
}
|
||||
#else
|
||||
#define print_to_console(str1, str2)
|
||||
#endif
|
||||
|
||||
|
||||
int wlan_log_to_user(QDF_TRACE_LEVEL log_level, char *to_be_sent, int length)
|
||||
{
|
||||
/* Add the current time stamp */
|
||||
@@ -456,7 +466,7 @@ int wlan_log_to_user(QDF_TRACE_LEVEL log_level, char *to_be_sent, int length)
|
||||
if (gwlan_logging.log_fe_to_console
|
||||
&& ((QDF_TRACE_LEVEL_FATAL == log_level)
|
||||
|| (QDF_TRACE_LEVEL_ERROR == log_level))) {
|
||||
pr_info("%s %s\n", tbuf, to_be_sent);
|
||||
print_to_console(tbuf, to_be_sent);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
Reference in New Issue
Block a user