浏览代码

qcacmn: Record reo command srng events

Add debugging infrastructure to record every event posted to reo
command ring. The infrastructure maintains the record of the last
64 events posted to the ring.

Change-Id: Id56fc352050eb664a64b0abb767f3b4a6b4c3aa3
CRs-Fixed: 2552822
Venkata Sharath Chandra Manchala 5 年之前
父节点
当前提交
ea6518b89e
共有 9 个文件被更改,包括 100 次插入24 次删除
  1. 8 0
      dp/inc/cdp_txrx_cmn.h
  2. 5 9
      dp/wifi3.0/dp_peer.c
  3. 43 6
      dp/wifi3.0/dp_reo.c
  4. 30 0
      dp/wifi3.0/dp_types.h
  5. 7 0
      hal/wifi3.0/hal_internal.h
  6. 0 2
      hal/wifi3.0/hal_reo.c
  7. 4 4
      hal/wifi3.0/hal_srng.c
  8. 3 2
      hif/src/hif_exec.c
  9. 0 1
      hif/src/hif_exec.h

+ 8 - 0
dp/inc/cdp_txrx_cmn.h

@@ -45,6 +45,14 @@ extern bool is_dp_verbose_debug_enabled;
 #define dp_info(params...) \
 	__QDF_TRACE_FL(QDF_TRACE_LEVEL_INFO_HIGH, QDF_MODULE_ID_DP, ## params)
 #define dp_debug(params...) QDF_TRACE_DEBUG(QDF_MODULE_ID_DP, params)
+
+#ifdef DP_PRINT_NO_CONSOLE
+#define dp_err_log(params...) \
+	__QDF_TRACE_FL(QDF_TRACE_LEVEL_INFO_HIGH, QDF_MODULE_ID_DP, ## params)
+#else
+#define dp_err_log(params...) QDF_TRACE_ERROR(QDF_MODULE_ID_DP, params)
+#endif /* DP_PRINT_NO_CONSOLE */
+
 #ifdef ENABLE_VERBOSE_DEBUG
 /**
  * @enum verbose_debug_module:

+ 5 - 9
dp/wifi3.0/dp_peer.c

@@ -2083,12 +2083,9 @@ static void dp_rx_tid_delete_cb(struct dp_soc *soc, void *cb_ctxt,
 							&params,
 							NULL,
 							NULL)) {
-				QDF_TRACE(QDF_MODULE_ID_DP,
-					QDF_TRACE_LEVEL_ERROR,
-					"%s: fail to send CMD_CACHE_FLUSH:"
-					"tid %d desc %pK", __func__,
-					rx_tid->tid,
-					(void *)(rx_tid->hw_qdesc_paddr));
+				dp_err_log("fail to send CMD_CACHE_FLUSH:"
+					   "tid %d desc %pK", rx_tid->tid,
+					   (void *)(rx_tid->hw_qdesc_paddr));
 			}
 		}
 
@@ -2112,9 +2109,8 @@ static void dp_rx_tid_delete_cb(struct dp_soc *soc, void *cb_ctxt,
 			 *
 			 * Here invoke desc_free function directly to do clean up.
 			 */
-			QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR,
-				  "%s: fail to send REO cmd to flush cache: tid %d",
-				  __func__, rx_tid->tid);
+			dp_err_log("%s: fail to send REO cmd to flush cache: tid %d",
+				   __func__, rx_tid->tid);
 			qdf_mem_zero(&reo_status, sizeof(reo_status));
 			reo_status.fl_cache_status.header.status = 0;
 			dp_reo_desc_free(soc, (void *)desc, &reo_status);

+ 43 - 6
dp/wifi3.0/dp_reo.c

@@ -19,6 +19,43 @@
 #include "dp_types.h"
 #include "hal_reo.h"
 #include "dp_internal.h"
+#include <qdf_time.h>
+
+#ifdef WLAN_FEATURE_DP_EVENT_HISTORY
+/**
+ * dp_reo_cmd_srng_event_record() - Record reo cmds posted
+ * to the reo cmd ring
+ * @soc: dp soc handle
+ * @type: reo cmd type
+ * @post_status: command error status
+ *
+ * Return: None
+ */
+static
+void dp_reo_cmd_srng_event_record(struct dp_soc *soc,
+				  enum hal_reo_cmd_type type,
+				  int post_status)
+{
+	struct reo_cmd_event_history *cmd_event_history =
+					&soc->stats.cmd_event_history;
+	struct reo_cmd_event_record *record = cmd_event_history->cmd_record;
+	int record_index;
+
+	record_index = (qdf_atomic_inc_return(&cmd_event_history->index)) &
+				(REO_CMD_EVENT_HIST_MAX - 1);
+
+	record[record_index].cmd_type = type;
+	record[record_index].cmd_return_status = post_status;
+	record[record_index].timestamp  = qdf_get_log_timestamp();
+}
+#else
+static inline
+void dp_reo_cmd_srng_event_record(struct dp_soc *soc,
+				  enum hal_reo_cmd_type type,
+				  int post_status)
+{
+}
+#endif /*WLAN_FEATURE_DP_EVENT_HISTORY */
 
 QDF_STATUS dp_reo_send_cmd(struct dp_soc *soc, enum hal_reo_cmd_type type,
 		     struct hal_reo_cmd_params *params,
@@ -53,22 +90,22 @@ QDF_STATUS dp_reo_send_cmd(struct dp_soc *soc, enum hal_reo_cmd_type type,
 						  soc->hal_soc, params);
 		break;
 	default:
-		QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR,
-			"%s: Invalid REO command type", __func__);
+		dp_err_log("Invalid REO command type: %d", type);
 		return QDF_STATUS_E_FAILURE;
 	};
 
