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
This commit is contained in:
Jeevan Kukkalli
2021-06-08 22:18:48 +05:30
committed by Madan Koyyalamudi
parent 2228afc5b4
commit 0343109e97

View File

@@ -35,6 +35,7 @@
#include "host_diag_core_log.h" #include "host_diag_core_log.h"
#include <qdf_event.h> #include <qdf_event.h>
#include <qdf_module.h> #include <qdf_module.h>
#include <qdf_str.h>
#ifdef CNSS_GENL #ifdef CNSS_GENL
#include <net/cnss_nl.h> #include <net/cnss_nl.h>
@@ -104,7 +105,7 @@
/* default rate limit period - 2sec */ /* default rate limit period - 2sec */
#define PANIC_WIFILOG_PRINT_RATE_LIMIT_PERIOD (2*HZ) #define PANIC_WIFILOG_PRINT_RATE_LIMIT_PERIOD (2*HZ)
/* default burst for rate limit */ /* 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, DEFINE_RATELIMIT_STATE(panic_wifilog_ratelimit,
PANIC_WIFILOG_PRINT_RATE_LIMIT_PERIOD, PANIC_WIFILOG_PRINT_RATE_LIMIT_PERIOD,
PANIC_WIFILOG_PRINT_RATE_LIMIT_BURST_DEFAULT); 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 * 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) 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)]; log = &plog_msg->logbuf[sizeof(tAniHdr)];
filled_length = plog_msg->filled_length; filled_length = plog_msg->filled_length;
while (filled_length) { while (filled_length) {
text_len = scnprintf(textbuf, text_len = qdf_str_copy_all_before_char(log, filled_length,
sizeof(textbuf), textbuf,
"%s", log); sizeof(textbuf) - 1,
'\n');
textbuf[text_len] = '\0';
if (panic_wifilog_ratelimit_print()) if (panic_wifilog_ratelimit_print())
pr_err("%s\n", textbuf); pr_err("%s\n", textbuf);
if (log[text_len] == '\n')
text_len += 1; /* skip newline */
log += text_len; log += text_len;
filled_length -= text_len; filled_length -= text_len;
} }