diff --git a/dp/wifi3.0/be/dp_be.c b/dp/wifi3.0/be/dp_be.c index 88650ac5fa..ccd4ff108e 100644 --- a/dp/wifi3.0/be/dp_be.c +++ b/dp/wifi3.0/be/dp_be.c @@ -37,7 +37,6 @@ static struct wlan_cfg_tcl_wbm_ring_num_map g_tcl_wbm_map_array[MAX_TCL_DATA_RIN {3, 6, HAL_BE_WBM_SW5_BM_ID, 0}, {4, 7, HAL_BE_WBM_SW6_BM_ID, 0} }; - #else #define DP_TX_VDEV_ID_CHECK_ENABLE 1 @@ -52,6 +51,10 @@ static struct wlan_cfg_tcl_wbm_ring_num_map g_tcl_wbm_map_array[MAX_TCL_DATA_RIN static void dp_soc_cfg_attach_be(struct dp_soc *soc) { + struct wlan_cfg_dp_soc_ctxt *soc_cfg_ctx = soc->wlan_cfg_ctx; + + wlan_cfg_set_rx_rel_ring_id(soc_cfg_ctx, WBM2SW_REL_ERR_RING_NUM); + soc->wlan_cfg_ctx->tcl_wbm_map_array = g_tcl_wbm_map_array; /* this is used only when dmac mode is enabled */ diff --git a/dp/wifi3.0/be/dp_be.h b/dp/wifi3.0/be/dp_be.h index 630b9e64c7..8d08698f7c 100644 --- a/dp/wifi3.0/be/dp_be.h +++ b/dp/wifi3.0/be/dp_be.h @@ -69,6 +69,13 @@ /* 4K aligned case, number of bits HW append for one PPT entry value */ #define DP_CC_PPT_ENTRY_HW_APEND_BITS_4K_ALIGNED 12 +#if defined(WLAN_MAX_PDEVS) && (WLAN_MAX_PDEVS == 1) +/* WBM2SW ring id for rx release */ +#define WBM2SW_REL_ERR_RING_NUM 3 +#else +/* WBM2SW ring id for rx release */ +#define WBM2SW_REL_ERR_RING_NUM 5 +#endif /** * struct dp_spt_page_desc - secondary page table page descriptors * @next: pointer to next linked SPT page Desc diff --git a/dp/wifi3.0/dp_main.c b/dp/wifi3.0/dp_main.c index 1aff3728dc..6980541da7 100644 --- a/dp/wifi3.0/dp_main.c +++ b/dp/wifi3.0/dp_main.c @@ -1167,11 +1167,15 @@ uint8_t *dp_srng_get_near_full_irq_mask(struct dp_soc *soc, enum hal_ring_type ring_type, int ring_num) { + struct wlan_cfg_dp_soc_ctxt *cfg_ctx = soc->wlan_cfg_ctx; + uint8_t wbm2_sw_rx_rel_ring_id; uint8_t *nf_irq_mask = NULL; switch (ring_type) { case WBM2SW_RELEASE: - if (ring_num != WBM2SW_REL_ERR_RING_NUM) { + wbm2_sw_rx_rel_ring_id = + wlan_cfg_get_rx_rel_ring_id(soc_cfg_ctx); + if (ring_num != wbm2_sw_rx_rel_ring_id) { nf_irq_mask = &soc->wlan_cfg_ctx-> int_tx_ring_near_full_irq_mask[0]; } @@ -1354,10 +1358,13 @@ static int dp_srng_calculate_msi_group(struct dp_soc *soc, struct wlan_cfg_dp_soc_ctxt *cfg_ctx = soc->wlan_cfg_ctx; uint8_t *grp_mask, *nf_irq_mask = NULL; bool nf_irq_enabled = false; + uint8_t wbm2_sw_rx_rel_ring_id; switch (ring_type) { case WBM2SW_RELEASE: - if (ring_num == WBM2SW_REL_ERR_RING_NUM) { + wbm2_sw_rx_rel_ring_id = + wlan_cfg_get_rx_rel_ring_id(cfg_ctx); + if (ring_num == wbm2_sw_rx_rel_ring_id) { /* dp_rx_wbm_err_process - soc->rx_rel_ring */ grp_mask = &cfg_ctx->int_rx_wbm_rel_ring_mask[0]; ring_num = 0; @@ -1961,11 +1968,17 @@ void *dp_srng_aligned_mem_alloc_consistent(struct dp_soc *soc, uint32_t ring_type) { - return qdf_aligned_mem_alloc_consistent(soc->osdev, &srng->alloc_size, - &srng->base_vaddr_unaligned, - &srng->base_paddr_unaligned, - &srng->base_paddr_aligned, - DP_RING_BASE_ALIGN); + void *mem; + + mem = qdf_aligned_mem_alloc_consistent(soc->osdev, &srng->alloc_size, + &srng->base_vaddr_unaligned, + &srng->base_paddr_unaligned, + &srng->base_paddr_aligned, + DP_RING_BASE_ALIGN); + if (mem) + qdf_mem_set(srng->base_vaddr_unaligned, 0, srng->alloc_size); + + return mem; } static inline void dp_srng_mem_free_consistent(struct dp_soc *soc, @@ -13070,6 +13083,7 @@ static QDF_STATUS dp_soc_srng_init(struct dp_soc *soc) { struct wlan_cfg_dp_soc_ctxt *soc_cfg_ctx; uint8_t i; + uint8_t wbm2_sw_rx_rel_ring_id; soc_cfg_ctx = soc->wlan_cfg_ctx; @@ -13125,9 +13139,10 @@ static QDF_STATUS dp_soc_srng_init(struct dp_soc *soc) WLAN_MD_DP_SRNG_REO_REINJECT, "reo_reinject_ring"); + wbm2_sw_rx_rel_ring_id = wlan_cfg_get_rx_rel_ring_id(soc_cfg_ctx); /* Rx release ring */ if (dp_srng_init(soc, &soc->rx_rel_ring, WBM2SW_RELEASE, - WBM2SW_REL_ERR_RING_NUM, 0)) { + wbm2_sw_rx_rel_ring_id, 0)) { dp_init_err("%pK: dp_srng_init failed for rx_rel_ring", soc); goto fail1; } diff --git a/dp/wifi3.0/dp_rx.c b/dp/wifi3.0/dp_rx.c index 53c0605ec0..3d2e3197a1 100644 --- a/dp/wifi3.0/dp_rx.c +++ b/dp/wifi3.0/dp_rx.c @@ -2509,7 +2509,7 @@ QDF_STATUS dp_rx_pdev_desc_pool_init(struct dp_pdev *pdev) rx_sw_desc_num = wlan_cfg_get_dp_soc_rx_sw_desc_num(soc->wlan_cfg_ctx); - rx_desc_pool->owner = DP_WBM2SW_RBM(soc->wbm_sw0_bm_id); + rx_desc_pool->owner = dp_rx_get_rx_bm_id(soc); rx_desc_pool->buf_size = RX_DATA_BUFFER_SIZE; rx_desc_pool->buf_alignment = RX_DATA_BUFFER_ALIGNMENT; /* Disable monitor dest processing via frag */ diff --git a/dp/wifi3.0/dp_rx.h b/dp/wifi3.0/dp_rx.h index b76c1b37f2..ae26107197 100644 --- a/dp/wifi3.0/dp_rx.h +++ b/dp/wifi3.0/dp_rx.h @@ -39,9 +39,6 @@ #define DP_WBM2SW_RBM(sw0_bm_id) HAL_RX_BUF_RBM_SW1_BM(sw0_bm_id) /* RBM value used for re-injecting defragmented packets into REO */ #define DP_DEFRAG_RBM(sw0_bm_id) HAL_RX_BUF_RBM_SW3_BM(sw0_bm_id) -#else -#define DP_WBM2SW_RBM(sw0_bm_id) HAL_RX_BUF_RBM_SW3_BM(sw0_bm_id) -#define DP_DEFRAG_RBM(sw0_bm_id) DP_WBM2SW_RBM(sw0_bm_id) #endif /* QCA_HOST2FW_RXBUF_RING */ #define RX_BUFFER_RESERVATION 0 @@ -2026,6 +2023,38 @@ dp_rx_is_list_ready(qdf_nbuf_t nbuf_head, } #endif +#ifdef QCA_HOST2FW_RXBUF_RING +static inline uint8_t +dp_rx_get_defrag_bm_id(struct dp_soc *soc) +{ + return DP_DEFRAG_RBM(soc->wbm_sw0_bm_id); +} + +static inline uint8_t +dp_rx_get_rx_bm_id(struct dp_soc *soc) +{ + return DP_WBM2SW_RBM(soc->wbm_sw0_bm_id); +} +#else +static inline uint8_t +dp_rx_get_rx_bm_id(struct dp_soc *soc) +{ + struct wlan_cfg_dp_soc_ctxt *cfg_ctx = soc->wlan_cfg_ctx; + uint8_t wbm2_sw_rx_rel_ring_id; + + wbm2_sw_rx_rel_ring_id = wlan_cfg_get_rx_rel_ring_id(cfg_ctx); + + return HAL_RX_BUF_RBM_SW_BM(soc->wbm_sw0_bm_id, + wbm2_sw_rx_rel_ring_id); +} + +static inline uint8_t +dp_rx_get_defrag_bm_id(struct dp_soc *soc) +{ + return dp_rx_get_rx_bm_id(soc); +} +#endif + /** * dp_rx_desc_pool_init_generic() - Generic Rx descriptors initialization * @soc: SOC handle diff --git a/dp/wifi3.0/dp_rx_defrag.c b/dp/wifi3.0/dp_rx_defrag.c index b3b19d2fee..f73c705537 100644 --- a/dp/wifi3.0/dp_rx_defrag.c +++ b/dp/wifi3.0/dp_rx_defrag.c @@ -1257,6 +1257,7 @@ static QDF_STATUS dp_rx_defrag_reo_reinject(struct dp_peer *peer, qdf_nbuf_t nbuf_head; struct rx_desc_pool *rx_desc_pool = NULL; void *buf_addr_info = HAL_RX_REO_BUF_ADDR_INFO_GET(dst_ring_desc); + uint8_t rx_defrag_rbm_id = dp_rx_get_defrag_bm_id(soc); /* do duplicate link desc address check */ dp_rx_link_desc_refill_duplicate_check( @@ -1350,7 +1351,7 @@ static QDF_STATUS dp_rx_defrag_reo_reinject(struct dp_peer *peer, } hal_rxdma_buff_addr_info_set(soc->hal_soc, msdu0, paddr, cookie, - DP_DEFRAG_RBM(soc->wbm_sw0_bm_id)); + rx_defrag_rbm_id); /* Lets fill entrance ring now !!! */ if (qdf_unlikely(hal_srng_access_start(soc->hal_soc, hal_srng))) { @@ -1362,7 +1363,7 @@ static QDF_STATUS dp_rx_defrag_reo_reinject(struct dp_peer *peer, } dp_rx_reinject_ring_record_entry(soc, paddr, cookie, - DP_DEFRAG_RBM(soc->wbm_sw0_bm_id)); + rx_defrag_rbm_id); paddr = (uint64_t)buf_info.paddr; /* buf addr */ hal_rxdma_buff_addr_info_set(soc->hal_soc, ent_ring_desc, paddr, diff --git a/dp/wifi3.0/dp_rx_err.c b/dp/wifi3.0/dp_rx_err.c index eb847c3c44..f41ae43c7a 100644 --- a/dp/wifi3.0/dp_rx_err.c +++ b/dp/wifi3.0/dp_rx_err.c @@ -2216,11 +2216,11 @@ dp_rx_err_process(struct dp_intr *int_ctx, struct dp_soc *soc, msdu_list.rbm[0]); // TODO - BE- Check if the RBM is to be checked for all chips if (qdf_unlikely((msdu_list.rbm[0] != - DP_WBM2SW_RBM(soc->wbm_sw0_bm_id)) && + dp_rx_get_rx_bm_id(soc)) && (msdu_list.rbm[0] != HAL_RX_BUF_RBM_WBM_CHIP0_IDLE_DESC_LIST) && (msdu_list.rbm[0] != - DP_DEFRAG_RBM(soc->wbm_sw0_bm_id)))) { + dp_rx_get_defrag_bm_id(soc)))) { /* TODO */ /* Call appropriate handler */ if (!wlan_cfg_get_dp_soc_nss_cfg(soc->wlan_cfg_ctx)) { diff --git a/dp/wifi3.0/dp_tx.c b/dp/wifi3.0/dp_tx.c index 3e35bd0485..a01ec6a4e2 100644 --- a/dp/wifi3.0/dp_tx.c +++ b/dp/wifi3.0/dp_tx.c @@ -4496,8 +4496,8 @@ void dp_tx_process_htt_completion(struct dp_soc *soc, goto release_tx_desc; } default: - dp_tx_comp_alert("Invalid HTT tx_status %d\n", - tx_status); + dp_tx_comp_err("Invalid HTT tx_status %d\n", + tx_status); goto release_tx_desc; } diff --git a/dp/wifi3.0/li/dp_li.c b/dp/wifi3.0/li/dp_li.c index e383549f2b..fe55bc5b37 100644 --- a/dp/wifi3.0/li/dp_li.c +++ b/dp/wifi3.0/li/dp_li.c @@ -39,7 +39,11 @@ static struct wlan_cfg_tcl_wbm_ring_num_map g_tcl_wbm_map_array[MAX_TCL_DATA_RIN static void dp_soc_cfg_attach_li(struct dp_soc *soc) { - soc->wlan_cfg_ctx->tcl_wbm_map_array = g_tcl_wbm_map_array; + struct wlan_cfg_dp_soc_ctxt *soc_cfg_ctx = soc->wlan_cfg_ctx; + + wlan_cfg_set_rx_rel_ring_id(soc_cfg_ctx, WBM2SW_REL_ERR_RING_NUM); + + soc_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) diff --git a/dp/wifi3.0/li/dp_li.h b/dp/wifi3.0/li/dp_li.h index 4edb18bde8..6ead45edcc 100644 --- a/dp/wifi3.0/li/dp_li.h +++ b/dp/wifi3.0/li/dp_li.h @@ -21,6 +21,9 @@ #include #include +/* WBM2SW ring id for rx release */ +#define WBM2SW_REL_ERR_RING_NUM 3 + /** * struct dp_soc_li - Extended DP soc for LI targets * @soc: dp soc structure diff --git a/hal/wifi3.0/be/hal_be_tx.h b/hal/wifi3.0/be/hal_be_tx.h index 414ec6665f..04c80cd664 100644 --- a/hal/wifi3.0/be/hal_be_tx.h +++ b/hal/wifi3.0/be/hal_be_tx.h @@ -602,6 +602,35 @@ hal_tx_config_rbm_mapping_be(hal_soc_handle_t hal_soc_hdl, * * Return: void */ +#ifdef DP_TX_IMPLICIT_RBM_MAPPING +static inline void +hal_tx_desc_set_buf_addr_be(hal_soc_handle_t hal_soc_hdl, void *desc, + dma_addr_t paddr, uint8_t rbm_id, + uint32_t desc_id, uint8_t type) +{ + /* Set buffer_addr_info.buffer_addr_31_0 */ + HAL_SET_FLD(desc, TCL_DATA_CMD, + BUF_ADDR_INFO_BUFFER_ADDR_31_0) = + HAL_TX_SM(TCL_DATA_CMD, BUF_ADDR_INFO_BUFFER_ADDR_31_0, paddr); + + /* Set buffer_addr_info.buffer_addr_39_32 */ + HAL_SET_FLD(desc, TCL_DATA_CMD, + BUF_ADDR_INFO_BUFFER_ADDR_39_32) |= + HAL_TX_SM(TCL_DATA_CMD, BUF_ADDR_INFO_BUFFER_ADDR_39_32, + (((uint64_t)paddr) >> 32)); + + /* Set buffer_addr_info.sw_buffer_cookie = desc_id */ + HAL_SET_FLD(desc, TCL_DATA_CMD, + BUF_ADDR_INFO_SW_BUFFER_COOKIE) |= + HAL_TX_SM(TCL_DATA_CMD, BUF_ADDR_INFO_SW_BUFFER_COOKIE, + desc_id); + + /* Set Buffer or Ext Descriptor Type */ + HAL_SET_FLD(desc, TCL_DATA_CMD, + BUF_OR_EXT_DESC_TYPE) |= + HAL_TX_SM(TCL_DATA_CMD, BUF_OR_EXT_DESC_TYPE, type); +} +#else static inline void hal_tx_desc_set_buf_addr_be(hal_soc_handle_t hal_soc_hdl, void *desc, dma_addr_t paddr, uint8_t rbm_id, @@ -635,6 +664,7 @@ hal_tx_desc_set_buf_addr_be(hal_soc_handle_t hal_soc_hdl, void *desc, BUF_OR_EXT_DESC_TYPE) |= HAL_TX_SM(TCL_DATA_CMD, BUF_OR_EXT_DESC_TYPE, type); } +#endif #ifdef HWIO_TCL_R0_VDEV_MCAST_PACKET_CTRL_MAP_n_VAL_SHFT diff --git a/hal/wifi3.0/hal_rx.h b/hal/wifi3.0/hal_rx.h index d138f0f3c0..b631a34d61 100644 --- a/hal/wifi3.0/hal_rx.h +++ b/hal/wifi3.0/hal_rx.h @@ -253,6 +253,8 @@ enum hal_rx_mpdu_desc_flags { #define HAL_RX_BUF_RBM_SW5_BM(sw0_bm_id) (sw0_bm_id + 5) #define HAL_RX_BUF_RBM_SW6_BM(sw0_bm_id) (sw0_bm_id + 6) +#define HAL_RX_BUF_RBM_SW_BM(sw0_bm_id, wbm2sw_id) (sw0_bm_id + wbm2sw_id) + #define HAL_REO_DESTINATION_RING_MSDU_COUNT_OFFSET 0x8 #define HAL_REO_DESTINATION_RING_MSDU_COUNT_LSB 0 #define HAL_REO_DESTINATION_RING_MSDU_COUNT_MASK 0x000000ff diff --git a/wlan_cfg/wlan_cfg.c b/wlan_cfg/wlan_cfg.c index 26d5f54521..1132a1a0b9 100644 --- a/wlan_cfg/wlan_cfg.c +++ b/wlan_cfg/wlan_cfg.c @@ -41,7 +41,7 @@ #define WLAN_CFG_TX_RING_MASK_0 BIT(0) #define WLAN_CFG_TX_RING_MASK_1 BIT(1) #define WLAN_CFG_TX_RING_MASK_2 BIT(2) -#define WLAN_CFG_TX_RING_MASK_3 0 +#define WLAN_CFG_TX_RING_MASK_3 BIT(3) #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) @@ -2941,3 +2941,16 @@ void wlan_cfg_set_host2txmon_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, } qdf_export_symbol(wlan_cfg_set_host2txmon_ring_mask); + +uint8_t +wlan_cfg_get_rx_rel_ring_id(struct wlan_cfg_dp_soc_ctxt *cfg) +{ + return cfg->rx_rel_wbm2sw_ring_id; +} + +void +wlan_cfg_set_rx_rel_ring_id(struct wlan_cfg_dp_soc_ctxt *cfg, + uint8_t wbm2sw_ring_id) +{ + cfg->rx_rel_wbm2sw_ring_id = wbm2sw_ring_id; +} diff --git a/wlan_cfg/wlan_cfg.h b/wlan_cfg/wlan_cfg.h index 1d2af9c97d..a0f432d6f3 100644 --- a/wlan_cfg/wlan_cfg.h +++ b/wlan_cfg/wlan_cfg.h @@ -380,6 +380,7 @@ struct wlan_cfg_dp_soc_ctxt { #endif uint32_t rx_mon_buf_ring_size; uint32_t tx_mon_buf_ring_size; + uint8_t rx_rel_wbm2sw_ring_id; }; /** @@ -1938,4 +1939,23 @@ void wlan_cfg_set_host2txmon_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, */ int wlan_cfg_get_host2txmon_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, int context); + +/* + * wlan_cfg_get_rx_rel_ring_id() - get wbm2sw ring id for Rx release ring + * @wlan_cfg_ctx - Configuration Handle + * + * Return: wbm2sw ring id + */ +uint8_t +wlan_cfg_get_rx_rel_ring_id(struct wlan_cfg_dp_soc_ctxt *cfg); + +/** + * wlan_cfg_set_rx_rel_ring_id() - set wbm2sw ring id for Rx release ring + * @cfg: soc configuration context + * + * Return: None + */ +void +wlan_cfg_set_rx_rel_ring_id(struct wlan_cfg_dp_soc_ctxt *cfg, + uint8_t wbm2sw_ring_id); #endif diff --git a/wlan_cfg/wlan_init_cfg.h b/wlan_cfg/wlan_init_cfg.h index 55a69bee5a..0eba87be2b 100644 --- a/wlan_cfg/wlan_init_cfg.h +++ b/wlan_cfg/wlan_init_cfg.h @@ -76,8 +76,6 @@ #define MAX_REO_DEST_RINGS 8 #define MAX_TCL_DATA_RINGS 5 -#define WBM2SW_REL_ERR_RING_NUM 3 - #define MAX_RX_MAC_RINGS 2 #endif /* __WLAN_INIT_CFG_H */