diff --git a/drivers/net/wireless/ath/ath12k/core.c b/drivers/net/wireless/ath/ath12k/core.c index dd20433855f83..61c382c5f74de 100644 --- a/drivers/net/wireless/ath/ath12k/core.c +++ b/drivers/net/wireless/ath/ath12k/core.c @@ -52,6 +52,8 @@ ath12k_mem_profile_based_param ath12k_mem_profile_based_param[] = { .rxdma_monitor_dst_ring_size = 8192, .num_pool_tx_desc = 32768, .rx_desc_count = 12288, + .rx_release_ring_size = 16384, + .rxdma_buf_ring_size = 8192, }, }, [ATH12K_QMI_MEMORY_MODE_LOW_512_M] = { @@ -65,6 +67,8 @@ ath12k_mem_profile_based_param ath12k_mem_profile_based_param[] = { .rxdma_monitor_dst_ring_size = 512, .num_pool_tx_desc = 16384, .rx_desc_count = 6144, + .rx_release_ring_size = 8192, + .rxdma_buf_ring_size = 4096, }, }, }; diff --git a/drivers/net/wireless/ath/ath12k/core.h b/drivers/net/wireless/ath/ath12k/core.h index f28d2e90b67b2..c8bd7fe30f54e 100644 --- a/drivers/net/wireless/ath/ath12k/core.h +++ b/drivers/net/wireless/ath/ath12k/core.h @@ -936,14 +936,6 @@ struct ath12k_wsi_info { u32 hw_link_id_base; }; -struct ath12k_dp_profile_params { - u32 tx_comp_ring_size; - u32 rxdma_monitor_buf_ring_size; - u32 rxdma_monitor_dst_ring_size; - u32 num_pool_tx_desc; - u32 rx_desc_count; -}; - struct ath12k_mem_profile_based_param { u32 num_vdevs; u32 max_client_single; diff --git a/drivers/net/wireless/ath/ath12k/dp.c b/drivers/net/wireless/ath/ath12k/dp.c index 107feeb07a636..ae74089f10917 100644 --- a/drivers/net/wireless/ath/ath12k/dp.c +++ b/drivers/net/wireless/ath/ath12k/dp.c @@ -440,6 +440,7 @@ static void ath12k_dp_srng_common_cleanup(struct ath12k_base *ab) static int ath12k_dp_srng_common_setup(struct ath12k_base *ab) { + const struct ath12k_dp_profile_params *dp_params = &ab->profile_param->dp_params; struct ath12k_dp *dp = ath12k_ab_to_dp(ab); const struct ath12k_hal_tcl_to_wbm_rbm_map *map; struct hal_srng *srng; @@ -470,7 +471,7 @@ static int ath12k_dp_srng_common_setup(struct ath12k_base *ab) ret = ath12k_dp_srng_setup(ab, &dp->tx_ring[i].tcl_comp_ring, HAL_WBM2SW_RELEASE, tx_comp_ring_num, 0, - DP_TX_COMP_RING_SIZE(ab)); + ath12k_dp_tx_comp_ring_size(dp_params)); if (ret) { ath12k_warn(ab, "failed to set up tcl_comp ring (%d) :%d\n", tx_comp_ring_num, ret); @@ -488,7 +489,7 @@ static int ath12k_dp_srng_common_setup(struct ath12k_base *ab) ret = ath12k_dp_srng_setup(ab, &dp->rx_rel_ring, HAL_WBM2SW_RELEASE, HAL_WBM2SW_REL_ERR_RING_NUM, 0, - DP_RX_RELEASE_RING_SIZE); + ath12k_dp_rx_release_ring_size(dp_params)); if (ret) { ath12k_warn(ab, "failed to set up rx_rel ring :%d\n", ret); goto err; @@ -967,14 +968,15 @@ void ath12k_dp_vdev_tx_attach(struct ath12k *ar, struct ath12k_link_vif *arvif) static void ath12k_dp_cc_cleanup(struct ath12k_base *ab) { - struct ath12k_rx_desc_info *desc_info; + const struct ath12k_dp_profile_params *dp_params = &ab->profile_param->dp_params; + u32 pool_id, tx_spt_page, tx_spt_pages_per_pool, num_rx_spt_pages; struct ath12k_tx_desc_info *tx_desc_info, *tmp1; struct ath12k_dp *dp = ath12k_ab_to_dp(ab); + struct ath12k_rx_desc_info *desc_info; struct ath12k_skb_cb *skb_cb; struct sk_buff *skb; struct ath12k *ar; int i, j; - u32 pool_id, tx_spt_page; if (!dp->spt_info) return; @@ -982,8 +984,10 @@ static void ath12k_dp_cc_cleanup(struct ath12k_base *ab) /* RX Descriptor cleanup */ spin_lock_bh(&dp->rx_desc_lock); + num_rx_spt_pages = ath12k_dp_num_rx_spt_pages(dp_params); + if (dp->rxbaddr) { - for (i = 0; i < ATH12K_NUM_RX_SPT_PAGES(ab); i++) { + for (i = 0; i < num_rx_spt_pages; i++) { if (!dp->rxbaddr[i]) continue; @@ -1056,12 +1060,13 @@ static void ath12k_dp_cc_cleanup(struct ath12k_base *ab) } if (dp->txbaddr) { + tx_spt_pages_per_pool = ath12k_dp_tx_spt_pages_per_pool(dp_params); + for (pool_id = 0; pool_id < ATH12K_HW_MAX_QUEUES; pool_id++) { spin_lock_bh(&dp->tx_desc_lock[pool_id]); - for (i = 0; i < ATH12K_TX_SPT_PAGES_PER_POOL(ab); i++) { - tx_spt_page = i + pool_id * - ATH12K_TX_SPT_PAGES_PER_POOL(ab); + for (i = 0; i < tx_spt_pages_per_pool; i++) { + tx_spt_page = i + pool_id * tx_spt_pages_per_pool; if (!dp->txbaddr[tx_spt_page]) continue; @@ -1155,14 +1160,16 @@ static void *ath12k_dp_cc_get_desc_addr_ptr(struct ath12k_dp *dp, struct ath12k_rx_desc_info *ath12k_dp_get_rx_desc(struct ath12k_dp *dp, u32 cookie) { + const struct ath12k_dp_profile_params *dp_params; struct ath12k_rx_desc_info **desc_addr_ptr; u16 start_ppt_idx, end_ppt_idx, ppt_idx, spt_idx; ppt_idx = u32_get_bits(cookie, ATH12K_DP_CC_COOKIE_PPT); spt_idx = u32_get_bits(cookie, ATH12K_DP_CC_COOKIE_SPT); + dp_params = &dp->ab->profile_param->dp_params; - start_ppt_idx = dp->rx_ppt_base + ATH12K_RX_SPT_PAGE_OFFSET(dp->ab); - end_ppt_idx = start_ppt_idx + ATH12K_NUM_RX_SPT_PAGES(dp->ab); + start_ppt_idx = dp->rx_ppt_base + ath12k_dp_rx_spt_page_offset(dp_params); + end_ppt_idx = start_ppt_idx + ath12k_dp_num_rx_spt_pages(dp_params); if (ppt_idx < start_ppt_idx || ppt_idx >= end_ppt_idx || @@ -1179,15 +1186,16 @@ EXPORT_SYMBOL(ath12k_dp_get_rx_desc); struct ath12k_tx_desc_info *ath12k_dp_get_tx_desc(struct ath12k_dp *dp, u32 cookie) { + const struct ath12k_dp_profile_params *dp_params; struct ath12k_tx_desc_info **desc_addr_ptr; u16 start_ppt_idx, end_ppt_idx, ppt_idx, spt_idx; ppt_idx = u32_get_bits(cookie, ATH12K_DP_CC_COOKIE_PPT); spt_idx = u32_get_bits(cookie, ATH12K_DP_CC_COOKIE_SPT); + dp_params = &dp->ab->profile_param->dp_params; start_ppt_idx = ATH12K_TX_SPT_PAGE_OFFSET; - end_ppt_idx = start_ppt_idx + - (ATH12K_TX_SPT_PAGES_PER_POOL(dp->ab) * ATH12K_HW_MAX_QUEUES); + end_ppt_idx = start_ppt_idx + ath12k_dp_num_tx_spt_pages(dp_params); if (ppt_idx < start_ppt_idx || ppt_idx >= end_ppt_idx || @@ -1202,12 +1210,13 @@ EXPORT_SYMBOL(ath12k_dp_get_tx_desc); static int ath12k_dp_cc_desc_init(struct ath12k_base *ab) { - struct ath12k_dp *dp = ath12k_ab_to_dp(ab); + const struct ath12k_dp_profile_params *dp_params = &ab->profile_param->dp_params; + u32 num_rx_spt_pages = ath12k_dp_num_rx_spt_pages(dp_params); struct ath12k_rx_desc_info *rx_descs, **rx_desc_addr; struct ath12k_tx_desc_info *tx_descs, **tx_desc_addr; - u32 num_rx_spt_pages = ATH12K_NUM_RX_SPT_PAGES(ab); - u32 i, j, pool_id, tx_spt_page; - u32 ppt_idx, cookie_ppt_idx; + u32 i, j, pool_id, tx_spt_page, tx_spt_pages_per_pool; + u32 ppt_idx, cookie_ppt_idx, rx_spt_page_offset; + struct ath12k_dp *dp = ath12k_ab_to_dp(ab); spin_lock_bh(&dp->rx_desc_lock); @@ -1219,9 +1228,9 @@ static int ath12k_dp_cc_desc_init(struct ath12k_base *ab) return -ENOMEM; } - /* First ATH12K_NUM_RX_SPT_PAGES(ab) of allocated SPT pages are used for - * RX - */ + rx_spt_page_offset = ath12k_dp_rx_spt_page_offset(dp_params); + + /* First num_rx_spt_pages of allocated SPT pages are used for RX */ for (i = 0; i < num_rx_spt_pages; i++) { rx_descs = kcalloc(ATH12K_MAX_SPT_ENTRIES, sizeof(*rx_descs), GFP_ATOMIC); @@ -1231,7 +1240,7 @@ static int ath12k_dp_cc_desc_init(struct ath12k_base *ab) return -ENOMEM; } - ppt_idx = ATH12K_RX_SPT_PAGE_OFFSET(ab) + i; + ppt_idx = rx_spt_page_offset + i; cookie_ppt_idx = dp->rx_ppt_base + ppt_idx; dp->rxbaddr[i] = &rx_descs[0]; @@ -1249,15 +1258,17 @@ static int ath12k_dp_cc_desc_init(struct ath12k_base *ab) spin_unlock_bh(&dp->rx_desc_lock); - dp->txbaddr = kcalloc(ATH12K_NUM_TX_SPT_PAGES(ab), + dp->txbaddr = kcalloc(ath12k_dp_num_tx_spt_pages(dp_params), sizeof(struct ath12k_tx_desc_info *), GFP_ATOMIC); if (!dp->txbaddr) return -ENOMEM; + tx_spt_pages_per_pool = ath12k_dp_tx_spt_pages_per_pool(dp_params); + for (pool_id = 0; pool_id < ATH12K_HW_MAX_QUEUES; pool_id++) { spin_lock_bh(&dp->tx_desc_lock[pool_id]); - for (i = 0; i < ATH12K_TX_SPT_PAGES_PER_POOL(ab); i++) { + for (i = 0; i < tx_spt_pages_per_pool; i++) { tx_descs = kcalloc(ATH12K_MAX_SPT_ENTRIES, sizeof(*tx_descs), GFP_ATOMIC); @@ -1267,8 +1278,7 @@ static int ath12k_dp_cc_desc_init(struct ath12k_base *ab) return -ENOMEM; } - tx_spt_page = i + pool_id * - ATH12K_TX_SPT_PAGES_PER_POOL(ab); + tx_spt_page = i + pool_id * tx_spt_pages_per_pool; ppt_idx = ATH12K_TX_SPT_PAGE_OFFSET + tx_spt_page; dp->txbaddr[tx_spt_page] = &tx_descs[0]; @@ -1294,6 +1304,7 @@ static int ath12k_dp_cmem_init(struct ath12k_base *ab, struct ath12k_dp *dp, enum ath12k_dp_desc_type type) { + const struct ath12k_dp_profile_params *dp_params = &ab->profile_param->dp_params; u32 cmem_base; int i, start, end; @@ -1302,12 +1313,12 @@ static int ath12k_dp_cmem_init(struct ath12k_base *ab, switch (type) { case ATH12K_DP_TX_DESC: start = ATH12K_TX_SPT_PAGE_OFFSET; - end = start + ATH12K_NUM_TX_SPT_PAGES(ab); + end = start + ath12k_dp_num_tx_spt_pages(dp_params); break; case ATH12K_DP_RX_DESC: cmem_base += ATH12K_PPT_ADDR_OFFSET(dp->rx_ppt_base); - start = ATH12K_RX_SPT_PAGE_OFFSET(ab); - end = start + ATH12K_NUM_RX_SPT_PAGES(ab); + start = ath12k_dp_rx_spt_page_offset(dp_params); + end = start + ath12k_dp_num_rx_spt_pages(dp_params); break; default: ath12k_err(ab, "invalid descriptor type %d in cmem init\n", type); @@ -1337,7 +1348,10 @@ void ath12k_dp_partner_cc_init(struct ath12k_base *ab) static u32 ath12k_dp_get_num_spt_pages(struct ath12k_base *ab) { - return ATH12K_NUM_RX_SPT_PAGES(ab) + ATH12K_NUM_TX_SPT_PAGES(ab); + const struct ath12k_dp_profile_params *dp_params = &ab->profile_param->dp_params; + + return ath12k_dp_num_rx_spt_pages(dp_params) + + ath12k_dp_num_tx_spt_pages(dp_params); } static int ath12k_dp_cc_init(struct ath12k_base *ab) @@ -1366,7 +1380,8 @@ static int ath12k_dp_cc_init(struct ath12k_base *ab) return -ENOMEM; } - dp->rx_ppt_base = ab->device_id * ATH12K_NUM_RX_SPT_PAGES(ab); + dp->rx_ppt_base = ab->device_id * + ath12k_dp_num_rx_spt_pages(&ab->profile_param->dp_params); for (i = 0; i < dp->num_spt_pages; i++) { dp->spt_info[i].vaddr = dma_alloc_coherent(ab->dev, @@ -1466,6 +1481,7 @@ static int ath12k_dp_reoq_lut_setup(struct ath12k_base *ab) static int ath12k_dp_setup(struct ath12k_base *ab) { + const struct ath12k_dp_profile_params *dp_params; struct ath12k_dp *dp; struct hal_srng *srng = NULL; size_t size = 0; @@ -1475,6 +1491,7 @@ static int ath12k_dp_setup(struct ath12k_base *ab) dp = ath12k_ab_to_dp(ab); dp->ab = ab; + dp_params = &ab->profile_param->dp_params; INIT_LIST_HEAD(&dp->reo_cmd_list); INIT_LIST_HEAD(&dp->reo_cmd_cache_flush_list); @@ -1529,7 +1546,7 @@ static int ath12k_dp_setup(struct ath12k_base *ab) goto fail_dp_bank_profiles_cleanup; size = ab->hal.hal_wbm_release_ring_tx_size * - DP_TX_COMP_RING_SIZE(ab); + ath12k_dp_tx_comp_ring_size(dp_params); ret = ath12k_dp_reoq_lut_setup(ab); if (ret) { @@ -1541,7 +1558,8 @@ static int ath12k_dp_setup(struct ath12k_base *ab) dp->tx_ring[i].tcl_data_ring_id = i; dp->tx_ring[i].tx_status_head = 0; - dp->tx_ring[i].tx_status_tail = DP_TX_COMP_RING_SIZE(ab) - 1; + dp->tx_ring[i].tx_status_tail = + ath12k_dp_tx_comp_ring_size(dp_params) - 1; dp->tx_ring[i].tx_status = kmalloc(size, GFP_KERNEL); if (!dp->tx_ring[i].tx_status) { ret = -ENOMEM; diff --git a/drivers/net/wireless/ath/ath12k/dp.h b/drivers/net/wireless/ath/ath12k/dp.h index a94bbc337df42..842d8cdbaeb55 100644 --- a/drivers/net/wireless/ath/ath12k/dp.h +++ b/drivers/net/wireless/ath/ath12k/dp.h @@ -23,6 +23,16 @@ struct ath12k_ext_irq_grp; struct ath12k_dp_rx_tid; struct ath12k_dp_rx_tid_rxq; +struct ath12k_dp_profile_params { + u32 tx_comp_ring_size; + u32 rxdma_monitor_buf_ring_size; + u32 rxdma_monitor_dst_ring_size; + u32 num_pool_tx_desc; + u32 rx_desc_count; + u32 rx_release_ring_size; + u32 rxdma_buf_ring_size; +}; + #define DP_MON_PURGE_TIMEOUT_MS 100 #define DP_MON_SERVICE_BUDGET 128 @@ -52,7 +62,7 @@ struct dp_rxdma_ring { int bufs_max; }; -#define ATH12K_TX_COMPL_NEXT(ab, x) (((x) + 1) % DP_TX_COMP_RING_SIZE(ab)) +#define ATH12K_TX_COMPL_NEXT(ring_size, x) (((x) + 1) % (ring_size)) struct dp_tx_ring { u8 tcl_data_ring_id; @@ -192,27 +202,18 @@ struct ath12k_pdev_dp { #define DP_WBM_RELEASE_RING_SIZE 64 #define DP_TCL_DATA_RING_SIZE 512 -#define DP_TX_COMP_RING_SIZE(ab) \ - ((ab)->profile_param->dp_params.tx_comp_ring_size) -#define DP_TX_IDR_SIZE(ab) DP_TX_COMP_RING_SIZE(ab) #define DP_TCL_CMD_RING_SIZE 32 #define DP_TCL_STATUS_RING_SIZE 32 #define DP_REO_DST_RING_MAX 8 #define DP_REO_DST_RING_SIZE 2048 #define DP_REO_REINJECT_RING_SIZE 32 -#define DP_RX_RELEASE_RING_SIZE 1024 #define DP_REO_EXCEPTION_RING_SIZE 128 #define DP_REO_CMD_RING_SIZE 256 #define DP_REO_STATUS_RING_SIZE 2048 -#define DP_RXDMA_BUF_RING_SIZE 4096 #define DP_RX_MAC_BUF_RING_SIZE 4096 #define DP_RXDMA_REFILL_RING_SIZE 2048 #define DP_RXDMA_ERR_DST_RING_SIZE 1024 #define DP_RXDMA_MON_STATUS_RING_SIZE 1024 -#define DP_RXDMA_MONITOR_BUF_RING_SIZE(ab) \ - ((ab)->profile_param->dp_params.rxdma_monitor_buf_ring_size) -#define DP_RXDMA_MONITOR_DST_RING_SIZE(ab) \ - ((ab)->profile_param->dp_params.rxdma_monitor_dst_ring_size) #define DP_RXDMA_MONITOR_DESC_RING_SIZE 4096 #define DP_TX_MONITOR_BUF_RING_SIZE 4096 #define DP_TX_MONITOR_DEST_RING_SIZE 2048 @@ -246,12 +247,6 @@ struct ath12k_pdev_dp { #define ATH12K_SHADOW_DP_TIMER_INTERVAL 20 #define ATH12K_SHADOW_CTRL_TIMER_INTERVAL 10 -#define ATH12K_NUM_POOL_TX_DESC(ab) \ - ((ab)->profile_param->dp_params.num_pool_tx_desc) -/* TODO: revisit this count during testing */ -#define ATH12K_RX_DESC_COUNT(ab) \ - ((ab)->profile_param->dp_params.rx_desc_count) - #define ATH12K_PAGE_SIZE PAGE_SIZE /* Total 1024 entries in PPT, i.e 4K/4 considering 4K aligned @@ -262,21 +257,7 @@ struct ath12k_pdev_dp { /* Total 512 entries in a SPT, i.e 4K Page/8 */ #define ATH12K_MAX_SPT_ENTRIES 512 -#define ATH12K_NUM_RX_SPT_PAGES(ab) ((ATH12K_RX_DESC_COUNT(ab)) / \ - ATH12K_MAX_SPT_ENTRIES) - -#define ATH12K_TX_SPT_PAGES_PER_POOL(ab) (ATH12K_NUM_POOL_TX_DESC(ab) / \ - ATH12K_MAX_SPT_ENTRIES) -#define ATH12K_NUM_TX_SPT_PAGES(ab) (ATH12K_TX_SPT_PAGES_PER_POOL(ab) * \ - ATH12K_HW_MAX_QUEUES) - #define ATH12K_TX_SPT_PAGE_OFFSET 0 -#define ATH12K_RX_SPT_PAGE_OFFSET(ab) ATH12K_NUM_TX_SPT_PAGES(ab) - -/* The SPT pages are divided for RX and TX, first block for RX - * and remaining for TX - */ -#define ATH12K_NUM_TX_SPT_PAGE_START(ab) ATH12K_NUM_RX_SPT_PAGES(ab) #define ATH12K_DP_RX_DESC_MAGIC 0xBABABABA @@ -679,6 +660,72 @@ ath12k_dp_to_pdev_dp(struct ath12k_dp *dp, u8 pdev_idx) return rcu_dereference(dp->dp_pdevs[pdev_idx]); } +static inline u32 +ath12k_dp_tx_comp_ring_size(const struct ath12k_dp_profile_params *p) +{ + return p->tx_comp_ring_size; +} + +static inline u32 +ath12k_dp_rxdma_monitor_buf_ring_size(const struct ath12k_dp_profile_params *p) +{ + return p->rxdma_monitor_buf_ring_size; +} + +static inline u32 +ath12k_dp_rxdma_monitor_dst_ring_size(const struct ath12k_dp_profile_params *p) +{ + return p->rxdma_monitor_dst_ring_size; +} + +static inline u32 +ath12k_dp_num_pool_tx_desc(const struct ath12k_dp_profile_params *p) +{ + return p->num_pool_tx_desc; +} + +static inline u32 +ath12k_dp_tx_spt_pages_per_pool(const struct ath12k_dp_profile_params *p) +{ + return ath12k_dp_num_pool_tx_desc(p) / ATH12K_MAX_SPT_ENTRIES; +} + +static inline u32 +ath12k_dp_num_tx_spt_pages(const struct ath12k_dp_profile_params *p) +{ + return ath12k_dp_tx_spt_pages_per_pool(p) * ATH12K_HW_MAX_QUEUES; +} + +static inline u32 +ath12k_dp_rx_spt_page_offset(const struct ath12k_dp_profile_params *p) +{ + return ath12k_dp_num_tx_spt_pages(p); +} + +static inline u32 +ath12k_dp_rx_desc_count(const struct ath12k_dp_profile_params *p) +{ + return p->rx_desc_count; +} + +static inline u32 +ath12k_dp_num_rx_spt_pages(const struct ath12k_dp_profile_params *p) +{ + return ath12k_dp_rx_desc_count(p) / ATH12K_MAX_SPT_ENTRIES; +} + +static inline u32 +ath12k_dp_rx_release_ring_size(const struct ath12k_dp_profile_params *p) +{ + return p->rx_release_ring_size; +} + +static inline u32 +ath12k_dp_rxdma_buf_ring_size(const struct ath12k_dp_profile_params *p) +{ + return p->rxdma_buf_ring_size; +} + void ath12k_dp_vdev_tx_attach(struct ath12k *ar, struct ath12k_link_vif *arvif); void ath12k_dp_partner_cc_init(struct ath12k_base *ab); int ath12k_dp_pdev_alloc(struct ath12k_base *ab); diff --git a/drivers/net/wireless/ath/ath12k/dp_rx.c b/drivers/net/wireless/ath/ath12k/dp_rx.c index 117e87d1d3e17..9ef4f170691d1 100644 --- a/drivers/net/wireless/ath/ath12k/dp_rx.c +++ b/drivers/net/wireless/ath/ath12k/dp_rx.c @@ -330,16 +330,20 @@ static int ath12k_dp_rx_pdev_srng_alloc(struct ath12k *ar) { struct ath12k_pdev_dp *dp = &ar->dp; struct ath12k_base *ab = ar->ab; + u32 monitor_dst_ring_size; + u32 mac_id = dp->mac_id; int i; int ret; - u32 mac_id = dp->mac_id; + + monitor_dst_ring_size = + ath12k_dp_rxdma_monitor_dst_ring_size(&ab->profile_param->dp_params); for (i = 0; i < ab->hw_params->num_rxdma_per_pdev; i++) { ret = ath12k_dp_srng_setup(ar->ab, &dp->rxdma_mon_dst_ring[i], HAL_RXDMA_MONITOR_DST, 0, mac_id + i, - DP_RXDMA_MONITOR_DST_RING_SIZE(ab)); + monitor_dst_ring_size); if (ret) { ath12k_warn(ar->ab, "failed to setup HAL_RXDMA_MONITOR_DST\n"); @@ -1692,6 +1696,8 @@ int ath12k_dp_rx_htt_setup(struct ath12k_base *ab) int ath12k_dp_rx_alloc(struct ath12k_base *ab) { + const struct ath12k_dp_profile_params *dp_params = &ab->profile_param->dp_params; + u32 monitor_buf_ring_size = ath12k_dp_rxdma_monitor_buf_ring_size(dp_params); struct ath12k_dp *dp = ath12k_ab_to_dp(ab); struct dp_srng *srng; int i, ret; @@ -1702,7 +1708,7 @@ int ath12k_dp_rx_alloc(struct ath12k_base *ab) ret = ath12k_dp_srng_setup(ab, &dp->rx_refill_buf_ring.refill_buf_ring, HAL_RXDMA_BUF, 0, 0, - DP_RXDMA_BUF_RING_SIZE); + ath12k_dp_rxdma_buf_ring_size(dp_params)); if (ret) { ath12k_warn(ab, "failed to setup rx_refill_buf_ring\n"); return ret; @@ -1736,7 +1742,7 @@ int ath12k_dp_rx_alloc(struct ath12k_base *ab) ret = ath12k_dp_srng_setup(ab, &dp->rxdma_mon_buf_ring.refill_buf_ring, HAL_RXDMA_MONITOR_BUF, 0, 0, - DP_RXDMA_MONITOR_BUF_RING_SIZE(ab)); + monitor_buf_ring_size); if (ret) { ath12k_warn(ab, "failed to setup HAL_RXDMA_MONITOR_BUF\n"); return ret; diff --git a/drivers/net/wireless/ath/ath12k/mac.c b/drivers/net/wireless/ath/ath12k/mac.c index 874bd3fa5263f..7782871416102 100644 --- a/drivers/net/wireless/ath/ath12k/mac.c +++ b/drivers/net/wireless/ath/ath12k/mac.c @@ -9744,6 +9744,7 @@ static int ath12k_mac_config_mon_status_default(struct ath12k *ar, bool enable) static int ath12k_mac_start(struct ath12k *ar) { + const struct ath12k_dp_profile_params *dp_params; struct ath12k_hw *ah = ar->ah; struct ath12k_base *ab = ar->ab; struct ath12k_pdev *pdev = ar->pdev; @@ -9752,6 +9753,8 @@ static int ath12k_mac_start(struct ath12k *ar) lockdep_assert_held(&ah->hw_mutex); lockdep_assert_wiphy(ath12k_ar_to_hw(ar)->wiphy); + dp_params = &ab->profile_param->dp_params; + ret = ath12k_wmi_pdev_set_param(ar, WMI_PDEV_PARAM_PMF_QOS, 1, pdev->pdev_id); @@ -9800,7 +9803,7 @@ static int ath12k_mac_start(struct ath12k *ar) if (ab->hw_params->supports_cong_ctrl_max_msdus) { ret = ath12k_wmi_pdev_set_param(ar, WMI_PDEV_PARAM_SET_CONG_CTRL_MAX_MSDUS, - ATH12K_NUM_POOL_TX_DESC(ab), + ath12k_dp_num_pool_tx_desc(dp_params), pdev->pdev_id); if (ret) { ath12k_err(ab, diff --git a/drivers/net/wireless/ath/ath12k/wifi7/dp_tx.c b/drivers/net/wireless/ath/ath12k/wifi7/dp_tx.c index d2749de445534..d201efac5d4d3 100644 --- a/drivers/net/wireless/ath/ath12k/wifi7/dp_tx.c +++ b/drivers/net/wireless/ath/ath12k/wifi7/dp_tx.c @@ -860,12 +860,14 @@ void ath12k_wifi7_dp_tx_completion_handler(struct ath12k_dp *dp, int ring_id) u64 desc_va; enum hal_wbm_rel_src_module buf_rel_source; enum hal_wbm_tqm_rel_reason rel_status; + u32 ring_size; spin_lock_bh(&status_ring->lock); + ring_size = ath12k_dp_tx_comp_ring_size(&ab->profile_param->dp_params); ath12k_hal_srng_access_begin(ab, status_ring); - while (ATH12K_TX_COMPL_NEXT(ab, tx_ring->tx_status_head) != + while (ATH12K_TX_COMPL_NEXT(ring_size, tx_ring->tx_status_head) != tx_ring->tx_status_tail) { desc = ath12k_hal_srng_dst_get_next_entry(ab, status_ring); if (!desc) @@ -874,11 +876,11 @@ void ath12k_wifi7_dp_tx_completion_handler(struct ath12k_dp *dp, int ring_id) memcpy(&tx_ring->tx_status[tx_ring->tx_status_head], desc, sizeof(*desc)); tx_ring->tx_status_head = - ATH12K_TX_COMPL_NEXT(ab, tx_ring->tx_status_head); + ATH12K_TX_COMPL_NEXT(ring_size, tx_ring->tx_status_head); } if (ath12k_hal_srng_dst_peek(ab, status_ring) && - (ATH12K_TX_COMPL_NEXT(ab, tx_ring->tx_status_head) == + (ATH12K_TX_COMPL_NEXT(ring_size, tx_ring->tx_status_head) == tx_ring->tx_status_tail)) { /* TODO: Process pending tx_status messages when kfifo_is_full() */ ath12k_warn(ab, "Unable to process some of the tx_status ring desc because status_fifo is full\n"); @@ -888,13 +890,13 @@ void ath12k_wifi7_dp_tx_completion_handler(struct ath12k_dp *dp, int ring_id) spin_unlock_bh(&status_ring->lock); - while (ATH12K_TX_COMPL_NEXT(ab, tx_ring->tx_status_tail) != + while (ATH12K_TX_COMPL_NEXT(ring_size, tx_ring->tx_status_tail) != tx_ring->tx_status_head) { struct hal_wbm_completion_ring_tx *tx_status; u32 desc_id; tx_ring->tx_status_tail = - ATH12K_TX_COMPL_NEXT(ab, tx_ring->tx_status_tail); + ATH12K_TX_COMPL_NEXT(ring_size, tx_ring->tx_status_tail); tx_status = &tx_ring->tx_status[tx_ring->tx_status_tail]; ath12k_wifi7_dp_tx_status_parse(dp, tx_status, &ts);