+	dp_reo_cmd_srng_event_record(soc, type, num);
+
 	if (num < 0) {
-		qdf_print("%s: Error with sending REO command", __func__);
+		dp_err_log("Error with sending REO command type: %d", type);
 		return QDF_STATUS_E_FAILURE;
 	}
 
 	if (callback_fn) {
 		reo_cmd = qdf_mem_malloc(sizeof(*reo_cmd));
 		if (!reo_cmd) {
-			QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR,
-				"%s: alloc failed for REO cmd:%d!!",
-				__func__, type);
+			dp_err_log("alloc failed for REO cmd:%d!!",
+				   type);
 			return QDF_STATUS_E_NOMEM;
 		}
 

+ 30 - 0
dp/wifi3.0/dp_types.h

@@ -109,6 +109,8 @@
 #define PCP_TID_MAP_MAX 8
 #define MAX_MU_USERS 37
 
+#define REO_CMD_EVENT_HIST_MAX 64
+
 #ifndef REMOVE_PKT_LOG
 enum rx_pktlog_mode {
 	DP_RX_PKTLOG_DISABLED = 0,
@@ -654,6 +656,30 @@ struct reo_desc_list_node {
 	struct dp_rx_tid rx_tid;
 };
 
+#ifdef WLAN_FEATURE_DP_EVENT_HISTORY
+/**
+ * struct reo_cmd_event_record: Elements to record for each reo command
+ * @cmd_type: reo command type
+ * @cmd_return_status: reo command post status
+ * @timestamp: record timestamp for the reo command
+ */
+struct reo_cmd_event_record {
+	enum hal_reo_cmd_type cmd_type;
+	uint8_t cmd_return_status;
+	uint32_t timestamp;
+};
+
+/**
+ * struct reo_cmd_event_history: Account for reo cmd events
+ * @index: record number
+ * @cmd_record: list of records
+ */
+struct reo_cmd_event_history {
+	qdf_atomic_t index;
+	struct reo_cmd_event_record cmd_record[REO_CMD_EVENT_HIST_MAX];
+};
+#endif /* WLAN_FEATURE_DP_EVENT_HISTORY */
+
 /* SoC level data path statistics */
 struct dp_soc_stats {
 	struct {
@@ -745,6 +771,10 @@ struct dp_soc_stats {
 		/* packet count per core - per ring */
 		uint64_t ring_packets[NR_CPUS][MAX_REO_DEST_RINGS];
 	} rx;
+
+#ifdef WLAN_FEATURE_DP_EVENT_HISTORY
+	struct reo_cmd_event_history cmd_event_history;
+#endif /* WLAN_FEATURE_DP_EVENT_HISTORY */
 };
 
 union dp_align_mac_addr {

+ 7 - 0
hal/wifi3.0/hal_internal.h

@@ -30,6 +30,13 @@
 #define hal_warn(params...) QDF_TRACE_WARN(QDF_MODULE_ID_TXRX, params)
 #define hal_info(params...) QDF_TRACE_INFO(QDF_MODULE_ID_TXRX, params)
 #define hal_debug(params...) QDF_TRACE_DEBUG(QDF_MODULE_ID_TXRX, params)
+
+#define hal_alert_rl(params...) QDF_TRACE_FATAL_RL(QDF_MODULE_ID_HAL, params)
+#define hal_err_rl(params...) QDF_TRACE_ERROR_RL(QDF_MODULE_ID_HAL, params)
+#define hal_warn_rl(params...) QDF_TRACE_WARN_RL(QDF_MODULE_ID_HAL, params)
+#define hal_info_rl(params...) QDF_TRACE_INFO_RL(QDF_MODULE_ID_HAL, params)
+#define hal_debug_rl(params...) QDF_TRACE_DEBUG_RL(QDF_MODULE_ID_HAL, params)
+
 #ifdef ENABLE_VERBOSE_DEBUG
 extern bool is_hal_verbose_debug_enabled;
 #define hal_verbose_debug(params...) \

+ 0 - 2
hal/wifi3.0/hal_reo.c

@@ -529,8 +529,6 @@ inline int hal_reo_cmd_flush_cache(hal_ring_handle_t hal_ring_hdl,
 
 	reo_desc = hal_srng_src_get_next(hal_soc, hal_ring_hdl);
 	if (!reo_desc) {
-		QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_DEBUG,
-			"%s: Out of cmd ring entries", __func__);
 		hal_srng_access_end(hal_soc, hal_ring_hdl);
 		hal_srng_dump(hal_ring_handle_to_hal_srng(hal_ring_hdl));
 		return -EBUSY;

+ 4 - 4
hal/wifi3.0/hal_srng.c

@@ -801,15 +801,15 @@ enum hal_srng_dir hal_srng_get_dir(void *hal_soc, int ring_type)
 void hal_srng_dump(struct hal_srng *srng)
 {
 	if (srng->ring_dir == HAL_SRNG_SRC_RING) {
-		qdf_print("=== SRC RING %d ===", srng->ring_id);
-		qdf_print("hp %u, reap_hp %u, tp %u, cached tp %u",
+		hal_debug("=== SRC RING %d ===", srng->ring_id);
+		hal_debug("hp %u, reap_hp %u, tp %u, cached tp %u",
 			  srng->u.src_ring.hp,
 			  srng->u.src_ring.reap_hp,
 			  *srng->u.src_ring.tp_addr,
 			  srng->u.src_ring.cached_tp);
 	} else {
-		qdf_print("=== DST RING %d ===", srng->ring_id);
-		qdf_print("tp %u, hp %u, cached tp %u, loop_cnt %u",
+		hal_debug("=== DST RING %d ===", srng->ring_id);
+		hal_debug("tp %u, hp %u, cached tp %u, loop_cnt %u",
 			  srng->u.dst_ring.tp,
 			  *srng->u.dst_ring.hp_addr,
 			  srng->u.dst_ring.cached_hp,

+ 3 - 2
hif/src/hif_exec.c

@@ -35,8 +35,9 @@ static struct hif_exec_context *hif_exec_tasklet_create(void);
 #ifdef WLAN_FEATURE_DP_EVENT_HISTORY
 struct hif_event_history hif_event_desc_history[HIF_NUM_INT_CONTEXTS];
 
-static inline int hif_get_next_record_index(qdf_atomic_t *table_index,
-					    int array_size)
+static inline
+int hif_get_next_record_index(qdf_atomic_t *table_index,
+			      int array_size)
 {
 	int record_index = qdf_atomic_inc_return(table_index);
 

+ 0 - 1
hif/src/hif_exec.h

@@ -155,6 +155,5 @@ irqreturn_t hif_ext_group_interrupt_handler(int irq, void *context);
 struct hif_exec_context *hif_exec_get_ctx(struct hif_opaque_softc *hif,
 					  uint8_t id);
 void hif_exec_kill(struct hif_opaque_softc *scn);
-
 #endif