Browse Source

qcacmn: Add generic logging API adhering to converged framework

As part of cleaning up direct printk calls in WIN driver, a new
generic wrapper API QDF_PRINT_INFO() is added that is based on
the converged QDF debug framework.

All printks in the WIN driver will be replaced by calls to QDF_PRINT_INFO()
which will in-turn compile converged QDF trace API. Generic shared print
control index and module ID are defined for this purpose.

Change-Id: I818fbce9e46526ccdb4824d988b76c43e43eb3a4
CRs-Fixed: 1106829
Sathish Kumar 8 years ago
parent
commit
59113a4840
5 changed files with 60 additions and 9 deletions
  1. 2 1
      qdf/Kbuild
  2. 29 3
      qdf/inc/qdf_trace.h
  3. 4 3
      qdf/inc/qdf_types.h
  4. 1 1
      qdf/linux/src/i_qdf_trace.h
  5. 24 1
      qdf/linux/src/qdf_trace.c

+ 2 - 1
qdf/Kbuild

@@ -35,7 +35,8 @@ linux/src/qdf_mem.o      \
 linux/src/qdf_module.o    \
 linux/src/qdf_nbuf.o       \
 linux/src/qdf_perf.o        \
-linux/src/qdf_threads.o
+linux/src/qdf_threads.o     \
+linux/src/qdf_trace.o
 #linux/src/qdf_net.o \
 #linux/src/qdf_net_event.o \
 #linux/src/qdf_net_ioctl.o

+ 29 - 3
qdf/inc/qdf_trace.h

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2014-2017 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -85,6 +85,34 @@ typedef enum {
 #define QDF_DEBUG_ERROR         0x20
 #define QDF_DEBUG_CFG           0x40
 
+/*
+ * Shared print control index
+ * for converged debug framework
+ */
+#define QDF_PRINT_IDX_SHARED -1
+
+/**
+ * QDF_PRINT_INFO() - Generic wrapper API for logging
+ * @idx: Index of print control object
+ * @module: Module identifier. A member of QDF_MODULE_ID enumeration that
+ *           identifies the module issuing the trace message
+ * @level: Trace level. A member of QDF_TRACE_LEVEL enumeration indicating
+ *          the severity of the condition causing the trace message to be
+ *          issued.
+ * @str_format: Format string that contains the message to be logged.
+ * @...:.
+ *
+ *
+ * This wrapper will be used for any generic logging messages. Wrapper will
+ * compile a call to converged QDF trace message API.
+ *
+ * Return: Nothing
+ *
+ */
+void QDF_PRINT_INFO(unsigned int idx, QDF_MODULE_ID module,
+		    QDF_TRACE_LEVEL level,
+		    char *str_format, ...);
+
 #ifdef CONFIG_MCL
 /* By default Data Path module will have all log levels enabled, except debug
  * log level. Debug level will be left up to the framework or user space modules
@@ -103,8 +131,6 @@ typedef enum {
 #define INVALID_QDF_TRACE_ADDR 0xffffffff
 #define DEFAULT_QDF_TRACE_DUMP_COUNT 0
 
-#include  <i_qdf_trace.h>
-
 #define DUMP_DP_TRACE       0
 #define ENABLE_DP_TRACE_LIVE_MODE	1
 #define CLEAR_DP_TRACE_BUFFER	2

+ 4 - 3
qdf/inc/qdf_types.h

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2014-2017 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -245,12 +245,12 @@ typedef void (*qdf_timer_func_t)(void *);
  * @QDF_MODULE_ID_TARGET_IF: Scheduler target interface queue module ID
  * @QDF_MODULE_ID_SCHEDULER: Scheduler's module ID
  * @QDF_MODULE_ID_MGMT_TXRX: MGMT_TXRX module ID
+ * @QDF_MODULE_ID_ANY: Generic module ID
  * @QDF_MODULE_ID_MAX: Max place holder module ID
  *
  * These are generic IDs that identify the various modules in the software
  * system
- * 0 is unused for historical purposes
- * 3 & 4 are unused for historical purposes
+ * 0 & 4 are unused for historical purposes
  */
 typedef enum {
 	QDF_MODULE_ID_TLSHIM = 1,
@@ -281,6 +281,7 @@ typedef enum {
 	QDF_MODULE_ID_TARGET_IF = 27,
 	QDF_MODULE_ID_SCHEDULER = 28,
 	QDF_MODULE_ID_MGMT_TXRX = 29,
+	QDF_MODULE_ID_ANY = 30,
 	QDF_MODULE_ID_MAX
 } QDF_MODULE_ID;
 

+ 1 - 1
qdf/linux/src/i_qdf_trace.h

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2014-2017 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *

+ 24 - 1
qdf/linux/src/qdf_trace.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2014-2017 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -33,6 +33,10 @@
 
 /* Include Files */
 #include <qdf_trace.h>
+#include <linux/export.h>
+
+#ifdef CONFIG_MCL
+
 #include <wlan_logging_sock_svc.h>
 #include "qdf_time.h"
 #include "qdf_mc_timer.h"
@@ -1718,3 +1722,22 @@ void qdf_dp_trace_dump_all(uint32_t count)
 }
 EXPORT_SYMBOL(qdf_dp_trace_dump_all);
 #endif
+
+#endif /* CONFIG_MCL */
+
+void QDF_PRINT_INFO(unsigned int idx, QDF_MODULE_ID module,
+		    QDF_TRACE_LEVEL level,
+		    char *str_format, ...)
+{
+	va_list args;
+
+	/* Generic wrapper API will compile qdf_vprint in order to
+	 * log the message. Once QDF converged debug framework is in
+	 * place, this will be changed to adapt to the framework, compiling
+	 * call to converged tracing API
+	 */
+	va_start(args, str_format);
+	qdf_vprint(str_format, args);
+	va_end(args);
+}
+EXPORT_SYMBOL(QDF_PRINT_INFO);