summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRajeev Kumar <rajekuma@codeaurora.org>2018-09-18 18:24:45 -0700
committerRajeev Kumar <rajekuma@codeaurora.org>2018-09-18 19:03:39 -0700
commit8ec6df22c761a72f8fa192ea549a18be70dc2844 (patch)
tree12fe681ace045a4dc8a0edf66f5fee667c34735e
parentc18cb32f43e70977edfe1c4df2534d2a70e83f48 (diff)
qcacmn: Separate WMI diag rx event logging
FW generates too many diag events and these diag events also come on CE-2 together with other critical control path WMI events and easily over-run useful control path WMI RX even log buffer. Separate WMI diag rx event loggig in a separate log buffer such that useful control path WMI log event buffer is not over-run. Change-Id: I89b5d88036bc9d7e57e8e16858bc556be4e2ed41 CRs-Fixed: 2318083
-rw-r--r--wmi/inc/wmi_unified_priv.h6
-rw-r--r--wmi/src/wmi_unified.c95
-rw-r--r--wmi/src/wmi_unified_non_tlv.c12
-rw-r--r--wmi/src/wmi_unified_tlv.c12
4 files changed, 112 insertions, 13 deletions
diff --git a/wmi/inc/wmi_unified_priv.h b/wmi/inc/wmi_unified_priv.h
index 0c5989f7d894..8c2e2daa2aaf 100644
--- a/wmi/inc/wmi_unified_priv.h
+++ b/wmi/inc/wmi_unified_priv.h
@@ -40,6 +40,8 @@
#define WMI_EVENT_DEBUG_ENTRY_MAX_LENGTH (16)
/* wmi_mgmt commands */
#define WMI_MGMT_EVENT_DEBUG_MAX_ENTRY (256)
+/* wmi diag rx events max buffer */
+#define WMI_DIAG_RX_EVENT_DEBUG_MAX_ENTRY (256)
/**
* struct wmi_command_debug - WMI command log buffer data type
@@ -118,12 +120,14 @@ struct wmi_log_buf_t {
* @wmi_mgmt_command_tx_cmp_log_buf_info - Buffer info for WMI Management
* Command Tx completion log
* @wmi_mgmt_event_log_buf_info - Buffer info for WMI Management event log
+ * @wmi_diag_event_log_buf_info - Buffer info for WMI diag event log
* @wmi_record_lock - Lock WMI recording
* @wmi_logging_enable - Enable/Disable state for WMI logging
* @buf_offset_command - Offset from where WMI command data should be logged
* @buf_offset_event - Offset from where WMI event data should be logged
* @is_management_record - Function refernce to check if command/event is
* management record
+ * @is_diag_event - Function refernce to check if event is diag event
* @wmi_id_to_name - Function refernce to API to convert Command id to
* string name
* @wmi_log_debugfs_dir - refernce to debugfs directory
@@ -138,12 +142,14 @@ struct wmi_debug_log_info {
struct wmi_log_buf_t wmi_mgmt_command_log_buf_info;
struct wmi_log_buf_t wmi_mgmt_command_tx_cmp_log_buf_info;
struct wmi_log_buf_t wmi_mgmt_event_log_buf_info;
+ struct wmi_log_buf_t wmi_diag_event_log_buf_info;
qdf_spinlock_t wmi_record_lock;
bool wmi_logging_enable;
uint32_t buf_offset_command;
uint32_t buf_offset_event;
bool (*is_management_record)(uint32_t cmd_id);
+ bool (*is_diag_event)(uint32_t event_id);
uint8_t *(*wmi_id_to_name)(uint32_t cmd_id);
struct dentry *wmi_log_debugfs_dir;
uint8_t wmi_instance_id;
diff --git a/wmi/src/wmi_unified.c b/wmi/src/wmi_unified.c
index d9f128dbba10..9aa0a8b0faad 100644
--- a/wmi/src/wmi_unified.c
+++ b/wmi/src/wmi_unified.c
@@ -206,10 +206,15 @@ uint32_t g_wmi_mgmt_command_tx_cmp_buf_idx = 0;
struct wmi_command_debug
wmi_mgmt_command_tx_cmp_log_buffer[WMI_MGMT_EVENT_DEBUG_MAX_ENTRY];
-/* wmi_mgmt events when processed */
-uint32_t g_wmi_mgmt_event_buf_idx = 0;
+/* wmi_mgmt events are received */
+uint32_t g_wmi_mgmt_rx_event_buf_idx = 0;
struct wmi_event_debug
-wmi_mgmt_event_log_buffer[WMI_MGMT_EVENT_DEBUG_MAX_ENTRY];
+wmi_mgmt_rx_event_log_buffer[WMI_MGMT_EVENT_DEBUG_MAX_ENTRY];
+
+/* wmi_diag events are received */
+uint32_t g_wmi_diag_rx_event_buf_idx = 0;
+struct wmi_event_debug
+wmi_diag_rx_event_log_buffer[WMI_DIAG_RX_EVENT_DEBUG_MAX_ENTRY];
#define WMI_MGMT_COMMAND_RECORD(a, b, c, d, e) { \
if (WMI_MGMT_EVENT_DEBUG_MAX_ENTRY <= \
@@ -250,7 +255,7 @@ wmi_mgmt_event_log_buffer[WMI_MGMT_EVENT_DEBUG_MAX_ENTRY];
h->log_info.wmi_mgmt_command_tx_cmp_log_buf_info.length++; \
}
-#define WMI_MGMT_EVENT_RECORD(h, a, b) { \
+#define WMI_MGMT_RX_EVENT_RECORD(h, a, b) { \
if (wmi_mgmt_log_max_entry <= \
*(h->log_info.wmi_mgmt_event_log_buf_info.p_buf_tail_idx))\
*(h->log_info.wmi_mgmt_event_log_buf_info.p_buf_tail_idx) = 0;\
@@ -268,9 +273,29 @@ wmi_mgmt_event_log_buffer[WMI_MGMT_EVENT_DEBUG_MAX_ENTRY];
h->log_info.wmi_mgmt_event_log_buf_info.length++; \
}
+#define WMI_DIAG_RX_EVENT_RECORD(h, a, b) { \
+ if (wmi_mgmt_log_max_entry <= \
+ *(h->log_info.wmi_diag_event_log_buf_info.p_buf_tail_idx))\
+ *(h->log_info.wmi_diag_event_log_buf_info.p_buf_tail_idx) = 0;\
+ ((struct wmi_event_debug *)h->log_info.wmi_diag_event_log_buf_info.buf)\
+ [*(h->log_info.wmi_diag_event_log_buf_info.p_buf_tail_idx)]\
+ .event = a; \
+ qdf_mem_copy(((struct wmi_event_debug *)h->log_info. \
+ wmi_diag_event_log_buf_info.buf) \
+ [*(h->log_info.wmi_diag_event_log_buf_info.p_buf_tail_idx)].\
+ data, b, wmi_record_max_length); \
+ ((struct wmi_event_debug *)h->log_info.wmi_diag_event_log_buf_info.buf)\
+ [*(h->log_info.wmi_diag_event_log_buf_info.p_buf_tail_idx)].\
+ time = qdf_get_log_timestamp(); \
+ (*(h->log_info.wmi_diag_event_log_buf_info.p_buf_tail_idx))++; \
+ h->log_info.wmi_diag_event_log_buf_info.length++; \
+}
+
+
/* These are defined to made it as module param, which can be configured */
uint32_t wmi_log_max_entry = WMI_EVENT_DEBUG_MAX_ENTRY;
uint32_t wmi_mgmt_log_max_entry = WMI_MGMT_EVENT_DEBUG_MAX_ENTRY;
+uint32_t wmi_diag_log_max_entry = WMI_DIAG_RX_EVENT_DEBUG_MAX_ENTRY;
uint32_t wmi_record_max_length = WMI_EVENT_DEBUG_ENTRY_MAX_LENGTH;
uint32_t wmi_display_size = 100;
@@ -299,6 +324,8 @@ static QDF_STATUS wmi_log_init(struct wmi_unified *wmi_handle)
&wmi_handle->log_info.wmi_mgmt_command_tx_cmp_log_buf_info;
struct wmi_log_buf_t *mgmt_event_log_buf =
&wmi_handle->log_info.wmi_mgmt_event_log_buf_info;
+ struct wmi_log_buf_t *diag_event_log_buf =
+ &wmi_handle->log_info.wmi_diag_event_log_buf_info;
/* WMI commands */
cmd_log_buf->length = 0;
@@ -343,13 +370,20 @@ static QDF_STATUS wmi_log_init(struct wmi_unified *wmi_handle)
&g_wmi_mgmt_command_tx_cmp_buf_idx;
mgmt_cmd_tx_cmp_log_buf->size = WMI_MGMT_EVENT_DEBUG_MAX_ENTRY;
- /* WMI Management events when processed*/
+ /* WMI Management events when received*/
mgmt_event_log_buf->length = 0;
mgmt_event_log_buf->buf_tail_idx = 0;
- mgmt_event_log_buf->buf = wmi_mgmt_event_log_buffer;
- mgmt_event_log_buf->p_buf_tail_idx = &g_wmi_mgmt_event_buf_idx;
+ mgmt_event_log_buf->buf = wmi_mgmt_rx_event_log_buffer;
+ mgmt_event_log_buf->p_buf_tail_idx = &g_wmi_mgmt_rx_event_buf_idx;
mgmt_event_log_buf->size = WMI_MGMT_EVENT_DEBUG_MAX_ENTRY;
+ /* WMI diag events when received */
+ diag_event_log_buf->length = 0;
+ diag_event_log_buf->buf_tail_idx = 0;
+ diag_event_log_buf->buf = wmi_diag_rx_event_log_buffer;
+ diag_event_log_buf->p_buf_tail_idx = &g_wmi_diag_rx_event_buf_idx;
+ diag_event_log_buf->size = WMI_DIAG_RX_EVENT_DEBUG_MAX_ENTRY;
+
qdf_spinlock_create(&wmi_handle->log_info.wmi_record_lock);
wmi_handle->log_info.wmi_logging_enable = 1;
@@ -374,6 +408,8 @@ static QDF_STATUS wmi_log_init(struct wmi_unified *wmi_handle)
&wmi_handle->log_info.wmi_mgmt_command_tx_cmp_log_buf_info;
struct wmi_log_buf_t *mgmt_event_log_buf =
&wmi_handle->log_info.wmi_mgmt_event_log_buf_info;
+ struct wmi_log_buf_t *diag_event_log_buf =
+ &wmi_handle->log_info.wmi_diag_event_log_buf_info;
wmi_handle->log_info.wmi_logging_enable = 0;
@@ -459,7 +495,7 @@ static QDF_STATUS wmi_log_init(struct wmi_unified *wmi_handle)
mgmt_cmd_tx_cmp_log_buf->p_buf_tail_idx =
&mgmt_cmd_tx_cmp_log_buf->buf_tail_idx;
- /* WMI Management events when processed*/
+ /* WMI Management events when received */
mgmt_event_log_buf->length = 0;
mgmt_event_log_buf->buf_tail_idx = 0;
@@ -474,6 +510,21 @@ static QDF_STATUS wmi_log_init(struct wmi_unified *wmi_handle)
}
mgmt_event_log_buf->p_buf_tail_idx = &mgmt_event_log_buf->buf_tail_idx;
+ /* WMI diag events when received */
+ diag_event_log_buf->length = 0;
+ diag_event_log_buf->buf_tail_idx = 0;
+
+ diag_event_log_buf->buf = (struct wmi_event_debug *) qdf_mem_malloc(
+ wmi_diag_log_max_entry *
+ sizeof(struct wmi_event_debug));
+ diag_event_log_buf->size = wmi_diag_log_max_entry;
+
+ if (!diag_event_log_buf->buf) {
+ qdf_print("no memory for WMI diag event log buffer..\n");
+ return QDF_STATUS_E_NOMEM;
+ }
+ diag_event_log_buf->p_buf_tail_idx = &diag_event_log_buf->buf_tail_idx;
+
qdf_spinlock_create(&wmi_handle->log_info.wmi_record_lock);
wmi_handle->log_info.wmi_logging_enable = 1;
@@ -510,6 +561,9 @@ static inline void wmi_log_buffer_free(struct wmi_unified *wmi_handle)
if (wmi_handle->log_info.wmi_mgmt_event_log_buf_info.buf)
qdf_mem_free(
wmi_handle->log_info.wmi_mgmt_event_log_buf_info.buf);
+ if (wmi_handle->log_info.wmi_diag_event_log_buf_info.buf)
+ qdf_mem_free(
+ wmi_handle->log_info.wmi_diag_event_log_buf_info.buf);
wmi_handle->log_info.wmi_logging_enable = 0;
qdf_spinlock_destroy(&wmi_handle->log_info.wmi_record_lock);
}
@@ -1588,8 +1642,18 @@ static void wmi_control_rx(void *ctx, HTC_PACKET *htc_packet)
qdf_spin_lock_bh(&wmi_handle->log_info.wmi_record_lock);
/* Exclude 4 bytes of TLV header */
- WMI_RX_EVENT_RECORD(wmi_handle, id, ((uint8_t *) data +
+ if (wmi_handle->log_info.is_diag_event(id)) {
+ WMI_DIAG_RX_EVENT_RECORD(wmi_handle, id,
+ ((uint8_t *) data +
+ wmi_handle->log_info.buf_offset_event));
+ } else if (wmi_handle->log_info.is_management_record(id)) {
+ WMI_MGMT_RX_EVENT_RECORD(wmi_handle, id,
+ ((uint8_t *) data +
wmi_handle->log_info.buf_offset_event));
+ } else {
+ WMI_RX_EVENT_RECORD(wmi_handle, id, ((uint8_t *) data +
+ wmi_handle->log_info.buf_offset_event));
+ }
qdf_spin_unlock_bh(&wmi_handle->log_info.wmi_record_lock);
}
#endif
@@ -1674,9 +1738,16 @@ void __wmi_control_rx(struct wmi_unified *wmi_handle, wmi_buf_t evt_buf)
if (wmi_handle->log_info.wmi_logging_enable) {
qdf_spin_lock_bh(&wmi_handle->log_info.wmi_record_lock);
/* Exclude 4 bytes of TLV header */
- if (wmi_handle->log_info.is_management_record(id)) {
- WMI_MGMT_EVENT_RECORD(wmi_handle, id, ((uint8_t *) data
- + wmi_handle->log_info.buf_offset_event));
+ if (wmi_handle->log_info.is_diag_event(id)) {
+ /*
+ * skip diag event logging in WMI event buffer
+ * as its already logged in WMI RX event buffer
+ */
+ } else if (wmi_handle->log_info.is_management_record(id)) {
+ /*
+ * skip wmi mgmt event logging in WMI event buffer
+ * as its already logged in WMI RX event buffer
+ */
} else {
WMI_EVENT_RECORD(wmi_handle, id, ((uint8_t *) data +
wmi_handle->log_info.buf_offset_event));
diff --git a/wmi/src/wmi_unified_non_tlv.c b/wmi/src/wmi_unified_non_tlv.c
index 3db7653c231f..a55fea25b2cc 100644
--- a/wmi/src/wmi_unified_non_tlv.c
+++ b/wmi/src/wmi_unified_non_tlv.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016-2017 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2016-2018 The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for
* any purpose with or without fee is hereby granted, provided that the
@@ -7218,6 +7218,14 @@ static bool is_management_record_non_tlv(uint32_t cmd_id)
return false;
}
+
+static bool is_diag_event_non_tlv(uint32_t event_id)
+{
+ if (WMI_DIAG_EVENTID == event_id)
+ return true;
+
+ return false;
+}
#endif
/**
@@ -8017,6 +8025,8 @@ void wmi_non_tlv_attach(struct wmi_unified *wmi_handle)
wmi_handle->log_info.buf_offset_event = 0;
wmi_handle->log_info.is_management_record =
is_management_record_non_tlv;
+ wmi_handle->log_info.is_diag_event =
+ is_diag_event_non_tlv;
/*(uint8 *)(*wmi_id_to_name)(uint32_t cmd_id);*/
#endif
#else
diff --git a/wmi/src/wmi_unified_tlv.c b/wmi/src/wmi_unified_tlv.c
index d30a62631472..76102b391fd2 100644
--- a/wmi/src/wmi_unified_tlv.c
+++ b/wmi/src/wmi_unified_tlv.c
@@ -13888,6 +13888,14 @@ static bool is_management_record_tlv(uint32_t cmd_id)
return false;
}
+
+static bool is_diag_event_tlv(uint32_t event_id)
+{
+ if (WMI_DIAG_EVENTID == event_id)
+ return true;
+
+ return false;
+}
#endif
static uint16_t wmi_tag_vdev_set_cmd(wmi_unified_t wmi_hdl, wmi_buf_t buf)
@@ -15980,6 +15988,8 @@ void wmi_tlv_attach(wmi_unified_t wmi_handle)
wmi_handle->log_info.buf_offset_event = 4;
wmi_handle->log_info.is_management_record =
is_management_record_tlv;
+ wmi_handle->log_info.is_diag_event =
+ is_diag_event_tlv;
#endif
populate_tlv_service(wmi_handle->services);
populate_tlv_events_id(wmi_handle->wmi_events);
@@ -15995,6 +16005,8 @@ void wmi_tlv_attach(wmi_unified_t wmi_handle)
wmi_handle->log_info.buf_offset_event = 4;
wmi_handle->log_info.is_management_record =
is_management_record_tlv;
+ wmi_handle->log_info.is_diag_event =
+ is_diag_event_tlv;
#endif
}
#endif