浏览代码

qcacmn: Update log to console INI to support per log level

Currently, the INI param wlanLoggingToConsole is used to enable
or disable WLAN logging to console. It will enable/disable console
logs for all log levels i.e. FATAL/ERROR/WARN/INFO. There is no
provision to enable/disable console logs for specific log level.

To address this, change wlanLoggingToConsole INI as bitmap with each
bit representing a log level. Enable/disable console logs based on
this bitmap.

Change-Id: If3172195a2ee86d21c4c03f441a4cc3e2780dd82
CRs-Fixed: 2734707
Bapiraju Alla 5 年之前
父节点
当前提交
1f62560b58
共有 2 个文件被更改,包括 8 次插入8 次删除
  1. 2 2
      utils/logging/inc/wlan_logging_sock_svc.h
  2. 6 6
      utils/logging/src/wlan_logging_sock_svc.c

+ 2 - 2
utils/logging/inc/wlan_logging_sock_svc.h

@@ -73,13 +73,13 @@ void wlan_logging_set_per_pkt_stats(void);
 void wlan_logging_set_fw_flush_complete(void);
 void wlan_flush_host_logs_for_fatal(void);
 void wlan_logging_set_active(bool active);
-void wlan_logging_set_log_to_console(bool log_to_console);
+void wlan_set_console_log_levels(uint32_t console_log_levels);
 #else
 static inline void wlan_flush_host_logs_for_fatal(void) {}
 static inline void wlan_logging_set_per_pkt_stats(void) {}
 static inline void wlan_logging_set_fw_flush_complete(void) {}
 static inline void wlan_logging_set_active(bool active) {}
-static inline void wlan_logging_set_log_to_console(bool log_to_console) {}
+static inline void wlan_set_console_log_levels(uint32_t console_log_levels) {}
 #endif /* WLAN_LOGGING_SOCK_SVC_ENABLE */
 
 #if defined(WLAN_LOGGING_SOCK_SVC_ENABLE) && \

+ 6 - 6
utils/logging/src/wlan_logging_sock_svc.c

@@ -149,8 +149,8 @@ struct pkt_stats_msg {
 
 #define MAX_FLUSH_TIMER_PERIOD_VALUE 3600000 /* maximum of 1 hour (in ms) */
 struct wlan_logging {
-	/* Log Fatal and ERROR to console */
-	bool log_to_console;
+	/* Console log levels */
+	uint32_t console_log_levels;
 	/* Number of buffers to be used for logging */
 	uint32_t num_buf;
 	uint32_t buffer_length;
@@ -447,7 +447,7 @@ int wlan_log_to_user(QDF_TRACE_LEVEL log_level, char *to_be_sent, int length)
 		wake_up_interruptible(&gwlan_logging.wait_queue);
 	}
 
-	if (gwlan_logging.log_to_console)
+	if (gwlan_logging.console_log_levels & BIT(log_level))
 		log_to_console(log_level, tbuf, to_be_sent);
 
 	return 0;
@@ -893,9 +893,9 @@ void wlan_logging_set_active(bool active)
 	gwlan_logging.is_active = active;
 }
 
-void wlan_logging_set_log_to_console(bool log_to_console)
+void wlan_set_console_log_levels(uint32_t console_log_levels)
 {
-	gwlan_logging.log_to_console = log_to_console;
+	gwlan_logging.console_log_levels = console_log_levels;
 }
 
 static void flush_log_buffers_timer(void *dummy)
@@ -1070,7 +1070,7 @@ int wlan_logging_sock_init_svc(void)
 	spin_lock_init(&gwlan_logging.spin_lock);
 	spin_lock_init(&gwlan_logging.pkt_stats_lock);
 
-	gwlan_logging.log_to_console = false;
+	gwlan_logging.console_log_levels = 0;
 	gwlan_logging.num_buf = MAX_LOGMSG_COUNT;
 	gwlan_logging.buffer_length = MAX_LOGMSG_LENGTH;