Forráskód Böngészése

qcacmn: Enhance MGMT frame logging in WMI

More detailed logging needed for mgmt frames

Add vdev_id, frame type, subtype, and channel to logs by defining wrapper
function around logging macro and calling it from send_mgmt_cmd_tlv

Change-Id: I0c8c26e3194d97be7d903f64c5c5909c2d4b9799
CRs-Fixed: 1011346
Sandeep Puligilla 9 éve
szülő
commit
b74958d1cf
2 módosított fájl, 44 hozzáadás és 27 törlés
  1. 39 27
      wmi_unified.c
  2. 5 0
      wmi_unified_tlv.c

+ 39 - 27
wmi_unified.c

@@ -178,25 +178,18 @@ uint32_t g_wmi_mgmt_event_buf_idx = 0;
 struct wmi_event_debug
 wmi_mgmt_event_log_buffer[WMI_MGMT_EVENT_DEBUG_MAX_ENTRY];
 
-#define WMI_MGMT_COMMAND_RECORD(h, a, b) {				\
-	if (wmi_mgmt_log_max_entry <=					\
-		*(h->log_info.wmi_mgmt_command_log_buf_info.p_buf_tail_idx)) \
-		*(h->log_info.wmi_mgmt_command_log_buf_info.p_buf_tail_idx) = 0;\
-	((struct wmi_command_debug *)h->log_info.			\
-		wmi_mgmt_command_log_buf_info.buf)			\
-		[*(h->log_info.wmi_mgmt_command_log_buf_info.p_buf_tail_idx)].\
-			command = a;					\
-	qdf_mem_copy(((struct wmi_command_debug *)h->log_info.		\
-				wmi_mgmt_command_log_buf_info.buf)	\
-		[*(h->log_info.wmi_mgmt_command_log_buf_info.p_buf_tail_idx)].\
-		data, b,						\
-		wmi_record_max_length);				\
-	((struct wmi_command_debug *)h->log_info.			\
-		wmi_mgmt_command_log_buf_info.buf)			\
-		[*(h->log_info.wmi_mgmt_command_log_buf_info.p_buf_tail_idx)].\
-			time =	qdf_get_log_timestamp();		\
-	(*(h->log_info.wmi_mgmt_command_log_buf_info.p_buf_tail_idx))++;\
-	h->log_info.wmi_mgmt_command_log_buf_info.length++;		\
+#define WMI_MGMT_COMMAND_RECORD(a, b, c, d, e) {			     \
+	if (WMI_MGMT_EVENT_DEBUG_MAX_ENTRY <=				     \
+		g_wmi_mgmt_command_buf_idx)				     \
+		g_wmi_mgmt_command_buf_idx = 0;				     \
+	wmi_mgmt_command_log_buffer[g_wmi_mgmt_command_buf_idx].command = a; \
+	wmi_mgmt_command_log_buffer[g_wmi_mgmt_command_buf_idx].data[0] = b; \
+	wmi_mgmt_command_log_buffer[g_wmi_mgmt_command_buf_idx].data[1] = c; \
+	wmi_mgmt_command_log_buffer[g_wmi_mgmt_command_buf_idx].data[2] = d; \
+	wmi_mgmt_command_log_buffer[g_wmi_mgmt_command_buf_idx].data[3] = e; \
+	wmi_mgmt_command_log_buffer[g_wmi_mgmt_command_buf_idx].time =	     \
+		qdf_get_log_timestamp();				     \
+	g_wmi_mgmt_command_buf_idx++;					     \
 }
 
 #define WMI_MGMT_COMMAND_TX_CMP_RECORD(h, a, b) {			\
@@ -893,6 +886,29 @@ static QDF_STATUS wmi_debugfs_init(wmi_unified_t wmi_handle)
 
 	return QDF_STATUS_SUCCESS;
 }
+
+/**
+ * wmi_mgmt_cmd_record() - Wrapper function for mgmt command logging macro
+ *
+ * @wmi_handle: wmi handle
+ * @cmd: mgmt command
+ * @type: 802.11 frame type
+ * @subtype: 802.11 fram subtype
+ * @vdev_id: vdev id
+ * @chanfreq: channel frequency
+ *
+ * Return: none
+ */
+void wmi_mgmt_cmd_record(wmi_unified_t wmi_handle, WMI_CMD_ID cmd,
+				uint32_t type, uint32_t subtype,
+				uint32_t vdev_id, uint32_t chanfreq)
+{
+	qdf_spin_lock_bh(&wmi_handle->log_info.wmi_record_lock);
+
+	WMI_MGMT_COMMAND_RECORD(cmd, type, subtype, vdev_id, chanfreq);
+
+	qdf_spin_unlock_bh(&wmi_handle->log_info.wmi_record_lock);
+}
 #else
 /**
  * wmi_debugfs_remove() - Remove debugfs entry for wmi logging.
@@ -903,6 +919,9 @@ static QDF_STATUS wmi_debugfs_init(wmi_unified_t wmi_handle)
  * Return: none
  */
 static void wmi_debugfs_remove(wmi_unified_t wmi_handle) { }
+void wmi_mgmt_cmd_record(wmi_unified_t wmi_handle, WMI_CMD_ID cmd,
+				uint32_t type, uint32_t subtype,
+				uint32_t vdev_id, uint32_t chanfreq) { }
 #endif /*WMI_INTERFACE_EVENT_LOGGING */
 
 int wmi_get_host_credits(wmi_unified_t wmi_handle);
@@ -1717,18 +1736,11 @@ int wmi_unified_cmd_send(wmi_unified_t wmi_handle, wmi_buf_t buf, uint32_t len,
 #ifdef WMI_INTERFACE_EVENT_LOGGING
 	if (wmi_handle->log_info.wmi_logging_enable) {
 		qdf_spin_lock_bh(&wmi_handle->log_info.wmi_record_lock);
-		/*Record 16 bytes of WMI cmd data -
-		 * exclude TLV and WMI headers */
-		if (wmi_handle->log_info.is_management_record(cmd_id)) {
-			WMI_MGMT_COMMAND_RECORD(wmi_handle, cmd_id,
-			((uint32_t *) qdf_nbuf_data(buf) +
-			 wmi_handle->log_info.buf_offset_command));
-		} else {
+		if (!wmi_handle->log_info.is_management_record(cmd_id)) {
 			WMI_COMMAND_RECORD(wmi_handle, cmd_id,
 			((uint32_t *) qdf_nbuf_data(buf) +
 			 wmi_handle->log_info.buf_offset_command));
 		}
-
 		qdf_spin_unlock_bh(&wmi_handle->log_info.wmi_record_lock);
 	}
 #endif

+ 5 - 0
wmi_unified_tlv.c

@@ -1640,6 +1640,11 @@ QDF_STATUS send_mgmt_cmd_tlv(wmi_unified_t wmi_handle,
 	cmd->frame_len = param->frm_len;
 	cmd->buf_len = bufp_len;
 
+	wmi_mgmt_cmd_record(wmi_handle, WMI_MGMT_TX_SEND_CMDID,
+			((struct wmi_command_header *)bufp)->type,
+			((struct wmi_command_header *)bufp)->sub_type,
+			cmd->vdev_id, cmd->chanfreq);
+
 	if (wmi_unified_cmd_send(wmi_handle, buf, cmd_len,
 				      WMI_MGMT_TX_SEND_CMDID)) {
 		WMI_LOGE("%s: Failed to send mgmt Tx", __func__);