diff --git a/dp/wifi3.0/be/dp_be.c b/dp/wifi3.0/be/dp_be.c index c2169e64b2..728811da1a 100644 --- a/dp/wifi3.0/be/dp_be.c +++ b/dp/wifi3.0/be/dp_be.c @@ -23,6 +23,31 @@ #include "dp_be_rx.h" #include +#if defined(WLAN_MAX_PDEVS) && (WLAN_MAX_PDEVS == 1) +static struct wlan_cfg_tcl_wbm_ring_num_map g_tcl_wbm_map_array[MAX_TCL_DATA_RINGS] = { + {.tcl_ring_num = 0, .wbm_ring_num = 0, .wbm_rbm_id = HAL_BE_WBM_SW0_BM_ID, .for_ipa = 0}, + {1, 4, HAL_BE_WBM_SW4_BM_ID, 0}, + {2, 2, HAL_BE_WBM_SW2_BM_ID, 0}, + {3, 6, HAL_BE_WBM_SW5_BM_ID, 0}, + {4, 7, HAL_BE_WBM_SW6_BM_ID, 0} +}; + +#else + +static struct wlan_cfg_tcl_wbm_ring_num_map g_tcl_wbm_map_array[MAX_TCL_DATA_RINGS] = { + {.tcl_ring_num = 0, .wbm_ring_num = 0, .wbm_rbm_id = HAL_BE_WBM_SW0_BM_ID, .for_ipa = 0}, + {1, 1, HAL_BE_WBM_SW1_BM_ID, 0}, + {2, 2, HAL_BE_WBM_SW2_BM_ID, 0}, + {3, 3, HAL_BE_WBM_SW3_BM_ID, 0}, + {4, 4, HAL_BE_WBM_SW4_BM_ID, 0} +}; +#endif + +static void dp_soc_cfg_attach_be(struct dp_soc *soc) +{ + soc->wlan_cfg_ctx->tcl_wbm_map_array = g_tcl_wbm_map_array; +} + qdf_size_t dp_get_context_size_be(enum dp_context_type context_type) { switch (context_type) { @@ -714,6 +739,7 @@ void dp_initialize_arch_ops_be(struct dp_arch_ops *arch_ops) arch_ops->txrx_vdev_attach = dp_vdev_attach_be; arch_ops->txrx_vdev_detach = dp_vdev_detach_be; arch_ops->dp_rxdma_ring_sel_cfg = dp_rxdma_ring_sel_cfg_be; + arch_ops->soc_cfg_attach = dp_soc_cfg_attach_be; dp_init_near_full_arch_ops_be(arch_ops); } diff --git a/dp/wifi3.0/be/dp_be_tx.c b/dp/wifi3.0/be/dp_be_tx.c index 3c291a88aa..f20315d0f9 100644 --- a/dp/wifi3.0/be/dp_be_tx.c +++ b/dp/wifi3.0/be/dp_be_tx.c @@ -85,14 +85,12 @@ static inline uint8_t dp_tx_get_rbm_id_be(struct dp_soc *soc, #else static inline uint8_t dp_tx_get_rbm_id_be(struct dp_soc *soc, - uint8_t ring_id) + uint8_t tcl_index) { - uint8_t wbm_ring_id, rbm; + uint8_t rbm; - wbm_ring_id = wlan_cfg_get_wbm_ring_num_for_index(ring_id); - rbm = wbm_ring_id + soc->wbm_sw0_bm_id; - dp_debug("ring_id %u wbm ring num %u rbm %u", - ring_id, wbm_ring_id, rbm); + rbm = wlan_cfg_get_rbm_id_for_index(soc->wlan_cfg_ctx, tcl_index); + dp_verbose_debug("tcl_id %u rbm %u", tcl_index, rbm); return rbm; } #endif diff --git a/dp/wifi3.0/dp_main.c b/dp/wifi3.0/dp_main.c index b39e78d2ee..2e34d8d770 100644 --- a/dp/wifi3.0/dp_main.c +++ b/dp/wifi3.0/dp_main.c @@ -2340,8 +2340,7 @@ static uint32_t dp_service_srngs(void *dp_ctx, uint32_t dp_budget) /* Process Tx completion interrupts first to return back buffers */ for (index = 0; index < soc->num_tcl_data_rings; index++) { - if (!((1 << wlan_cfg_get_wbm_ring_num_for_index(index)) & - tx_mask)) + if (!(1 << wlan_cfg_get_wbm_ring_num_for_index(soc->wlan_cfg_ctx, index) & tx_mask)) continue; work_done = dp_tx_comp_handler(int_ctx, soc, @@ -4200,7 +4199,8 @@ static void dp_deinit_tx_pair_by_index(struct dp_soc *soc, int index) { int tcl_ring_num, wbm_ring_num; - wlan_cfg_get_tcl_wbm_ring_num_for_index(index, + wlan_cfg_get_tcl_wbm_ring_num_for_index(soc->wlan_cfg_ctx, + index, &tcl_ring_num, &wbm_ring_num); @@ -4246,7 +4246,8 @@ static QDF_STATUS dp_init_tx_ring_pair_by_index(struct dp_soc *soc, goto fail1; } - wlan_cfg_get_tcl_wbm_ring_num_for_index(index, + wlan_cfg_get_tcl_wbm_ring_num_for_index(soc->wlan_cfg_ctx, + index, &tcl_ring_num, &wbm_ring_num); @@ -13047,6 +13048,8 @@ static void dp_soc_cfg_attach(struct dp_soc *soc) soc->num_reo_dest_rings = wlan_cfg_num_reo_dest_rings(soc->wlan_cfg_ctx); } + + soc->arch_ops.soc_cfg_attach(soc); } static inline void dp_pdev_set_default_reo(struct dp_pdev *pdev) diff --git a/dp/wifi3.0/dp_types.h b/dp/wifi3.0/dp_types.h index c7362201a3..f906de06e1 100644 --- a/dp/wifi3.0/dp_types.h +++ b/dp/wifi3.0/dp_types.h @@ -1569,6 +1569,7 @@ struct dp_arch_ops { QDF_STATUS (*txrx_vdev_detach)(struct dp_soc *soc, struct dp_vdev *vdev); QDF_STATUS (*dp_rxdma_ring_sel_cfg)(struct dp_soc *soc); + void (*soc_cfg_attach)(struct dp_soc *soc); /* TX RX Arch Ops */ QDF_STATUS (*tx_hw_enqueue)(struct dp_soc *soc, struct dp_vdev *vdev, diff --git a/dp/wifi3.0/li/dp_li.c b/dp/wifi3.0/li/dp_li.c index 3a77da6726..7c1359cf05 100644 --- a/dp/wifi3.0/li/dp_li.c +++ b/dp/wifi3.0/li/dp_li.c @@ -23,6 +23,24 @@ #include "dp_li_tx.h" #include "dp_li_rx.h" +#if defined(WLAN_MAX_PDEVS) && (WLAN_MAX_PDEVS == 1) +static struct wlan_cfg_tcl_wbm_ring_num_map g_tcl_wbm_map_array[MAX_TCL_DATA_RINGS] = { + {.tcl_ring_num = 0, .wbm_ring_num = 0, .wbm_rbm_id = HAL_LI_WBM_SW0_BM_ID, .for_ipa = 0}, + {1, 4, HAL_LI_WBM_SW4_BM_ID, 1}, /* For IPA */ + {2, 2, HAL_LI_WBM_SW2_BM_ID, 1} /* For IPA */}; +#else +static struct wlan_cfg_tcl_wbm_ring_num_map g_tcl_wbm_map_array[MAX_TCL_DATA_RINGS] = { + {.tcl_ring_num = 0, .wbm_ring_num = 0, .wbm_rbm_id = HAL_LI_WBM_SW0_BM_ID, .for_ipa = 0}, + {1, 1, HAL_LI_WBM_SW1_BM_ID, 0}, + {2, 2, HAL_LI_WBM_SW2_BM_ID, 0} +}; +#endif + +static void dp_soc_cfg_attach_li(struct dp_soc *soc) +{ + soc->wlan_cfg_ctx->tcl_wbm_map_array = g_tcl_wbm_map_array; +} + qdf_size_t dp_get_context_size_li(enum dp_context_type context_type) { switch (context_type) { @@ -285,5 +303,6 @@ void dp_initialize_arch_ops_li(struct dp_arch_ops *arch_ops) dp_rx_desc_cookie_2_va_li; arch_ops->dp_rxdma_ring_sel_cfg = dp_rxdma_ring_sel_cfg_li; + arch_ops->soc_cfg_attach = dp_soc_cfg_attach_li; } diff --git a/hal/wifi3.0/li/hal_li_tx.h b/hal/wifi3.0/li/hal_li_tx.h index 6cf7e6dc8a..80e43646f1 100644 --- a/hal/wifi3.0/li/hal_li_tx.h +++ b/hal/wifi3.0/li/hal_li_tx.h @@ -24,9 +24,7 @@ enum hal_li_tx_ret_buf_manager { HAL_LI_WBM_SW1_BM_ID = 4, HAL_LI_WBM_SW2_BM_ID = 5, HAL_LI_WBM_SW3_BM_ID = 6, -#ifdef IPA_WDI3_TX_TWO_PIPES HAL_LI_WBM_SW4_BM_ID = 7, -#endif }; /*--------------------------------------------------------------------------- diff --git a/hal/wifi3.0/wcn7850/hal_7850.c b/hal/wifi3.0/wcn7850/hal_7850.c index 8aa2ed7bec..3cc4b0e530 100644 --- a/hal/wifi3.0/wcn7850/hal_7850.c +++ b/hal/wifi3.0/wcn7850/hal_7850.c @@ -1782,7 +1782,7 @@ struct hal_hw_srng_config hw_srng_table_7850[] = { }, { /* WBM2SW_RELEASE */ .start_ring_id = HAL_SRNG_WBM2SW0_RELEASE, - .max_rings = 7, + .max_rings = 8, .entry_size = sizeof(struct wbm_release_ring) >> 2, .lmac_ring = FALSE, .ring_dir = HAL_SRNG_DST_RING, diff --git a/wlan_cfg/wlan_cfg.c b/wlan_cfg/wlan_cfg.c index a8a21078c1..a8fcdba232 100644 --- a/wlan_cfg/wlan_cfg.c +++ b/wlan_cfg/wlan_cfg.c @@ -45,6 +45,8 @@ #define WLAN_CFG_TX_RING_MASK_4 BIT(4) #define WLAN_CFG_TX_RING_MASK_5 BIT(5) #define WLAN_CFG_TX_RING_MASK_6 BIT(6) +#define WLAN_CFG_TX_RING_MASK_7 BIT(7) + #define WLAN_CFG_RX_MON_RING_MASK_0 0x1 #define WLAN_CFG_RX_MON_RING_MASK_1 0x2 @@ -112,13 +114,13 @@ struct dp_int_mask_assignment { #ifdef CONFIG_BERYLLIUM #ifdef IPA_OFFLOAD 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_5, - [2] = WLAN_CFG_TX_RING_MASK_6}; + [0] = WLAN_CFG_TX_RING_MASK_0, [1] = WLAN_CFG_TX_RING_MASK_6, + [2] = WLAN_CFG_TX_RING_MASK_7}; #else 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_5, - [4] = WLAN_CFG_TX_RING_MASK_6}; + [2] = WLAN_CFG_TX_RING_MASK_2, [3] = WLAN_CFG_TX_RING_MASK_6, + [4] = WLAN_CFG_TX_RING_MASK_7}; #endif #else static const uint8_t tx_ring_mask_msi[WLAN_CFG_INT_NUM_CONTEXTS] = { @@ -213,32 +215,6 @@ static const uint8_t tx_ring_near_full_irq_mask_msi[WLAN_CFG_INT_NUM_CONTEXTS] = 0 }; #endif -#ifdef CONFIG_BERYLLIUM -#ifdef IPA_OFFLOAD -struct wlan_cfg_tcl_wbm_ring_num_map tcl_wbm_map_array[MAX_TCL_DATA_RINGS] = { - {.tcl_ring_num = 0, .wbm_ring_num = 0, .for_ipa = 0}, - {1, 4, 1}, /* For IPA */ - {2, 2, 1}, /* For IPA */ - {3, 5, 0}, - {4, 6, 0}, -}; -#else -struct wlan_cfg_tcl_wbm_ring_num_map tcl_wbm_map_array[MAX_TCL_DATA_RINGS] = { - {.tcl_ring_num = 0, .wbm_ring_num = 0, .for_ipa = 0}, - {1, 4, 0}, - {2, 2, 0}, - {3, 5, 0}, - {4, 6, 0}, -}; -#endif /* IPA_OFFLOAD */ -#else -struct wlan_cfg_tcl_wbm_ring_num_map tcl_wbm_map_array[MAX_TCL_DATA_RINGS] = { - {.tcl_ring_num = 0, .wbm_ring_num = 0, .for_ipa = 0}, - {1, 4, 1}, /* For IPA */ - {2, 2, 1}, /* For IPA */ -}; -#endif - #else /* Integrated configuration + 8 possible MSI configurations */ #define NUM_INTERRUPT_COMBINATIONS 9 @@ -826,14 +802,6 @@ static struct dp_int_mask_assignment dp_mask_assignment[NUM_INTERRUPT_COMBINATIO 0, 0, 0, 0}, }, }; - -struct wlan_cfg_tcl_wbm_ring_num_map tcl_wbm_map_array[MAX_TCL_DATA_RINGS] = { - {0, 0, 0}, - {1, 1, 0}, - {2, 2, 0}, - {3, 3, 0}, - {4, 4, 0}, -}; #endif /** @@ -1486,12 +1454,6 @@ int wlan_cfg_get_tx_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, int context) return cfg->int_tx_ring_mask[context]; } -void wlan_cfg_get_tcl_wbm_ring_num_for_index(int index, int *tcl, int *wbm) -{ - *tcl = tcl_wbm_map_array[index].tcl_ring_num; - *wbm = tcl_wbm_map_array[index].wbm_ring_num; -} - int wlan_cfg_get_rx_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, int context) { return cfg->int_rx_ring_mask[context]; diff --git a/wlan_cfg/wlan_cfg.h b/wlan_cfg/wlan_cfg.h index d011f87059..88ddd809c1 100644 --- a/wlan_cfg/wlan_cfg.h +++ b/wlan_cfg/wlan_cfg.h @@ -88,6 +88,20 @@ struct wlan_cfg_dp_pdev_ctxt; +/** + * struct wlan_cfg_tcl_wbm_ring_num_map - TCL WBM Ring number mapping + * @tcl_ring_num - TCL Ring number + * @wbm_ring_num - WBM Ring number + * @wbm_ring_num - WBM RBM ID to be used when enqueuing to TCL + * @for_ipa - whether this TCL/WBM for IPA use or not + */ +struct wlan_cfg_tcl_wbm_ring_num_map { + uint8_t tcl_ring_num; + uint8_t wbm_ring_num; + uint8_t wbm_rbm_id; + uint8_t for_ipa; +}; + /** * struct wlan_srng_cfg - Per ring configuration parameters * @timer_threshold: Config to control interrupts based on timer duration @@ -208,6 +222,8 @@ struct wlan_srng_cfg { * @wow_check_rx_pending_enable: Enable RX frame pending check in WoW * @ipa_tx_ring_size: IPA tx ring size * @ipa_tx_comp_ring_size: IPA tx completion ring size + * @hw_cc_conv_enabled: cookie conversion enabled + * @tcl_wbm_map_array: TCL-WBM map array */ struct wlan_cfg_dp_soc_ctxt { int num_int_ctxts; @@ -337,6 +353,7 @@ struct wlan_cfg_dp_soc_ctxt { uint32_t ipa_tx_comp_ring_size; #endif bool hw_cc_enabled; + struct wlan_cfg_tcl_wbm_ring_num_map *tcl_wbm_map_array; }; /** @@ -357,18 +374,6 @@ struct wlan_cfg_dp_pdev_ctxt { int nss_enabled; }; -/** - * struct wlan_cfg_tcl_wbm_ring_num_map - TCL WBM Ring number mapping - * @tcl_ring_num - TCL Ring number - * @wbm_ring_num - WBM Ring number - * @for_ipa - whether this TCL/WBM for IPA use or not - */ -struct wlan_cfg_tcl_wbm_ring_num_map { - uint8_t tcl_ring_num; - uint8_t wbm_ring_num; - uint8_t for_ipa; -}; - /** * wlan_cfg_soc_attach() - Attach configuration interface for SoC * @ctrl_obj - PSOC object @@ -479,8 +484,10 @@ int wlan_cfg_get_num_contexts(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx); */ int wlan_cfg_get_tx_ring_mask(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx, int context); + /** * wlan_cfg_get_tcl_wbm_ring_num_for_index() - Get TCL/WBM ring number for index + * @wlan_cfg_ctx - Configuration Handle * @index: index for which TCL/WBM ring numbers are needed * @tcl: pointer to TCL ring number, to be filled * @wbm: pointer to WBM ring number to be filled @@ -493,19 +500,45 @@ int wlan_cfg_get_tx_ring_mask(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx, * * Return: None */ -void wlan_cfg_get_tcl_wbm_ring_num_for_index(int index, int *tcl, int *wbm); +static inline +void wlan_cfg_get_tcl_wbm_ring_num_for_index(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx, + int index, int *tcl, int *wbm) +{ + *tcl = wlan_cfg_ctx->tcl_wbm_map_array[index].tcl_ring_num; + *wbm = wlan_cfg_ctx->tcl_wbm_map_array[index].wbm_ring_num; +} /** * wlan_cfg_get_wbm_ring_num_for_index() - Get WBM ring number for index + * @wlan_cfg_ctx - Configuration Handle * @index: index for which WBM ring numbers is needed * * Return: WBM Ring number for the index */ static inline -int wlan_cfg_get_wbm_ring_num_for_index(int index) +int wlan_cfg_get_wbm_ring_num_for_index(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx, + int index) { - extern struct wlan_cfg_tcl_wbm_ring_num_map tcl_wbm_map_array[MAX_TCL_DATA_RINGS]; - return tcl_wbm_map_array[index].wbm_ring_num; + return wlan_cfg_ctx->tcl_wbm_map_array[index].wbm_ring_num; +} + +/** + * wlan_cfg_get_rbm_id_for_index() - Get WBM RBM ID for TX ring index + * @wlan_cfg_ctx - Configuration Handle + * @index: TCL index for which WBM rbm value is needed + * + * The function fills in wbm rbm value corresponding to a TX ring index in + * soc->tcl_data_ring. This is needed since WBM ring numbers donot map + * sequentially to wbm rbm values. + * The function returns rbm id values as stored in tcl_wbm_map_array global + * array. + * + * Return: WBM rbm value corresnponding to TX ring index + */ +static inline +int wlan_cfg_get_rbm_id_for_index(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx, int index) +{ + return wlan_cfg_ctx->tcl_wbm_map_array[index].wbm_rbm_id; } /**