Kaynağa Gözat

qcacld-3.0: Debug enhancements for rx_buffer history

Add the following:
- Global cumulative counters for posted and received.
- CPU for each individual records
- Counters for refill timer starts
- iwpriv support (dumpStats 10) to dump the counters

CRs-Fixed: 2001331
Change-Id: I66a8a818ffa0b2522358bab404c92a3cdaa603f7
Orhan K AKYILDIZ 8 yıl önce
ebeveyn
işleme
fdd74de850

+ 61 - 5
core/dp/htt/htt_internal.h

@@ -158,17 +158,18 @@ struct htt_host_rx_desc_base {
  * 3) htt_rx_in_order_indication reception
  *    @paddr : = 0
  *    @nbuf  : = 0
- *    @ndata : = 0
+ *    @ndata : msdu_cnt
  *    @posted: time-stamp when HTT message is recived
  *    @recvd : 0x48545452584D5367 ('HTTRXMSG')
 */
-#define HTT_RX_RING_BUFF_DBG_LIST          2048
+#define HTT_RX_RING_BUFF_DBG_LIST          (2 * 1024)
 struct rx_buf_debug {
 	qdf_dma_addr_t paddr;
 	qdf_nbuf_t     nbuf;
 	void          *nbuf_data;
 	uint64_t       posted; /* timetamp */
 	uint64_t       recved; /* timestamp */
+	int            cpu;
 
 };
 #endif
@@ -656,9 +657,51 @@ void htt_rx_dbg_rxbuf_init(struct htt_pdev_t *pdev)
 		QDF_ASSERT(0);
 	} else {
 		qdf_spinlock_create(&(pdev->rx_buff_list_lock));
+		pdev->rx_buff_index = 0;
+		pdev->rx_buff_posted_cum = 0;
+		pdev->rx_buff_recvd_cum  = 0;
+		pdev->rx_buff_recvd_err  = 0;
+		pdev->refill_retry_timer_starts = 0;
+		pdev->refill_retry_timer_calls = 0;
+
 	}
 }
 
+static inline int htt_display_rx_buf_debug(struct htt_pdev_t *pdev)
+{
+	int i;
+	struct rx_buf_debug *buf;
+
+	if ((pdev != NULL) &&
+	    (pdev->rx_buff_list != NULL)) {
+		buf = pdev->rx_buff_list;
+		for (i = 0; i < HTT_RX_RING_BUFF_DBG_LIST; i++) {
+			if (buf[i].posted != 0)
+				QDF_TRACE(QDF_MODULE_ID_TXRX,
+					  QDF_TRACE_LEVEL_ERROR,
+					  "[%d][0x%x] %p %lu %p %llu %llu",
+					  i, buf[i].cpu,
+					  buf[i].nbuf_data,
+					  (unsigned long)buf[i].paddr,
+					  buf[i].nbuf,
+					  buf[i].posted,
+					  buf[i].recved);
+		}
+		QDF_TRACE(QDF_MODULE_ID_TXRX, QDF_TRACE_LEVEL_ERROR,
+		"rxbuf_idx %d all_posted: %d all_recvd: %d recv_err: %d timer_starts :%d timer_calls :%d",
+		pdev->rx_buff_index,
+		pdev->rx_buff_posted_cum,
+		pdev->rx_buff_recvd_cum,
+		pdev->rx_buff_recvd_err,
+		pdev->refill_retry_timer_starts,
+		pdev->refill_retry_timer_calls);
+
+
+	} else
+		return -EINVAL;
+	return 0;
+}
+
 /**
  * htt_rx_dbg_rxbuf_set() - set element of rx buff list
  * @pdev: pdev handle
@@ -679,7 +722,10 @@ void htt_rx_dbg_rxbuf_set(struct htt_pdev_t *pdev, qdf_dma_addr_t paddr,
 							rx_netbuf->data;
 		pdev->rx_buff_list[pdev->rx_buff_index].posted =
 						qdf_get_log_timestamp();
+		pdev->rx_buff_posted_cum++;
 		pdev->rx_buff_list[pdev->rx_buff_index].recved = 0;
+		pdev->rx_buff_list[pdev->rx_buff_index].cpu =
+				(1 << qdf_get_cpu());
 		NBUF_MAP_ID(rx_netbuf) = pdev->rx_buff_index;
 		if (++pdev->rx_buff_index >=
 				HTT_RX_RING_BUFF_DBG_LIST)
@@ -706,7 +752,12 @@ void htt_rx_dbg_rxbuf_reset(struct htt_pdev_t *pdev,
 		if (index < HTT_RX_RING_BUFF_DBG_LIST) {
 			pdev->rx_buff_list[index].recved =
 				qdf_get_log_timestamp();
+			pdev->rx_buff_recvd_cum++;
+		} else {
+			pdev->rx_buff_recvd_err++;
 		}
+		pdev->rx_buff_list[pdev->rx_buff_index].cpu |=
+				(1 << qdf_get_cpu());
 		qdf_spin_unlock_bh(&(pdev->rx_buff_list_lock));
 	}
 }
@@ -729,6 +780,8 @@ void htt_rx_dbg_rxbuf_indupd(struct htt_pdev_t *pdev, int alloc_index)
 						qdf_get_log_timestamp();
 		pdev->rx_buff_list[pdev->rx_buff_index].recved =
 			(uint64_t)alloc_index;
+		pdev->rx_buff_list[pdev->rx_buff_index].cpu =
+				(1 << qdf_get_cpu());
 		if (++pdev->rx_buff_index >=
 				HTT_RX_RING_BUFF_DBG_LIST)
 			pdev->rx_buff_index = 0;
@@ -742,17 +795,19 @@ void htt_rx_dbg_rxbuf_indupd(struct htt_pdev_t *pdev, int alloc_index)
  * Return: none
  */
 static inline
