diff --git a/dp/wifi3.0/dp_tx.c b/dp/wifi3.0/dp_tx.c index 8a59e43987..926b4d703f 100644 --- a/dp/wifi3.0/dp_tx.c +++ b/dp/wifi3.0/dp_tx.c @@ -6300,7 +6300,7 @@ void dp_tx_desc_flush(struct dp_pdev *pdev, struct dp_vdev *vdev, { uint8_t i, num_pool; uint32_t j; - uint32_t num_desc, page_id, offset; + uint32_t num_desc, num_desc_t, page_id, offset; uint16_t num_desc_per_page; struct dp_soc *soc = pdev->soc; struct dp_tx_desc_s *tx_desc = NULL; @@ -6319,9 +6319,11 @@ void dp_tx_desc_flush(struct dp_pdev *pdev, struct dp_vdev *vdev, if (!tx_desc_pool->desc_pages.cacheable_pages) continue; + num_desc_t = dp_get_updated_tx_desc(soc->ctrl_psoc, i, + num_desc); num_desc_per_page = tx_desc_pool->desc_pages.num_element_per_page; - for (j = 0; j < num_desc; j++) { + for (j = 0; j < num_desc_t; j++) { page_id = j / num_desc_per_page; offset = j % num_desc_per_page; tx_desc = dp_tx_desc_find(soc, i, page_id, offset); diff --git a/dp/wifi3.0/dp_tx.h b/dp/wifi3.0/dp_tx.h index 5aab601f60..122d4abeed 100644 --- a/dp/wifi3.0/dp_tx.h +++ b/dp/wifi3.0/dp_tx.h @@ -430,6 +430,36 @@ dp_ppeds_tx_desc_free(struct dp_soc *soc, struct dp_tx_desc_s *tx_desc) } #endif +/** + * dp_get_updated_tx_desc() - get updated tx_desc value + * @psoc: psoc object + * @pool_num: Tx desc pool Id + * @current_desc: Current Tx Desc value + * + * In Lowmem profiles the number of Tx desc in 4th pool is reduced to quarter + * for memory optimizations via this flag DP_TX_DESC_POOL_OPTIMIZE + * + * Return: Updated Tx Desc value + */ +#ifdef DP_TX_DESC_POOL_OPTIMIZE +static inline uint32_t dp_get_updated_tx_desc(struct cdp_ctrl_objmgr_psoc *psoc, + uint8_t pool_num, + uint32_t current_desc) +{ + if (pool_num == 3) + return cfg_get(psoc, CFG_DP_TX_DESC_POOL_3); + else + return current_desc; +} +#else +static inline uint32_t dp_get_updated_tx_desc(struct cdp_ctrl_objmgr_psoc *psoc, + uint8_t pool_num, + uint32_t current_desc) +{ + return current_desc; +} +#endif + #ifdef DP_TX_EXT_DESC_POOL_OPTIMIZE /** * dp_tx_ext_desc_pool_override() - Override tx ext desc pool Id diff --git a/dp/wifi3.0/dp_tx_desc.c b/dp/wifi3.0/dp_tx_desc.c index c8c183227f..3fbdc82647 100644 --- a/dp/wifi3.0/dp_tx_desc.c +++ b/dp/wifi3.0/dp_tx_desc.c @@ -118,16 +118,17 @@ void dp_tx_desc_pool_cleanup(struct dp_soc *soc, qdf_nbuf_t *nbuf_list) QDF_STATUS dp_tx_desc_pool_alloc(struct dp_soc *soc, uint8_t pool_id, uint32_t num_elem) { - uint32_t desc_size; + uint32_t desc_size, num_elem_t; struct dp_tx_desc_pool_s *tx_desc_pool; QDF_STATUS status; + num_elem_t = dp_get_updated_tx_desc(soc->ctrl_psoc, pool_id, num_elem); desc_size = DP_TX_DESC_SIZE(sizeof(struct dp_tx_desc_s)); tx_desc_pool = &((soc)->tx_desc[(pool_id)]); tx_desc_pool->desc_pages.page_size = DP_BLOCKMEM_SIZE; dp_desc_multi_pages_mem_alloc(soc, QDF_DP_TX_DESC_TYPE, &tx_desc_pool->desc_pages, - desc_size, num_elem, + desc_size, num_elem_t, 0, true); if (!tx_desc_pool->desc_pages.num_pages) { @@ -136,7 +137,7 @@ QDF_STATUS dp_tx_desc_pool_alloc(struct dp_soc *soc, uint8_t pool_id, } /* Arch specific TX descriptor allocation */ - status = soc->arch_ops.dp_tx_desc_pool_alloc(soc, num_elem, pool_id); + status = soc->arch_ops.dp_tx_desc_pool_alloc(soc, num_elem_t, pool_id); if (QDF_IS_STATUS_ERROR(status)) { dp_err("failed to allocate arch specific descriptors"); return QDF_STATUS_E_NOMEM; @@ -164,14 +165,15 @@ QDF_STATUS dp_tx_desc_pool_init(struct dp_soc *soc, uint8_t pool_id, uint32_t num_elem) { struct dp_tx_desc_pool_s *tx_desc_pool; - uint32_t desc_size; + uint32_t desc_size, num_elem_t; desc_size = DP_TX_DESC_SIZE(sizeof(struct dp_tx_desc_s)); + num_elem_t = dp_get_updated_tx_desc(soc->ctrl_psoc, pool_id, num_elem); tx_desc_pool = &soc->tx_desc[pool_id]; if (qdf_mem_multi_page_link(soc->osdev, &tx_desc_pool->desc_pages, - desc_size, num_elem, true)) { + desc_size, num_elem_t, true)) { dp_err("invalid tx desc allocation -overflow num link"); return QDF_STATUS_E_FAULT; } @@ -180,14 +182,14 @@ QDF_STATUS dp_tx_desc_pool_init(struct dp_soc *soc, uint8_t pool_id, *tx_desc_pool->desc_pages.cacheable_pages; /* Set unique IDs for each Tx descriptor */ if (QDF_STATUS_SUCCESS != soc->arch_ops.dp_tx_desc_pool_init( - soc, num_elem, pool_id)) { + soc, num_elem_t, pool_id)) { dp_err("initialization per target failed"); return QDF_STATUS_E_FAULT; } tx_desc_pool->elem_size = DP_TX_DESC_SIZE(sizeof(struct dp_tx_desc_s)); - dp_tx_desc_pool_counter_initialize(tx_desc_pool, num_elem); + dp_tx_desc_pool_counter_initialize(tx_desc_pool, num_elem_t); TX_DESC_LOCK_CREATE(&tx_desc_pool->lock); return QDF_STATUS_SUCCESS; diff --git a/wlan_cfg/cfg_dp.h b/wlan_cfg/cfg_dp.h index 713c6ef356..4499fd6908 100644 --- a/wlan_cfg/cfg_dp.h +++ b/wlan_cfg/cfg_dp.h @@ -726,6 +726,13 @@ WLAN_CFG_NUM_TX_DESC, \ CFG_VALUE_OR_DEFAULT, "DP Tx Descriptors") +#define CFG_DP_TX_DESC_POOL_3 \ + CFG_INI_UINT("dp_tx_desc_pool_3", \ + WLAN_CFG_NUM_TX_DESC_MIN, \ + WLAN_CFG_NUM_TX_DESC_MAX, \ + WLAN_CFG_NUM_TX_DESC, \ + CFG_VALUE_OR_DEFAULT, "DP Tx Descriptor of 3rd pool") + #define CFG_DP_TX_SPL_DESC \ CFG_INI_UINT("dp_tx_spl_desc", \ WLAN_CFG_NUM_TX_SPL_DESC_MIN, \ @@ -2011,6 +2018,7 @@ CFG(CFG_DP_NSS_REO_DEST_RINGS) \ CFG(CFG_DP_NSS_TCL_DATA_RINGS) \ CFG(CFG_DP_TX_DESC) \ + CFG(CFG_DP_TX_DESC_POOL_3) \ CFG(CFG_DP_TX_SPL_DESC) \ CFG(CFG_DP_TX_EXT_DESC) \ CFG(CFG_DP_TX_EXT_DESC_POOLS) \