From 2989d9b1fc1d2ebceb099146cd891999564938f1 Mon Sep 17 00:00:00 2001 From: Rakesh Pillai Date: Wed, 2 Dec 2020 18:57:50 +0530 Subject: [PATCH] qcacmn: Add CDP API to dump srng SW hp-tp info Add CDP API to dump the SW head pointer and tail pointer of a few important srngs. This can be used to debug or get a direction when the device doesn't dump ram info. dp_print_ring_stat_from_hal is not being used, since without device force wake recipe in place, reading hardware hp/tp value can lead to NOC errors. Change-Id: Ib0381acb007f1b4431f6a02cd9762e461d6393e8 CRs-Fixed: 2826084 --- dp/inc/cdp_txrx_misc.h | 19 ++++++++++++++++++ dp/inc/cdp_txrx_ops.h | 2 ++ dp/wifi3.0/dp_main.c | 45 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 66 insertions(+) diff --git a/dp/inc/cdp_txrx_misc.h b/dp/inc/cdp_txrx_misc.h index 0adb23947b..16d034077c 100644 --- a/dp/inc/cdp_txrx_misc.h +++ b/dp/inc/cdp_txrx_misc.h @@ -863,4 +863,23 @@ cdp_soc_is_swlm_enabled(ol_txrx_soc_handle soc) return 0; } + +/** + * cdp_display_txrx_hw_info() - Dump the DP rings info + * @soc: soc handle + * + * Return: none + */ +static inline void +cdp_display_txrx_hw_info(ol_txrx_soc_handle soc) +{ + if (!soc || !soc->ops || !soc->ops->misc_ops) { + QDF_TRACE(QDF_MODULE_ID_CDP, QDF_TRACE_LEVEL_DEBUG, + "%s: Invalid Instance:", __func__); + return; + } + + if (soc->ops->misc_ops->display_txrx_hw_info) + return soc->ops->misc_ops->display_txrx_hw_info(soc); +} #endif /* _CDP_TXRX_MISC_H_ */ diff --git a/dp/inc/cdp_txrx_ops.h b/dp/inc/cdp_txrx_ops.h index 0c01400345..cd9a4e295a 100644 --- a/dp/inc/cdp_txrx_ops.h +++ b/dp/inc/cdp_txrx_ops.h @@ -1190,6 +1190,7 @@ struct ol_if_ops { * for this particular vdev. * @set_swlm_enable: Enable or Disable Software Latency Manager. * @is_swlm_enabled: Check if Software latency manager is enabled or not. + * @display_txrx_hw_info: Dump the DP rings info * * Function pointers for miscellaneous soc/pdev/vdev related operations. */ @@ -1278,6 +1279,7 @@ struct cdp_misc_ops { QDF_STATUS (*set_swlm_enable)(struct cdp_soc_t *soc_hdl, uint8_t val); uint8_t (*is_swlm_enabled)(struct cdp_soc_t *soc_hdl); + void (*display_txrx_hw_info)(struct cdp_soc_t *soc_hdl); }; /** diff --git a/dp/wifi3.0/dp_main.c b/dp/wifi3.0/dp_main.c index 7eec7cb9ac..1819225770 100644 --- a/dp/wifi3.0/dp_main.c +++ b/dp/wifi3.0/dp_main.c @@ -10156,6 +10156,50 @@ static uint8_t dp_soc_is_swlm_enabled(struct cdp_soc_t *soc_hdl) } #endif +/** + * dp_display_srng_info() - Dump the srng HP TP info + * @soc_hdl: CDP Soc handle + * + * This function dumps the SW hp/tp values for the important rings. + * HW hp/tp values are not being dumped, since it can lead to + * READ NOC error when UMAC is in low power state. MCC does not have + * device force wake working yet. + * + * Return: none + */ +static void dp_display_srng_info(struct cdp_soc_t *soc_hdl) +{ + struct dp_soc *soc = cdp_soc_t_to_dp_soc(soc_hdl); + hal_soc_handle_t hal_soc = soc->hal_soc; + uint32_t hp, tp, i; + + dp_info("SRNG HP-TP data:"); + for (i = 0; i < soc->num_tcl_data_rings; i++) { + hal_get_sw_hptp(hal_soc, soc->tcl_data_ring[i].hal_srng, + &hp, &tp); + dp_info("TCL DATA ring[%d]: hp=0x%x, tp=0x%x", i, hp, tp); + + hal_get_sw_hptp(hal_soc, soc->tx_comp_ring[i].hal_srng, + &hp, &tp); + dp_info("TX comp ring[%d]: hp=0x%x, tp=0x%x", i, hp, tp); + } + + for (i = 0; i < soc->num_reo_dest_rings; i++) { + hal_get_sw_hptp(hal_soc, soc->reo_dest_ring[i].hal_srng, + &hp, &tp); + dp_info("REO DST ring[%d]: hp=0x%x, tp=0x%x", i, hp, tp); + } + + hal_get_sw_hptp(hal_soc, soc->reo_exception_ring.hal_srng, &hp, &tp); + dp_info("REO exception ring: hp=0x%x, tp=0x%x", hp, tp); + + hal_get_sw_hptp(hal_soc, soc->rx_rel_ring.hal_srng, &hp, &tp); + dp_info("WBM RX release ring: hp=0x%x, tp=0x%x", hp, tp); + + hal_get_sw_hptp(hal_soc, soc->wbm_desc_rel_ring.hal_srng, &hp, &tp); + dp_info("WBM desc release ring: hp=0x%x, tp=0x%x", hp, tp); +} + /** * dp_soc_get_dp_txrx_handle() - get context for external-dp from dp soc * @soc_handle: datapath soc handle @@ -11549,6 +11593,7 @@ static struct cdp_misc_ops dp_ops_misc = { .set_swlm_enable = dp_soc_set_swlm_enable, .is_swlm_enabled = dp_soc_is_swlm_enabled, #endif + .display_txrx_hw_info = dp_display_srng_info, }; #endif