Просмотр исходного кода

qcacmn: Print last wmi command tx completion time

Seeing kernel panic when max limit is reached for
pending WMI cmds, self-recovery is triggered that
sends a WMI cmd to crash the FW. This will not go
through and call recovery again

Change-Id: I55d025ac4fbf8b18ac441a135d10d558b2ec4d1e
CRs-Fixed: 3397524
Shivam Kumar 2 лет назад
Родитель
Сommit
37066e5d01
1 измененных файлов с 49 добавлено и 0 удалено
  1. 49 0
      wmi/src/wmi_unified.c

+ 49 - 0
wmi/src/wmi_unified.c

@@ -748,6 +748,53 @@ wmi_print_cmd_log_buffer(struct wmi_log_buf_t *log_buffer, uint32_t count,
 	}
 }
 
+/**
+ * wmi_dump_last_cmd_rec_info() - last wmi command tx completion time print
+ * @wmi_handle: wmi handle
+ *
+ * Return: None
+ */
+static void
+wmi_dump_last_cmd_rec_info(wmi_unified_t wmi_handle) {
+	uint32_t idx, idx_tx_cmp, cmd_tmp_log, cmd_tmp_tx_cmp;
+	uint64_t secs, secs_tx_cmp, usecs, usecs_tx_cmp;
+	struct wmi_command_debug *cmd_log;
+	struct wmi_command_debug *cmd_log_tx_cmp;
+	struct wmi_log_buf_t *log_buf =
+		&wmi_handle->log_info.wmi_command_log_buf_info;
+	struct wmi_log_buf_t *log_buf_tx_cmp =
+		&wmi_handle->log_info.wmi_command_tx_cmp_log_buf_info;
+
+	qdf_spin_lock_bh(&wmi_handle->log_info.wmi_record_lock);
+
+	(*log_buf->p_buf_tail_idx == 0) ? (idx = log_buf->size) :
+		(idx = *log_buf->p_buf_tail_idx - 1);
+	idx %= log_buf->size;
+
+	(*log_buf_tx_cmp->p_buf_tail_idx == 0) ? (idx_tx_cmp =
+		log_buf_tx_cmp->size) : (idx_tx_cmp =
+		*log_buf_tx_cmp->p_buf_tail_idx - 1);
+	idx_tx_cmp %= log_buf_tx_cmp->size;
+	cmd_log = &((struct wmi_command_debug *)log_buf->buf)[idx];
+	cmd_log_tx_cmp = &((struct wmi_command_debug *)log_buf_tx_cmp->buf)
+		[idx_tx_cmp];
+	cmd_tmp_log = cmd_log->command;
+	cmd_tmp_tx_cmp = cmd_log_tx_cmp->command;
+	qdf_log_timestamp_to_secs(cmd_log->time, &secs, &usecs);
+	qdf_log_timestamp_to_secs(cmd_log_tx_cmp->time, &secs_tx_cmp,
+				  &usecs_tx_cmp);
+
+	qdf_spin_unlock_bh(&wmi_handle->log_info.wmi_record_lock);
+
+	wmi_nofl_err("Last wmi command Time (s) = % 8lld.%06lld ",
+		     secs, usecs);
+	wmi_nofl_err("Last wmi Cmd_Id = (0x%06x) ", cmd_tmp_log);
+	wmi_nofl_err("Last wmi command tx completion Time (s) = % 8lld.%06lld",
+		     secs_tx_cmp, usecs_tx_cmp);
+	wmi_nofl_err("Last wmi command tx completion Cmd_Id = (0x%06x) ",
+		     cmd_tmp_tx_cmp);
+}
+
 /**
  * wmi_print_cmd_cmp_log_buffer() - wmi command completion log printer
  * @log_buffer: the command completion log buffer metadata of the buffer to print
@@ -1394,6 +1441,7 @@ void wmi_mgmt_cmd_record(wmi_unified_t wmi_handle, uint32_t cmd,
 static inline void wmi_log_buffer_free(struct wmi_unified *wmi_handle) { }
 static void wmi_minidump_detach(struct wmi_unified *wmi_handle) { }
 static void wmi_minidump_attach(struct wmi_unified *wmi_handle) { }
+static void wmi_dump_last_cmd_rec_info(wmi_unified_t wmi_handle) { }
 #endif /*WMI_INTERFACE_EVENT_LOGGING */
 qdf_export_symbol(wmi_mgmt_cmd_record);
 
@@ -2077,6 +2125,7 @@ QDF_STATUS wmi_unified_cmd_send_fl(wmi_unified_t wmi_handle, wmi_buf_t buf,
 	qdf_atomic_inc(&wmi_handle->pending_cmds);
 	if (qdf_atomic_read(&wmi_handle->pending_cmds) >=
 			wmi_handle->wmi_max_cmds) {
+		wmi_dump_last_cmd_rec_info(wmi_handle);
 		wmi_nofl_err("hostcredits = %d",
 			     wmi_get_host_credits(wmi_handle));
 		htc_dump_counter_info(wmi_handle->htc_handle);