From 3232a8d88b8aafd712c0ea28b127d59b7524d955 Mon Sep 17 00:00:00 2001 From: Nandha Kishore Easwaran Date: Mon, 23 Dec 2019 14:41:47 +0530 Subject: [PATCH] qcacmn: Process lmac rings in polled mode Add code to process lmac rings in polling. Lmac rings can be switched between polling and interrupts by using lmac_polled_mode flag in dp_soc. Change-Id: I231e906930c9b42100a2df3e52acac97deba1c34 --- dp/wifi3.0/dp_main.c | 64 +++++++++++++++++++++++++++++++++++++++++++ dp/wifi3.0/dp_types.h | 3 ++ 2 files changed, 67 insertions(+) diff --git a/dp/wifi3.0/dp_main.c b/dp/wifi3.0/dp_main.c index 67675b55ba..4046a6f562 100644 --- a/dp/wifi3.0/dp_main.c +++ b/dp/wifi3.0/dp_main.c @@ -472,6 +472,52 @@ uint32_t dp_soc_get_mon_mask_for_interrupt_mode(struct dp_soc *soc, int intr_ctx { return wlan_cfg_get_rx_mon_ring_mask(soc->wlan_cfg_ctx, intr_ctx_num); } + +/* + * dp_service_lmac_rings()- timer to reap lmac rings + * @arg: SoC Handle + * + * Return: + * + */ +static void dp_service_lmac_rings(void *arg) +{ + struct dp_soc *soc = (struct dp_soc *)arg; + int ring = 0, mac_id, i; + struct dp_pdev *pdev = NULL; + union dp_rx_desc_list_elem_t *desc_list = NULL; + union dp_rx_desc_list_elem_t *tail = NULL; + + /* Process LMAC interrupts */ + for (ring = 0 ; ring < MAX_PDEV_CNT; ring++) { + pdev = soc->pdev_list[ring]; + if (!pdev) + continue; + for (mac_id = 0; mac_id < NUM_RXDMA_RINGS_PER_PDEV; mac_id++) { + int mac_for_pdev = dp_get_mac_id_for_pdev(mac_id, + pdev->pdev_id); + struct dp_srng *rx_refill_buf_ring = + &pdev->rx_refill_buf_ring; + + dp_mon_process(soc, mac_for_pdev, + QCA_NAPI_BUDGET); + + for (i = 0; i < wlan_cfg_get_num_contexts(soc->wlan_cfg_ctx); i++) + dp_rxdma_err_process(&soc->intr_ctx[i], soc, + mac_for_pdev, + QCA_NAPI_BUDGET); + + if (!dp_soc_ring_if_nss_offloaded(soc, RXDMA_BUF, mac_id)) + dp_rx_buffers_replenish(soc, mac_for_pdev, + rx_refill_buf_ring, + &soc->rx_desc_buf[mac_for_pdev], + 0, &desc_list, &tail); + } + } + + qdf_timer_mod(&soc->lmac_reap_timer, DP_INTR_POLL_TIMER_MS); +} + #endif static int dp_peer_add_ast_wifi3(struct cdp_soc_t *soc_hdl, @@ -3762,6 +3808,11 @@ static void dp_rxdma_ring_cleanup(struct dp_soc *soc, static void dp_rxdma_ring_cleanup(struct dp_soc *soc, struct dp_pdev *pdev) { + if (soc->lmac_timer_init) { + qdf_timer_stop(&soc->lmac_reap_timer); + qdf_timer_free(&soc->lmac_reap_timer); + soc->lmac_timer_init = 0; + } } #endif @@ -4612,6 +4663,18 @@ static QDF_STATUS dp_rxdma_ring_config(struct dp_soc *soc) RXDMA_DST); } } + + /* Configure LMAC rings in Polled mode */ + if (soc->lmac_polled_mode) { + /* + * Timer to reap lmac rings. + */ + qdf_timer_init(soc->osdev, &soc->lmac_reap_timer, + dp_service_lmac_rings, (void *)soc, + QDF_TIMER_TYPE_WAKE_APPS); + soc->lmac_timer_init = 1; + qdf_timer_mod(&soc->lmac_reap_timer, DP_INTR_POLL_TIMER_MS); + } return status; } #endif @@ -10598,6 +10661,7 @@ void *dp_soc_init(struct dp_soc *dpsoc, HTC_HANDLE htc_handle, soc->hw_nac_monitor_support = 1; soc->per_tid_basize_max_tid = 8; soc->num_hw_dscp_tid_map = HAL_MAX_HW_DSCP_TID_V2_MAPS; + soc->lmac_polled_mode = 1; break; default: qdf_print("%s: Unknown tgt type %d\n", __func__, target_type); diff --git a/dp/wifi3.0/dp_types.h b/dp/wifi3.0/dp_types.h index ca8609ac30..aff0e00cb8 100644 --- a/dp/wifi3.0/dp_types.h +++ b/dp/wifi3.0/dp_types.h @@ -1115,8 +1115,11 @@ struct dp_soc { /*interrupt timer*/ qdf_timer_t mon_reap_timer; uint8_t reap_timer_init; + qdf_timer_t lmac_reap_timer; + uint8_t lmac_timer_init; qdf_timer_t int_timer; uint8_t intr_mode; + uint8_t lmac_polled_mode; qdf_list_t reo_desc_freelist; qdf_spinlock_t reo_desc_freelist_lock;