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
diff --git a/wmi_unified.c b/wmi_unified.c
index cba102a..55c36a8 100644
--- a/wmi_unified.c
+++ b/wmi_unified.c
@@ -490,10 +490,15 @@
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 when 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 when 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];
#endif
#define WMI_MGMT_COMMAND_RECORD(h, a, b) { \
@@ -543,7 +548,7 @@
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) do { \
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;\
@@ -559,11 +564,30 @@
time = qdf_get_log_timestamp(); \
(*(h->log_info.wmi_mgmt_event_log_buf_info.p_buf_tail_idx))++; \
h->log_info.wmi_mgmt_event_log_buf_info.length++; \
-}
+} while (0);
+
+#define WMI_DIAG_RX_EVENT_RECORD(h, a, b) do { \
+ 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++; \
+} while (0);
/* 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;
@@ -592,6 +616,8 @@
&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;
@@ -636,13 +662,20 @@
&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;
@@ -667,6 +700,8 @@
&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;
@@ -752,7 +787,7 @@
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;
@@ -767,6 +802,21 @@
}
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;
@@ -803,6 +853,9 @@
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);
}
@@ -2061,8 +2114,18 @@
qdf_spin_lock_bh(&wmi_handle->log_info.wmi_record_lock);
/* Exclude 4 bytes of TLV header */
- WMI_RX_EVENT_RECORD(wmi_handle, id, data +
- wmi_handle->log_info.buf_offset_event);
+ if (wmi_handle->ops->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->ops->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
@@ -2150,12 +2213,19 @@
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->ops->is_management_record(id)) {
- WMI_MGMT_EVENT_RECORD(wmi_handle, id, data
- + wmi_handle->log_info.buf_offset_event);
+ if (wmi_handle->ops->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->ops->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, data +
- wmi_handle->log_info.buf_offset_event);
+ WMI_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);
}
diff --git a/wmi_unified_non_tlv.c b/wmi_unified_non_tlv.c
index 6930650..63ceed8 100644
--- a/wmi_unified_non_tlv.c
+++ b/wmi_unified_non_tlv.c
@@ -8476,6 +8476,14 @@
return false;
}
+static bool is_diag_event_non_tlv(uint32_t event_id)
+{
+ if (WMI_DEBUG_MESG_EVENTID == event_id)
+ return true;
+
+ return false;
+}
+
/**
* wmi_set_htc_tx_tag_non_tlv() - set HTC TX tag for WMI commands
* @wmi_handle: WMI handle
@@ -8868,6 +8876,7 @@
.extract_pdev_utf_event = extract_pdev_utf_event_non_tlv,
.wmi_set_htc_tx_tag = wmi_set_htc_tx_tag_non_tlv,
.is_management_record = is_management_record_non_tlv,
+ .is_diag_event = is_diag_event_non_tlv,
.send_dfs_phyerr_offload_en_cmd =
send_dfs_phyerr_offload_en_cmd_non_tlv,
.send_dfs_phyerr_offload_dis_cmd =
diff --git a/wmi_unified_tlv.c b/wmi_unified_tlv.c
index 0249daa..7575488 100644
--- a/wmi_unified_tlv.c
+++ b/wmi_unified_tlv.c
@@ -20375,6 +20375,14 @@
return false;
}
+static bool is_diag_event_tlv(uint32_t event_id)
+{
+ if (WMI_DIAG_EVENTID == event_id)
+ return true;
+
+ return false;
+}
+
static uint16_t wmi_tag_vdev_set_cmd(wmi_unified_t wmi_hdl, wmi_buf_t buf)
{
wmi_vdev_set_param_cmd_fixed_param *set_cmd;
@@ -22958,6 +22966,7 @@
.extract_peer_delete_response_event =
extract_peer_delete_response_event_tlv,
.is_management_record = is_management_record_tlv,
+ .is_diag_event = is_diag_event_tlv,
.extract_pdev_csa_switch_count_status =
extract_pdev_csa_switch_count_status_tlv,
.extract_pdev_tpc_ev_param = extract_pdev_tpc_ev_param_tlv,