From ddd01747a022a0a45fbb99a2aa2a550f1419af79 Mon Sep 17 00:00:00 2001 From: Orhan K AKYILDIZ Date: Thu, 15 Dec 2016 12:08:04 -0800 Subject: 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 --- core/dp/htt/htt_internal.h | 68 +++++++++++++++++++++++++++++++++++---- core/dp/htt/htt_rx.c | 7 ++-- core/dp/htt/htt_types.h | 5 +++ core/dp/ol/inc/ol_txrx_ctrl_api.h | 3 +- core/dp/txrx/ol_txrx.c | 4 +++ 5 files changed, 78 insertions(+), 9 deletions(-) diff --git a/core/dp/htt/htt_internal.h b/core/dp/htt/htt_internal.h index 97ea67faac7d..a68405680de5 100644 --- a/core/dp/htt/htt_internal.h +++ b/core/dp/htt/htt_internal.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2014-2016 The Linux Foundation. All rights reserved. + * Copyright (c) 2011, 2014-2017 The Linux Foundation. All rights reserved. * * Previously licensed under the ISC license by Qualcomm Atheros, Inc. * @@ -152,17 +152,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 @@ -648,9 +649,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 @@ -671,7 +714,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) @@ -698,7 +744,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)); } } @@ -721,6 +772,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; @@ -734,17 +787,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; @@ -791,7 +846,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; } diff --git a/core/dp/htt/htt_rx.c b/core/dp/htt/htt_rx.c index 991fa51d7e33..403fb62545a2 100644 --- a/core/dp/htt/htt_rx.c +++ b/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); @@ -1946,8 +1949,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; @@ -1961,6 +1962,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); diff --git a/core/dp/htt/htt_types.h b/core/dp/htt/htt_types.h index df126841b7c6..866b42a57b29 100644 --- a/core/dp/htt/htt_types.h +++ b/core/dp/htt/htt_types.h @@ -415,6 +415,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 */ diff --git a/core/dp/ol/inc/ol_txrx_ctrl_api.h b/core/dp/ol/inc/ol_txrx_ctrl_api.h index 29166be61464..a9fdf25b097c 100644 --- a/core/dp/ol/inc/ol_txrx_ctrl_api.h +++ b/core/dp/ol/inc/ol_txrx_ctrl_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011-2016 The Linux Foundation. All rights reserved. + * Copyright (c) 2011-2017 The Linux Foundation. All rights reserved. * * Previously licensed under the ISC license by Qualcomm Atheros, Inc. * @@ -71,6 +71,7 @@ #define WLAN_HIF_STATS 7 #define WLAN_LRO_STATS 8 #define WLAN_NAPI_STATS 9 +#define WLAN_RX_BUF_DEBUG_STATS 10 #define WLAN_SCHEDULER_STATS 21 #define WLAN_TX_QUEUE_STATS 22 #define WLAN_BUNDLE_STATS 23 diff --git a/core/dp/txrx/ol_txrx.c b/core/dp/txrx/ol_txrx.c index dd5c2a50978e..5767bd55c9a9 100644 --- a/core/dp/txrx/ol_txrx.c +++ b/core/dp/txrx/ol_txrx.c @@ -87,6 +87,7 @@ #include #include "wma_api.h" +#include #ifdef CONFIG_HL_SUPPORT /** @@ -4360,6 +4361,9 @@ QDF_STATUS ol_txrx_display_stats(uint16_t value) case WLAN_TXRX_DESC_STATS: qdf_nbuf_tx_desc_count_display(); break; + case WLAN_RX_BUF_DEBUG_STATS: + htt_display_rx_buf_debug(pdev->htt_pdev); + break; #ifdef CONFIG_HL_SUPPORT case WLAN_SCHEDULER_STATS: ol_tx_sched_cur_state_display(pdev); -- cgit v1.2.3