From e4bd6bb93911b0f3bb39c7c751c4390c62ff63fe Mon Sep 17 00:00:00 2001 From: Yeshwanth Sriram Guntuka Date: Wed, 13 Oct 2021 14:55:12 +0530 Subject: [PATCH] qcacmn: Repurpose the IPA tx ring pairs for normal use Repurpose the IPA tx and tx completions rings for normal use when IPA is disabled either via config flag or ini. Change-Id: Ia4b6a89c73d888a217bdef40e3c05435c3bb1bb2 CRs-Fixed: 3059730 --- dp/wifi3.0/dp_main.c | 7 +++ dp/wifi3.0/dp_stats.c | 33 ++----------- dp/wifi3.0/dp_tx.h | 29 ++++++++++-- dp/wifi3.0/dp_types.h | 3 ++ dp/wifi3.0/li/dp_li_tx.c | 22 +++++++++ hal/wifi3.0/qca6490/hal_6490.c | 3 +- wlan_cfg/wlan_cfg.c | 86 +++++++++++++++++++++++++++------- wlan_cfg/wlan_init_cfg.h | 5 ++ 8 files changed, 139 insertions(+), 49 deletions(-) diff --git a/dp/wifi3.0/dp_main.c b/dp/wifi3.0/dp_main.c index 117dc01cb9..9fac162be3 100644 --- a/dp/wifi3.0/dp_main.c +++ b/dp/wifi3.0/dp_main.c @@ -1,5 +1,6 @@ /* * Copyright (c) 2016-2021 The Linux Foundation. All rights reserved. + * Copyright (c) 2021 Qualcomm Innovation Center, Inc. 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 @@ -4037,6 +4038,9 @@ static bool dp_ipa_is_alt_tx_comp_ring(int index) static void dp_ipa_get_tx_ring_size(int tx_ring_num, int *tx_ipa_ring_sz, struct wlan_cfg_dp_soc_ctxt *soc_cfg_ctx) { + if (!soc_cfg_ctx->ipa_enabled) + return; + if (tx_ring_num == IPA_TCL_DATA_RING_IDX) *tx_ipa_ring_sz = wlan_cfg_ipa_tx_ring_size(soc_cfg_ctx); else if (dp_ipa_is_alt_tx_ring(tx_ring_num)) @@ -4056,6 +4060,9 @@ static void dp_ipa_get_tx_comp_ring_size(int tx_comp_ring_num, int *tx_comp_ipa_ring_sz, struct wlan_cfg_dp_soc_ctxt *soc_cfg_ctx) { + if (!soc_cfg_ctx->ipa_enabled) + return; + if (tx_comp_ring_num == IPA_TCL_DATA_RING_IDX) *tx_comp_ipa_ring_sz = wlan_cfg_ipa_tx_comp_ring_size(soc_cfg_ctx); diff --git a/dp/wifi3.0/dp_stats.c b/dp/wifi3.0/dp_stats.c index 293bee02c1..8e3d33ff0c 100644 --- a/dp/wifi3.0/dp_stats.c +++ b/dp/wifi3.0/dp_stats.c @@ -1,5 +1,6 @@ /* * Copyright (c) 2017-2021 The Linux Foundation. All rights reserved. + * Copyright (c) 2021 Qualcomm Innovation Center, Inc. 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 @@ -5970,6 +5971,9 @@ void dp_txrx_path_stats(struct dp_soc *soc) DP_PRINT_STATS("successfully transmitted: %u msdus (%llu bytes)", pdev->stats.tx.tx_success.num, pdev->stats.tx.tx_success.bytes); + for (i = 0; i < soc->num_tcl_data_rings; i++) + DP_PRINT_STATS("Enqueue to SW2TCL%u: %u", i + 1, + soc->stats.tx.tcl_enq[i]); DP_PRINT_STATS("Dropped in host:"); DP_PRINT_STATS("Total packets dropped: %u,", @@ -6469,7 +6473,6 @@ dp_print_soc_tx_stats(struct dp_soc *soc) soc->stats.tx.hp_oos2); } -#ifdef CONFIG_BERYLLIUM static int dp_fill_rx_interrupt_ctx_stats(struct dp_intr *intr_ctx, char *buf, int buf_len) @@ -6587,34 +6590,6 @@ void dp_print_soc_interrupt_stats(struct dp_soc *soc) } } -#else -void dp_print_soc_interrupt_stats(struct dp_soc *soc) -{ - int i = 0; - struct dp_intr_stats *intr_stats; - - DP_PRINT_STATS("INT: Total |txComps|reo[0] |reo[1] |reo[2] |reo[3] |mon |rx_err | wbm |reo_sta|rxdm2hst|hst2rxdm|"); - for (i = 0; i < WLAN_CFG_INT_NUM_CONTEXTS; i++) { - intr_stats = &soc->intr_ctx[i].intr_stats; - DP_PRINT_STATS("%3u[%3d]: %7u %7u %7u %7u %7u %7u %7u %7u %7u %7u %8u %8u", - i, - hif_get_int_ctx_irq_num(soc->hif_handle, i), - intr_stats->num_masks, - intr_stats->num_tx_ring_masks[0], - intr_stats->num_rx_ring_masks[0], - intr_stats->num_rx_ring_masks[1], - intr_stats->num_rx_ring_masks[2], - intr_stats->num_rx_ring_masks[3], - intr_stats->num_rx_mon_ring_masks, - intr_stats->num_rx_err_ring_masks, - intr_stats->num_rx_wbm_rel_ring_masks, - intr_stats->num_reo_status_ring_masks, - intr_stats->num_rxdma2host_ring_masks, - intr_stats->num_host2rxdma_ring_masks); - } -} -#endif - void dp_print_soc_rx_stats(struct dp_soc *soc) { diff --git a/dp/wifi3.0/dp_tx.h b/dp/wifi3.0/dp_tx.h index da3bf6c550..37270009bf 100644 --- a/dp/wifi3.0/dp_tx.h +++ b/dp/wifi3.0/dp_tx.h @@ -1,5 +1,6 @@ /* * Copyright (c) 2016-2021 The Linux Foundation. All rights reserved. + * Copyright (c) 2021 Qualcomm Innovation Center, Inc. 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 @@ -457,16 +458,38 @@ static inline hal_ring_handle_t dp_tx_get_hal_ring_hdl(struct dp_soc *soc, #else /* QCA_OL_TX_MULTIQ_SUPPORT */ +#ifdef TX_MULTI_TCL +#ifdef IPA_OFFLOAD +static inline void dp_tx_get_queue(struct dp_vdev *vdev, + qdf_nbuf_t nbuf, struct dp_tx_queue *queue) +{ + /* get flow id */ + queue->desc_pool_id = DP_TX_GET_DESC_POOL_ID(vdev); + if (vdev->pdev->soc->wlan_cfg_ctx->ipa_enabled) + queue->ring_id = DP_TX_GET_RING_ID(vdev); + else + queue->ring_id = (qdf_nbuf_get_queue_mapping(nbuf) % + vdev->pdev->soc->num_tcl_data_rings); +} +#else +static inline void dp_tx_get_queue(struct dp_vdev *vdev, + qdf_nbuf_t nbuf, struct dp_tx_queue *queue) +{ + /* get flow id */ + queue->desc_pool_id = DP_TX_GET_DESC_POOL_ID(vdev); + queue->ring_id = (qdf_nbuf_get_queue_mapping(nbuf) % + vdev->pdev->soc->num_tcl_data_rings); +} +#endif +#else static inline void dp_tx_get_queue(struct dp_vdev *vdev, qdf_nbuf_t nbuf, struct dp_tx_queue *queue) { /* get flow id */ queue->desc_pool_id = DP_TX_GET_DESC_POOL_ID(vdev); queue->ring_id = DP_TX_GET_RING_ID(vdev); - - dp_tx_debug("pool_id:%d ring_id: %d skb %pK ", - queue->desc_pool_id, queue->ring_id, nbuf); } +#endif static inline hal_ring_handle_t dp_tx_get_hal_ring_hdl(struct dp_soc *soc, uint8_t ring_id) diff --git a/dp/wifi3.0/dp_types.h b/dp/wifi3.0/dp_types.h index e813f8ddbf..c0e85411dd 100644 --- a/dp/wifi3.0/dp_types.h +++ b/dp/wifi3.0/dp_types.h @@ -1,5 +1,6 @@ /* * Copyright (c) 2016-2021 The Linux Foundation. All rights reserved. + * Copyright (c) 2021 Qualcomm Innovation Center, Inc. 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 @@ -959,6 +960,8 @@ struct dp_soc_stats { struct { /* Total packets transmitted */ struct cdp_pkt_info egress; + /* Enqueues per tcl ring */ + uint32_t tcl_enq[MAX_TCL_DATA_RINGS]; /* packets dropped on tx because of no peer */ struct cdp_pkt_info tx_invalid_peer; /* descriptors in each tcl ring */ diff --git a/dp/wifi3.0/li/dp_li_tx.c b/dp/wifi3.0/li/dp_li_tx.c index d313442cbe..d97430ed1c 100644 --- a/dp/wifi3.0/li/dp_li_tx.c +++ b/dp/wifi3.0/li/dp_li_tx.c @@ -1,5 +1,6 @@ /* * Copyright (c) 2016-2021 The Linux Foundation. All rights reserved. + * Copyright (c) 2021 Qualcomm Innovation Center, Inc. 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 @@ -78,12 +79,32 @@ static inline uint8_t dp_tx_get_rbm_id_li(struct dp_soc *soc, } #endif #else + +#ifdef TX_MULTI_TCL +#ifdef IPA_OFFLOAD +static inline uint8_t dp_tx_get_rbm_id_li(struct dp_soc *soc, + uint8_t ring_id) +{ + if (soc->wlan_cfg_ctx->ipa_enabled) + return (ring_id + soc->wbm_sw0_bm_id); + + return soc->wlan_cfg_ctx->tcl_wbm_map_array[ring_id].wbm_rbm_id; +} +#else +static inline uint8_t dp_tx_get_rbm_id_li(struct dp_soc *soc, + uint8_t ring_id) +{ + return soc->wlan_cfg_ctx->tcl_wbm_map_array[ring_id].wbm_rbm_id; +} +#endif +#else static inline uint8_t dp_tx_get_rbm_id_li(struct dp_soc *soc, uint8_t ring_id) { return (ring_id + soc->wbm_sw0_bm_id); } #endif +#endif #if defined(CLEAR_SW2TCL_CONSUMED_DESC) /** @@ -232,6 +253,7 @@ dp_tx_hw_enqueue_li(struct dp_soc *soc, struct dp_vdev *vdev, hal_tx_desc_sync(hal_tx_desc_cached, hal_tx_desc); coalesce = dp_tx_attempt_coalescing(soc, vdev, tx_desc, tid); DP_STATS_INC_PKT(vdev, tx_i.processed, 1, tx_desc->length); + DP_STATS_INC(soc, tx.tcl_enq[ring_id], 1); dp_tx_update_stats(soc, tx_desc->nbuf); status = QDF_STATUS_SUCCESS; diff --git a/hal/wifi3.0/qca6490/hal_6490.c b/hal/wifi3.0/qca6490/hal_6490.c index 5f15927644..4a67243553 100644 --- a/hal/wifi3.0/qca6490/hal_6490.c +++ b/hal/wifi3.0/qca6490/hal_6490.c @@ -1,5 +1,6 @@ /* * Copyright (c) 2019-2021 The Linux Foundation. All rights reserved. + * Copyright (c) 2021 Qualcomm Innovation Center, Inc. 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 @@ -2134,7 +2135,7 @@ struct hal_hw_srng_config hw_srng_table_6490[] = { }, { /* WBM2SW_RELEASE */ .start_ring_id = HAL_SRNG_WBM2SW0_RELEASE, -#ifdef IPA_WDI3_TX_TWO_PIPES +#if defined(IPA_WDI3_TX_TWO_PIPES) || defined(TX_MULTI_TCL) .max_rings = 5, #else .max_rings = 4, diff --git a/wlan_cfg/wlan_cfg.c b/wlan_cfg/wlan_cfg.c index 524dd0d565..e7b5d44eac 100644 --- a/wlan_cfg/wlan_cfg.c +++ b/wlan_cfg/wlan_cfg.c @@ -1,5 +1,6 @@ /* * Copyright (c) 2016-2021 The Linux Foundation. All rights reserved. + * Copyright (c) 2021 Qualcomm Innovation Center, Inc. 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 @@ -129,10 +130,45 @@ static const uint8_t tx_ring_mask_msi[WLAN_CFG_INT_NUM_CONTEXTS] = { [0] = WLAN_CFG_TX_RING_MASK_0, [1] = WLAN_CFG_TX_RING_MASK_4, [2] = WLAN_CFG_TX_RING_MASK_2, [3] = WLAN_CFG_TX_RING_MASK_6, [4] = WLAN_CFG_TX_RING_MASK_7}; -#endif +#endif /* IPA_OFFLOAD */ + +static inline const +uint8_t *wlan_cfg_get_tx_ring_int_mask(struct wlan_cfg_dp_soc_ctxt *cfg_ctx) +{ + return &tx_ring_mask_msi[0]; +} #else static const uint8_t tx_ring_mask_msi[WLAN_CFG_INT_NUM_CONTEXTS] = { - WLAN_CFG_TX_RING_MASK_0, 0, 0, 0, 0, 0, 0}; + [0] = WLAN_CFG_TX_RING_MASK_0}; + +#ifdef TX_MULTI_TCL +static const uint8_t multi_tx_ring_mask_msi[WLAN_CFG_INT_NUM_CONTEXTS] = { + [0] = WLAN_CFG_TX_RING_MASK_0, [7] = WLAN_CFG_TX_RING_MASK_2, + [8] = WLAN_CFG_TX_RING_MASK_4}; + +#ifdef IPA_OFFLOAD +static inline const +uint8_t *wlan_cfg_get_tx_ring_int_mask(struct wlan_cfg_dp_soc_ctxt *cfg_ctx) +{ + if (cfg_ctx->ipa_enabled) + return &tx_ring_mask_msi[0]; + + return &multi_tx_ring_mask_msi[0]; +} +#else +static inline const +uint8_t *wlan_cfg_get_tx_ring_int_mask(struct wlan_cfg_dp_soc_ctxt *cfg_ctx) +{ + return &multi_tx_ring_mask_msi[0]; +} +#endif /* IPA_OFFLOAD */ +#else +static inline const +uint8_t *wlan_cfg_get_tx_ring_int_mask(struct wlan_cfg_dp_soc_ctxt *cfg_ctx) +{ + return &tx_ring_mask_msi[0]; +} +#endif /* TX_MULTI_TCL */ #endif /* CONFIG_BERYLLIUM */ #ifdef CONFIG_BERYLLIUM @@ -151,12 +187,12 @@ static const uint8_t rx_ring_mask_msi[WLAN_CFG_INT_NUM_CONTEXTS] = { #else /* !defined(CONFIG_BERYLLIUM) */ #ifdef IPA_OFFLOAD static const uint8_t rx_ring_mask_msi[WLAN_CFG_INT_NUM_CONTEXTS] = { - 0, WLAN_CFG_RX_RING_MASK_0, WLAN_CFG_RX_RING_MASK_1, - WLAN_CFG_RX_RING_MASK_2, 0, 0, 0}; + [1] = WLAN_CFG_RX_RING_MASK_0, [2] = WLAN_CFG_RX_RING_MASK_1, + [3] = WLAN_CFG_RX_RING_MASK_2}; #else static const uint8_t rx_ring_mask_msi[WLAN_CFG_INT_NUM_CONTEXTS] = { - 0, WLAN_CFG_RX_RING_MASK_0, WLAN_CFG_RX_RING_MASK_1, - WLAN_CFG_RX_RING_MASK_2, WLAN_CFG_RX_RING_MASK_3, 0, 0}; + [1] = WLAN_CFG_RX_RING_MASK_0, [2] = WLAN_CFG_RX_RING_MASK_1, + [3] = WLAN_CFG_RX_RING_MASK_2, [4] = WLAN_CFG_RX_RING_MASK_3}; #endif #endif /* CONFIG_BERYLLIUM */ @@ -166,13 +202,12 @@ static const uint8_t rxdma2host_ring_mask_msi[WLAN_CFG_INT_NUM_CONTEXTS] = { WLAN_CFG_RXDMA2HOST_RING_MASK_1}; #else static const uint8_t rxdma2host_ring_mask_msi[WLAN_CFG_INT_NUM_CONTEXTS] = { - 0, 0, 0, 0, 0, WLAN_CFG_RXDMA2HOST_RING_MASK_0, - WLAN_CFG_RXDMA2HOST_RING_MASK_1}; + [5] = WLAN_CFG_RXDMA2HOST_RING_MASK_0, + [6] = WLAN_CFG_RXDMA2HOST_RING_MASK_1}; #endif /* CONFIG_BERYLLIUM */ static const uint8_t rx_mon_ring_mask_msi[WLAN_CFG_INT_NUM_CONTEXTS] = { - [1] = WLAN_CFG_RX_MON_RING_MASK_0, - [2] = WLAN_CFG_RX_MON_RING_MASK_1}; + [1] = WLAN_CFG_RX_MON_RING_MASK_0, [2] = WLAN_CFG_RX_MON_RING_MASK_1}; static const uint8_t host2rxdma_ring_mask_msi[WLAN_CFG_INT_NUM_CONTEXTS] = {0}; @@ -191,11 +226,11 @@ static const uint8_t reo_status_ring_mask_msi[WLAN_CFG_INT_NUM_CONTEXTS] = { [13] = WLAN_CFG_REO_STATUS_RING_MASK_0}; #else static const uint8_t rx_err_ring_mask_msi[WLAN_CFG_INT_NUM_CONTEXTS] = { - 0, 0, 0, 0, 0, 0, WLAN_CFG_RX_ERR_RING_MASK_0}; + [6] = WLAN_CFG_RX_ERR_RING_MASK_0}; static const uint8_t rx_wbm_rel_ring_mask_msi[WLAN_CFG_INT_NUM_CONTEXTS] = { - 0, 0, 0, 0, 0, 0, WLAN_CFG_RX_WBM_REL_RING_MASK_0}; + [6] = WLAN_CFG_RX_WBM_REL_RING_MASK_0}; static const uint8_t reo_status_ring_mask_msi[WLAN_CFG_INT_NUM_CONTEXTS] = { - 0, 0, 0, 0, 0, 0, WLAN_CFG_REO_STATUS_RING_MASK_0}; + [6] = WLAN_CFG_REO_STATUS_RING_MASK_0}; #endif #ifdef CONFIG_BERYLLIUM @@ -1462,9 +1497,11 @@ void wlan_cfg_fill_interrupt_mask(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx, int interrupt_mode, bool is_monitor_mode) { int i = 0; + const uint8_t *tx_ring_intr_mask = + wlan_cfg_get_tx_ring_int_mask(wlan_cfg_ctx); for (i = 0; i < WLAN_CFG_INT_NUM_CONTEXTS; i++) { - wlan_cfg_ctx->int_tx_ring_mask[i] = tx_ring_mask_msi[i]; + wlan_cfg_ctx->int_tx_ring_mask[i] = tx_ring_intr_mask[i]; wlan_cfg_ctx->int_rx_mon_ring_mask[i] = rx_mon_ring_mask_msi[i]; wlan_cfg_ctx->int_tx_mon_ring_mask[i] = 0; @@ -2167,7 +2204,7 @@ int wlan_cfg_per_pdev_lmac_ring(struct wlan_cfg_dp_soc_ctxt *cfg) qdf_export_symbol(wlan_cfg_per_pdev_lmac_ring); -#if defined(DP_USE_SINGLE_TCL) +#if defined(DP_USE_SINGLE_TCL) && !defined(TX_MULTI_TCL) int wlan_cfg_num_tcl_data_rings(struct wlan_cfg_dp_soc_ctxt *cfg) { return 1; @@ -2180,6 +2217,23 @@ int wlan_cfg_num_nss_tcl_data_rings(struct wlan_cfg_dp_soc_ctxt *cfg) #else +#if defined(IPA_OFFLOAD) && defined(TX_MULTI_TCL) +int wlan_cfg_num_tcl_data_rings(struct wlan_cfg_dp_soc_ctxt *cfg) +{ + if (!cfg->ipa_enabled) + return cfg->num_tcl_data_rings; + + return 1; +} + +int wlan_cfg_num_nss_tcl_data_rings(struct wlan_cfg_dp_soc_ctxt *cfg) +{ + if (!cfg->ipa_enabled) + return cfg->num_tcl_data_rings; + + return 1; +} +#else int wlan_cfg_num_tcl_data_rings(struct wlan_cfg_dp_soc_ctxt *cfg) { return cfg->num_tcl_data_rings; @@ -2189,7 +2243,7 @@ int wlan_cfg_num_nss_tcl_data_rings(struct wlan_cfg_dp_soc_ctxt *cfg) { return cfg->num_nss_tcl_data_rings; } - +#endif #endif int wlan_cfg_tx_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg) diff --git a/wlan_cfg/wlan_init_cfg.h b/wlan_cfg/wlan_init_cfg.h index 0eba87be2b..9ce84fd9fc 100644 --- a/wlan_cfg/wlan_init_cfg.h +++ b/wlan_cfg/wlan_init_cfg.h @@ -1,5 +1,6 @@ /* * Copyright (c) 2021 The Linux Foundation. All rights reserved. + * Copyright (c) 2021 Qualcomm Innovation Center, Inc. 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 @@ -32,7 +33,11 @@ #define WLAN_CFG_INT_NUM_CONTEXTS 18 #define WLAN_CFG_INT_NUM_CONTEXTS_MAX 18 #else +#if defined(TX_MULTI_TCL) +#define WLAN_CFG_INT_NUM_CONTEXTS 9 +#else #define WLAN_CFG_INT_NUM_CONTEXTS 7 +#endif #define WLAN_CFG_INT_NUM_CONTEXTS_MAX 14 #endif #define WLAN_CFG_RXDMA1_ENABLE 1