From ceddceb3916e7c19df84324c7d81e2643779e2c4 Mon Sep 17 00:00:00 2001 From: Ryan Hsu Date: Thu, 28 Apr 2016 10:20:14 -0700 Subject: qcacld-3.0: Add support for cnss logger module qcacld-2.0 to qcacld-3.0 propagation CONFIG_CNSS_LOGGER is introduced to move the logging feature from CLD driver to kernel module. This change will mainly benefit for two things for CLD driver. - To support for dual wifi driver instances and also future plan of moving out the logging thread and buffer management to the kernel module. - While debugging the critical feature that triggers the autoshutdown and SSR, the log buffer in the CLD driver will be lost after the driver restart or unload. The CLD driver will register itself to the cnss logging module and get the radio index as the indentification for rest of the operation. Also the message sent from CLD driver to usespace need to be packed with struct tAniNlHdr; and the hddctx.radio_index need to be filled along with the message, so that usespace can differentiate the message. Change-Id: I7ea6cdefac0916b9d4dd76da175607bf7169a8fa CRs-fixed: 995073 --- core/utils/logging/src/wlan_logging_sock_svc.c | 36 +++++++++++++++++++------- 1 file changed, 26 insertions(+), 10 deletions(-) (limited to 'core/utils/logging') diff --git a/core/utils/logging/src/wlan_logging_sock_svc.c b/core/utils/logging/src/wlan_logging_sock_svc.c index c0c854f05bd4..b11a6ca38357 100644 --- a/core/utils/logging/src/wlan_logging_sock_svc.c +++ b/core/utils/logging/src/wlan_logging_sock_svc.c @@ -253,10 +253,11 @@ static int wlan_queue_logmsg_for_app(void) #ifdef QCA_WIFI_3_0_ADRASTEA /** - * wlan_add_user_log_time_stamp() - add time stamp in WLAN log buffer + * wlan_add_user_log_radio_time_stamp() - add radio and time stamp in log buffer * @tbuf: Pointer to time stamp buffer * @tbuf_sz: Time buffer size * @ts: Time stamp value + * @radoi: the radio index * * For adrastea time stamp is QTIMER raw tick which will be used by cnss_diag * to convert it into user visible time stamp. In adrstea FW also uses QTIMER @@ -266,19 +267,22 @@ static int wlan_queue_logmsg_for_app(void) * For discrete solution e.g rome use system tick and convert it into * seconds.milli seconds */ -static int wlan_add_user_log_time_stamp(char *tbuf, size_t tbuf_sz, uint64_t ts) +static int wlan_add_user_log_radio_time_stamp(char *tbuf, size_t tbuf_sz, + uint64_t ts, int radio) { int tlen; - tlen = scnprintf(tbuf, tbuf_sz, "[%s][%llu] ", current->comm, ts); + tlen = scnprintf(tbuf, tbuf_sz, "R%d: [%s][%llu] ", + radio, current->comm, ts); return tlen; } #else /** - * wlan_add_user_log_time_stamp() - add time stamp in WLAN log buffer + * wlan_add_user_log_radio_time_stamp() - add radio and time stamp in log buffer * @tbuf: Pointer to time stamp buffer * @tbuf_sz: Time buffer size * @ts: Time stamp value + * @radio: the radio index * * For adrastea time stamp QTIMER raw tick which will be used by cnss_diag * to convert it into user visible time stamp @@ -286,14 +290,15 @@ static int wlan_add_user_log_time_stamp(char *tbuf, size_t tbuf_sz, uint64_t ts) * For discrete solution e.g rome use system tick and convert it into * seconds.milli seconds */ -static int wlan_add_user_log_time_stamp(char *tbuf, size_t tbuf_sz, uint64_t ts) +static int wlan_add_user_log_radio_time_stamp(char *tbuf, size_t tbuf_sz, + uint64_t ts, int radio) { int tlen; uint32_t rem; rem = do_div(ts, QDF_MC_TIMER_TO_SEC_UNIT); - tlen = scnprintf(tbuf, tbuf_sz, "[%s][%lu.%06lu] ", current->comm, - (unsigned long) ts, (unsigned long)rem); + tlen = scnprintf(tbuf, tbuf_sz, "R%d: [%s][%lu.%06lu] ", radio, + current->comm, (unsigned long) ts, (unsigned long)rem); return tlen; } #endif @@ -309,8 +314,11 @@ int wlan_log_to_user(QDF_TRACE_LEVEL log_level, char *to_be_sent, int length) bool wake_up_thread = false; unsigned long flags; uint64_t ts; + int radio; + + radio = cds_get_radio_index(); - if (!cds_is_multicast_logging()) { + if (!cds_is_multicast_logging() || radio == -EINVAL) { /* * This is to make sure that we print the logs to kmsg console * when no logger app is running. This is also needed to @@ -319,12 +327,20 @@ int wlan_log_to_user(QDF_TRACE_LEVEL log_level, char *to_be_sent, int length) * register with driver immediately and start logging all the * messages. */ - pr_info("%s\n", to_be_sent); + /* + * R%d: if the radio index is invalid, just post the message + * to console. + * Also the radio index shouldn't happen to be EINVAL, but if + * that happen just print it, so that the logging would be + * aware the cnss_logger is somehow failed. + */ + pr_info("R%d: %s\n", radio, to_be_sent); return 0; } ts = qdf_get_log_timestamp(); - tlen = wlan_add_user_log_time_stamp(tbuf, sizeof(tbuf), ts); + tlen = wlan_add_user_log_radio_time_stamp(tbuf, sizeof(tbuf), ts, + radio); /* 1+1 indicate '\n'+'\0' */ total_log_len = length + tlen + 1 + 1; -- cgit v1.2.3