-void htt_rx_dbg_rxbuf_httrxind(struct htt_pdev_t *pdev)
+void htt_rx_dbg_rxbuf_httrxind(struct htt_pdev_t *pdev, unsigned int msdu_cnt)
 {
 	if (pdev->rx_buff_list) {
 		qdf_spin_lock_bh(&(pdev->rx_buff_list_lock));
-		pdev->rx_buff_list[pdev->rx_buff_index].paddr = 0;
+		pdev->rx_buff_list[pdev->rx_buff_index].paddr = msdu_cnt;
 		pdev->rx_buff_list[pdev->rx_buff_index].nbuf  = 0;
 		pdev->rx_buff_list[pdev->rx_buff_index].nbuf_data = 0;
 		pdev->rx_buff_list[pdev->rx_buff_index].posted =
 						qdf_get_log_timestamp();
 		pdev->rx_buff_list[pdev->rx_buff_index].recved =
 			(uint64_t)0x48545452584D5347; /* 'HTTRXMSG' */
+		pdev->rx_buff_list[pdev->rx_buff_index].cpu =
+				(1 << qdf_get_cpu());
 		if (++pdev->rx_buff_index >=
 				HTT_RX_RING_BUFF_DBG_LIST)
 			pdev->rx_buff_index = 0;
@@ -799,7 +854,8 @@ void htt_rx_dbg_rxbuf_indupd(struct htt_pdev_t *pdev,
 	return;
 }
 static inline
-void htt_rx_dbg_rxbuf_httrxind(struct htt_pdev_t *pdev)
+void htt_rx_dbg_rxbuf_httrxind(struct htt_pdev_t *pdev,
+			       unsigned int msdu_cnt)
 {
 	return;
 }

+ 5 - 2
core/dp/htt/htt_rx.c

@@ -404,6 +404,8 @@ static int htt_rx_ring_fill_level(struct htt_pdev_t *pdev)
 static void htt_rx_ring_refill_retry(void *arg)
 {
 	htt_pdev_handle pdev = (htt_pdev_handle) arg;
+
+	pdev->refill_retry_timer_calls++;
 	htt_rx_msdu_buff_replenish(pdev);
 }
 #endif
@@ -439,6 +441,7 @@ moretofill:
 #ifdef DEBUG_DMA_DONE
 			pdev->rx_ring.dbg_refill_cnt++;
 #endif
+			pdev->refill_retry_timer_starts++;
 			qdf_timer_start(
 				&pdev->rx_ring.refill_retry_timer,
 				HTT_RX_RING_REFILL_RETRY_TIME_MS);
@@ -1955,8 +1958,6 @@ htt_rx_amsdu_rx_in_order_pop_ll(htt_pdev_handle pdev,
 
 	HTT_ASSERT1(htt_rx_in_order_ring_elems(pdev) != 0);
 
-	htt_rx_dbg_rxbuf_httrxind(pdev);
-
 	rx_ind_data = qdf_nbuf_data(rx_ind_msg);
 	rx_ctx_id = QDF_NBUF_CB_RX_CTX_ID(rx_ind_msg);
 	msg_word = (uint32_t *) rx_ind_data;
@@ -1970,6 +1971,8 @@ htt_rx_amsdu_rx_in_order_pop_ll(htt_pdev_handle pdev,
 	msdu_count = HTT_RX_IN_ORD_PADDR_IND_MSDU_CNT_GET(*(msg_word + 1));
 	HTT_RX_CHECK_MSDU_COUNT(msdu_count);
 	ol_rx_update_histogram_stats(msdu_count, frag_ind, offload_ind);
+	htt_rx_dbg_rxbuf_httrxind(pdev, msdu_count);
+
 
 	msg_word =
 		(uint32_t *) (rx_ind_data + HTT_RX_IN_ORD_PADDR_IND_HDR_BYTES);

+ 5 - 0
core/dp/htt/htt_types.h

@@ -420,6 +420,11 @@ struct htt_pdev_t {
 	struct rx_buf_debug *rx_buff_list;
 	qdf_spinlock_t       rx_buff_list_lock;
 	int rx_buff_index;
+	int rx_buff_posted_cum;
+	int rx_buff_recvd_cum;
+	int rx_buff_recvd_err;
+	int refill_retry_timer_starts;
+	int refill_retry_timer_calls;
 #endif
 
 	/* callback function for packetdump */

+ 4 - 0
core/dp/txrx/ol_txrx.c

@@ -86,6 +86,7 @@
 #include "epping_main.h"
 #include <a_types.h>
 #include <cdp_txrx_handle.h>
+#include <htt_internal.h>
 #ifdef QCA_SUPPORT_TXRX_LOCAL_PEER_ID
 ol_txrx_peer_handle
 ol_txrx_peer_find_by_local_id(struct cdp_pdev *pdev,
@@ -4448,6 +4449,9 @@ static QDF_STATUS ol_txrx_display_stats(void *soc, uint16_t value)
 	case CDP_TXRX_DESC_STATS:
 		qdf_nbuf_tx_desc_count_display();
 		break;
+	case CDP_WLAN_RX_BUF_DEBUG_STATS:
+		htt_display_rx_buf_debug(pdev->htt_pdev);
+		break;
 #ifdef CONFIG_HL_SUPPORT
 	case CDP_SCHEDULER_STATS:
 		ol_tx_sched_cur_state_display(pdev);