浏览代码

qcacmn: Print buffered logs one line at a time

Print buffered wlan logs one line at a time to avoid
log split.

Change-Id: Ie35bdee741e7dab430281bb18aea48325118bf23
CRs-Fixed: 2977844
Jeevan Kukkalli 4 年之前
父节点
当前提交
0343109e97
共有 1 个文件被更改,包括 11 次插入5 次删除
  1. 11 5
      utils/logging/src/wlan_logging_sock_svc.c

+ 11 - 5
utils/logging/src/wlan_logging_sock_svc.c

@@ -35,6 +35,7 @@
 #include "host_diag_core_log.h"
 #include <qdf_event.h>
 #include <qdf_module.h>
+#include <qdf_str.h>
 
 #ifdef CNSS_GENL
 #include <net/cnss_nl.h>
@@ -104,7 +105,7 @@
 /* default rate limit period - 2sec */
 #define PANIC_WIFILOG_PRINT_RATE_LIMIT_PERIOD (2*HZ)
 /* default burst for rate limit */
-#define PANIC_WIFILOG_PRINT_RATE_LIMIT_BURST_DEFAULT 250
+#define PANIC_WIFILOG_PRINT_RATE_LIMIT_BURST_DEFAULT 500
 DEFINE_RATELIMIT_STATE(panic_wifilog_ratelimit,
 		       PANIC_WIFILOG_PRINT_RATE_LIMIT_PERIOD,
 		       PANIC_WIFILOG_PRINT_RATE_LIMIT_BURST_DEFAULT);
@@ -946,7 +947,7 @@ static int panic_wifilog_ratelimit_print(void)
 /**
  * wlan_logging_dump_last_logs() - Panic notifier callback's helper function
  *
- * This function prints buffered logs in chunks of MAX_LOG_LINE.
+ * This function prints buffered logs one line at a time.
  */
 static void wlan_logging_dump_last_logs(void)
 {
@@ -966,11 +967,16 @@ static void wlan_logging_dump_last_logs(void)
 		log = &plog_msg->logbuf[sizeof(tAniHdr)];
 		filled_length = plog_msg->filled_length;
 		while (filled_length) {
-			text_len = scnprintf(textbuf,
-					     sizeof(textbuf),
-					     "%s", log);
+			text_len = qdf_str_copy_all_before_char(log, filled_length,
+								textbuf,
+								sizeof(textbuf) - 1,
+								'\n');
+			textbuf[text_len] = '\0';
 			if (panic_wifilog_ratelimit_print())
 				pr_err("%s\n", textbuf);
+
+			if (log[text_len] == '\n')
+				text_len += 1; /* skip newline */
 			log += text_len;
 			filled_length -= text_len;
 		}