Browse Source

qcacmn: Add per-level logging wrapper APIs

Depending on platform limitations and the intended audience of a
particular WLAN driver build, it would be useful to be able to compile
out specific logging level logs completely. To that end, introduce
per-level logging wrappers, which can be compiled in or out by the build
configuration.

Change-Id: Ie062ada403f8a31aebcde691396987ad9e5352b5
CRs-Fixed: 2205888
Dustin Brown 7 years ago
parent
commit
385b73090f
2 changed files with 63 additions and 13 deletions
  1. 5 13
      qdf/inc/qdf_types.h
  2. 58 0
      qdf/linux/src/i_qdf_trace.h

+ 5 - 13
qdf/inc/qdf_types.h

@@ -590,19 +590,11 @@ void qdf_vtrace_msg(QDF_MODULE_ID module, QDF_TRACE_LEVEL level,
 #define qdf_print(args...) \
 	QDF_TRACE(QDF_MODULE_ID_QDF, QDF_TRACE_LEVEL_ERROR, ## args)
 
-#define qdf_logfl(level, format, args...) \
-	QDF_TRACE(QDF_MODULE_ID_QDF, level, FL(format), ## args)
-
-#define qdf_alert(format, args...) \
-	qdf_logfl(QDF_TRACE_LEVEL_FATAL, format, ## args)
-#define qdf_err(format, args...) \
-	qdf_logfl(QDF_TRACE_LEVEL_ERROR, format, ## args)
-#define qdf_warn(format, args...) \
-	qdf_logfl(QDF_TRACE_LEVEL_WARN, format, ## args)
-#define qdf_info(format, args...) \
-	qdf_logfl(QDF_TRACE_LEVEL_INFO, format, ## args)
-#define qdf_debug(format, args...) \
-	qdf_logfl(QDF_TRACE_LEVEL_DEBUG, format, ## args)
+#define qdf_alert(params...) QDF_TRACE_FATAL(QDF_MODULE_ID_QDF, ## params)
+#define qdf_err(params...) QDF_TRACE_ERROR(QDF_MODULE_ID_QDF, ## params)
+#define qdf_warn(params...) QDF_TRACE_WARN(QDF_MODULE_ID_QDF, ## params)
+#define qdf_info(params...) QDF_TRACE_INFO(QDF_MODULE_ID_QDF, ## params)
+#define qdf_debug(params...) QDF_TRACE_DEBUG(QDF_MODULE_ID_QDF, ## params)
 
 #else /* CONFIG_MCL */
 

+ 58 - 0
qdf/linux/src/i_qdf_trace.h

@@ -101,6 +101,64 @@
 #define QDF_TRACE_HEX_DUMP qdf_trace_hex_dump
 #endif /* CONFIG_MCL */
 
+#define __QDF_TRACE_FL(log_level, module_id, format, args...) \
+	QDF_TRACE(module_id, log_level, FL(format), ## args)
+
+#define __QDF_TRACE_RL(log_level, module_id, format, args...) \
+	QDF_TRACE_RATE_LIMITED(module_id, log_level, FL(format), ## args)
+
+static inline void __qdf_trace_noop(QDF_MODULE_ID module, char *format, ...) { }
+
+#ifdef WLAN_LOG_FATAL
+#define QDF_TRACE_FATAL(params...) \
+	__QDF_TRACE_FL(QDF_TRACE_LEVEL_FATAL, ## params)
+#define QDF_TRACE_FATAL_RL(params...) \
+	__QDF_TRACE_RL(QDF_TRACE_LEVEL_FATAL, ## params)
+#else
+#define QDF_TRACE_FATAL(params...) __qdf_trace_noop(params)
+#define QDF_TRACE_FATAL_RL(params...) __qdf_trace_noop(params)
+#endif
+
+#ifdef WLAN_LOG_ERROR
+#define QDF_TRACE_ERROR(params...) \
+	__QDF_TRACE_FL(QDF_TRACE_LEVEL_ERROR, ## params)
+#define QDF_TRACE_ERROR_RL(params...) \
+	__QDF_TRACE_RL(QDF_TRACE_LEVEL_ERROR, ## params)
+#else
+#define QDF_TRACE_ERROR(params...) __qdf_trace_noop(params)
+#define QDF_TRACE_ERROR_RL(params...) __qdf_trace_noop(params)
+#endif
+
+#ifdef WLAN_LOG_WARN
+#define QDF_TRACE_WARN(params...) \
+	__QDF_TRACE_FL(QDF_TRACE_LEVEL_WARN, ## params)
+#define QDF_TRACE_WARN_RL(params...) \
+	__QDF_TRACE_RL(QDF_TRACE_LEVEL_WARN, ## params)
+#else
+#define QDF_TRACE_WARN(params...) __qdf_trace_noop(params)
+#define QDF_TRACE_WARN_RL(params...) __qdf_trace_noop(params)
+#endif
+
+#ifdef WLAN_LOG_INFO
+#define QDF_TRACE_INFO(params...) \
+	__QDF_TRACE_FL(QDF_TRACE_LEVEL_INFO, ## params)
+#define QDF_TRACE_INFO_RL(params...) \
+	__QDF_TRACE_RL(QDF_TRACE_LEVEL_INFO, ## params)
+#else
+#define QDF_TRACE_INFO(params...) __qdf_trace_noop(params)
+#define QDF_TRACE_INFO_RL(params...) __qdf_trace_noop(params)
+#endif
+
+#ifdef WLAN_LOG_DEBUG
+#define QDF_TRACE_DEBUG(params...) \
+	__QDF_TRACE_FL(QDF_TRACE_LEVEL_DEBUG, ## params)
+#define QDF_TRACE_DEBUG_RL(params...) \
+	__QDF_TRACE_RL(QDF_TRACE_LEVEL_DEBUG, ## params)
+#else
+#define QDF_TRACE_DEBUG(params...) __qdf_trace_noop(params)
+#define QDF_TRACE_DEBUG_RL(params...) __qdf_trace_noop(params)
+#endif
+
 #define QDF_ENABLE_TRACING
 #define qdf_scnprintf scnprintf