From 3e8172d58b8e9bbe82c454631a27abaff6cbb99a Mon Sep 17 00:00:00 2001 From: Nandha Kishore Easwaran Date: Mon, 18 May 2020 21:13:46 +0530 Subject: [PATCH] qcacmn: Set low threshold for monitor ring Configure low threshold for monitor ring only when monitor vap is created. This is needed to avoid spurious low threshold interrupts on monitor ring since the low threshold condition always evaluates to true. Change-Id: I452c0ada84e0a4f18e410c865d8a6a7f50329aef --- dp/wifi3.0/dp_main.c | 18 +++++++++++++++--- hal/wifi3.0/hal_api.h | 3 +++ hal/wifi3.0/hal_srng.c | 9 +++++++++ 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/dp/wifi3.0/dp_main.c b/dp/wifi3.0/dp_main.c index baef280d03..940d30eeb6 100644 --- a/dp/wifi3.0/dp_main.c +++ b/dp/wifi3.0/dp_main.c @@ -1374,9 +1374,8 @@ dp_srng_configure_interrupt_thresholds(struct dp_soc *soc, /* During initialisation monitor rings are only filled with * MON_BUF_MIN_ENTRIES entries. So low threshold needs to be set to - * a value less than that. Once HTT dynamic config of ring threshold - * setting is enabled, then the low threshold updated should be - * adjusted accrodingly. + * a value less than that. Low threshold value is reconfigured again + * to 1/8th of the ring size when monitor vap is created. */ if (ring_type == RXDMA_MONITOR_BUF) ring_params->low_threshold = MON_BUF_MIN_ENTRIES >> 1; @@ -6461,6 +6460,8 @@ static QDF_STATUS dp_vdev_set_monitor_mode(struct cdp_soc_t *soc, uint32_t mac_id; uint32_t mac_for_pdev; struct dp_pdev *pdev; + uint32_t num_entries; + struct dp_srng *mon_buf_ring; struct dp_vdev *vdev = dp_get_vdev_from_soc_vdev_id_wifi3((struct dp_soc *)soc, vdev_id); @@ -6499,6 +6500,17 @@ static QDF_STATUS dp_vdev_set_monitor_mode(struct cdp_soc_t *soc, pdev->pdev_id); dp_rx_pdev_mon_buf_buffers_alloc(pdev, mac_for_pdev, FALSE); + /* + * Configure low interrupt threshld when monitor mode is + * configured. + */ + mon_buf_ring = &pdev->soc->rxdma_mon_buf_ring[mac_for_pdev]; + num_entries = mon_buf_ring->num_entries; + hal_set_low_threshold(pdev->soc->rxdma_mon_buf_ring[mac_for_pdev].hal_srng, + num_entries >> 3); + htt_srng_setup(pdev->soc->htt_handle, pdev->pdev_id, + pdev->soc->rxdma_mon_buf_ring[mac_for_pdev] + .hal_srng, RXDMA_MONITOR_BUF); } dp_soc_config_full_mon_mode(pdev, DP_FULL_MON_ENABLE); diff --git a/hal/wifi3.0/hal_api.h b/hal/wifi3.0/hal_api.h index ebca5fc869..1406a906a7 100644 --- a/hal/wifi3.0/hal_api.h +++ b/hal/wifi3.0/hal_api.h @@ -686,6 +686,9 @@ extern uint32_t hal_srng_get_entrysize(void *hal_soc, int ring_type); */ uint32_t hal_srng_max_entries(void *hal_soc, int ring_type); +void hal_set_low_threshold(hal_ring_handle_t hal_ring_hdl, + uint32_t low_threshold); + /** * hal_srng_dump - Dump ring status * @srng: hal srng pointer diff --git a/hal/wifi3.0/hal_srng.c b/hal/wifi3.0/hal_srng.c index 969bd601b8..1e9b403075 100644 --- a/hal/wifi3.0/hal_srng.c +++ b/hal/wifi3.0/hal_srng.c @@ -1300,6 +1300,15 @@ extern void hal_get_srng_params(hal_soc_handle_t hal_soc_hdl, } qdf_export_symbol(hal_get_srng_params); +void hal_set_low_threshold(hal_ring_handle_t hal_ring_hdl, + uint32_t low_threshold) +{ + struct hal_srng *srng = (struct hal_srng *)hal_ring_hdl; + srng->u.src_ring.low_threshold = low_threshold * srng->entry_size; +} +qdf_export_symbol(hal_set_low_threshold); + + #ifdef FORCE_WAKE void hal_set_init_phase(hal_soc_handle_t soc, bool init_phase) {