From 4a7bc2916166057b81aaca4b7cecd155d7afc47c Mon Sep 17 00:00:00 2001 From: Karthik Kantamneni Date: Mon, 20 Jul 2020 21:37:25 +0530 Subject: [PATCH] qcacld-3.0: Enhance logging in RX path to check refill failures Enable logging feature which helps to check rx ring refill failure. Currently rx ring refill count is updated same time from multiple places without protection, so use atomic variable for refill count. CRS-Fixed: 2740225 Change-Id: Icd88d351cb15d0f18edf0b986e4de95dbe4e6989 --- Kbuild | 2 ++ configs/default_defconfig | 7 ++++++- core/dp/htt/htt.c | 4 ++-- core/dp/htt/htt_internal.h | 6 +++++- core/dp/htt/htt_rx_ll.c | 9 +++++---- core/dp/htt/htt_types.h | 5 +++-- 6 files changed, 23 insertions(+), 10 deletions(-) diff --git a/Kbuild b/Kbuild index df5368b57d98..a3060d27fd70 100644 --- a/Kbuild +++ b/Kbuild @@ -3152,6 +3152,8 @@ cppflags-$(CONFIG_RX_DESC_SANITY_WAR) += -DRX_DESC_SANITY_WAR cppflags-$(CONFIG_WBM_IDLE_LSB_WR_CNF_WAR) += -DWBM_IDLE_LSB_WRITE_CONFIRM_WAR cppflags-$(CONFIG_DYNAMIC_RX_AGGREGATION) += -DWLAN_FEATURE_DYNAMIC_RX_AGGREGATION +cppflags-$(CONFIG_RX_HASH_DEBUG) += -DRX_HASH_DEBUG + ifeq ($(CONFIG_QCA6290_11AX), y) cppflags-y += -DQCA_WIFI_QCA6290_11AX -DQCA_WIFI_QCA6290_11AX_MU_UL endif diff --git a/configs/default_defconfig b/configs/default_defconfig index 972e3fde34df..4d64a8146f71 100644 --- a/configs/default_defconfig +++ b/configs/default_defconfig @@ -1058,7 +1058,6 @@ endif ifneq ($(TARGET_BUILD_VARIANT),user) CONFIG_DESC_DUP_DETECT_DEBUG := y -CONFIG_DEBUG_RX_RING_BUFFER := y endif ifeq (y,$(findstring y,$(CONFIG_CNSS) $(CONFIG_CNSS_MODULE))) @@ -1128,6 +1127,12 @@ ifeq ($(CONFIG_ARCH_SDM660), y) CONFIG_WLAN_FEATURE_PKT_CAPTURE := y endif +#Enable RX RING buffers debug +CONFIG_DEBUG_RX_RING_BUFFER := y + +#Enable Hash debug +CONFIG_RX_HASH_DEBUG := y + #Enable connection manager CONFIG_CM_ENABLE := n diff --git a/core/dp/htt/htt.c b/core/dp/htt/htt.c index 14e0174e679c..566f189b8eae 100644 --- a/core/dp/htt/htt.c +++ b/core/dp/htt/htt.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2014-2019 The Linux Foundation. All rights reserved. + * Copyright (c) 2011, 2014-2019-2020 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -855,7 +855,7 @@ void htt_log_rx_ring_info(htt_pdev_handle pdev) "%s: Data Stall Detected with reason 4 (=FW_RX_REFILL_FAILED)." "src htt rx ring: space for %d elements, filled with %d buffers, buffers in the ring %d, refill debt %d", __func__, pdev->rx_ring.size, pdev->rx_ring.fill_level, - pdev->rx_ring.fill_cnt, + qdf_atomic_read(&pdev->rx_ring.fill_cnt), qdf_atomic_read(&pdev->rx_ring.refill_debt)); } diff --git a/core/dp/htt/htt_internal.h b/core/dp/htt/htt_internal.h index 6e05b2f2f357..f49dba0300ac 100644 --- a/core/dp/htt/htt_internal.h +++ b/core/dp/htt/htt_internal.h @@ -226,7 +226,11 @@ struct htt_host_rx_desc_base { * @posted: time-stamp when HTT message is recived * @recvd : 0x48545452584D5367 ('HTTRXMSG') */ +#ifdef CONFIG_SLUB_DEBUG_ON #define HTT_RX_RING_BUFF_DBG_LIST (8 * 1024) +#else +#define HTT_RX_RING_BUFF_DBG_LIST (4 * 1024) +#endif struct rx_buf_debug { qdf_dma_addr_t paddr; qdf_nbuf_t nbuf; @@ -1094,7 +1098,7 @@ static inline qdf_nbuf_t htt_rx_in_order_netbuf_pop(htt_pdev_handle pdev, qdf_dma_addr_t paddr) { HTT_ASSERT1(htt_rx_in_order_ring_elems(pdev) != 0); - pdev->rx_ring.fill_cnt--; + qdf_atomic_dec(&pdev->rx_ring.fill_cnt); paddr = htt_paddr_trim_to_37(paddr); return htt_rx_hash_list_lookup(pdev, paddr); } diff --git a/core/dp/htt/htt_rx_ll.c b/core/dp/htt/htt_rx_ll.c index 7148c9afb455..66c2f783b863 100644 --- a/core/dp/htt/htt_rx_ll.c +++ b/core/dp/htt/htt_rx_ll.c @@ -124,7 +124,7 @@ static inline qdf_nbuf_t htt_rx_netbuf_pop(htt_pdev_handle pdev) idx++; idx &= pdev->rx_ring.size_mask; pdev->rx_ring.sw_rd_idx.msdu_payld = idx; - pdev->rx_ring.fill_cnt--; + qdf_atomic_dec(&pdev->rx_ring.fill_cnt); return msdu; } @@ -483,7 +483,7 @@ moretofill: } pdev->rx_ring.buf.paddrs_ring[idx] = paddr_marked; - pdev->rx_ring.fill_cnt++; + qdf_atomic_inc(&pdev->rx_ring.fill_cnt); num--; idx++; @@ -2049,7 +2049,8 @@ void htt_rx_fill_ring_count(htt_pdev_handle pdev) { int num_to_fill; - num_to_fill = pdev->rx_ring.fill_level - pdev->rx_ring.fill_cnt; + num_to_fill = pdev->rx_ring.fill_level - + qdf_atomic_read(&pdev->rx_ring.fill_cnt); htt_rx_ring_fill_n(pdev, num_to_fill /* okay if <= 0 */); } @@ -2137,7 +2138,7 @@ int htt_rx_attach(struct htt_pdev_t *pdev) htt_rx_ring_refill_retry, (void *)pdev, QDF_TIMER_TYPE_SW); - pdev->rx_ring.fill_cnt = 0; + qdf_atomic_init(&pdev->rx_ring.fill_cnt); pdev->rx_ring.pop_fail_cnt = 0; #ifdef DEBUG_DMA_DONE pdev->rx_ring.dbg_ring_idx = 0; diff --git a/core/dp/htt/htt_types.h b/core/dp/htt/htt_types.h index 0ad01dec88b7..386d8d968cb7 100644 --- a/core/dp/htt/htt_types.h +++ b/core/dp/htt/htt_types.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2014-2018 The Linux Foundation. All rights reserved. + * Copyright (c) 2011, 2014-2018-2020 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -297,7 +297,8 @@ struct htt_pdev_t { uint32_t size_mask; /* size - 1, at least 16 bits long */ int fill_level; /* how many rx buffers to keep in the ring */ - int fill_cnt; /* # of rx buffers (full+empty) in the ring */ + /* # of rx buffers (full+empty) in the ring */ + qdf_atomic_t fill_cnt; int pop_fail_cnt; /* # of nebuf pop failures */ /*