From dc2b5f5e8dabfe148c72275c670b2c5a79b62b0f Mon Sep 17 00:00:00 2001 From: Nirav Shah Date: Thu, 21 Jan 2016 10:00:16 +0530 Subject: [PATCH] qcacld-3.0: Use appropriate API to get total free descriptors Use appropriate API to get total free descriptors for all flow pool. CRs-Fixed: 964984 Change-Id: I1ac40b2ce55743a65c6c487fd4055fe34ab61d2d --- core/dp/txrx/ol_txrx.c | 41 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/core/dp/txrx/ol_txrx.c b/core/dp/txrx/ol_txrx.c index 05e4d0a3e060..8193e12f0b80 100644 --- a/core/dp/txrx/ol_txrx.c +++ b/core/dp/txrx/ol_txrx.c @@ -332,6 +332,32 @@ uint32_t ol_tx_get_desc_global_pool_size(struct ol_txrx_pdev_t *pdev) { return pdev->num_msdu_desc; } + +/** + * ol_tx_get_total_free_desc() - get total free descriptors + * @pdev: pdev handle + * + * Return: total free descriptors + */ +static inline +uint32_t ol_tx_get_total_free_desc(struct ol_txrx_pdev_t *pdev) +{ + struct ol_tx_flow_pool_t *pool = NULL; + uint32_t free_desc; + + free_desc = pdev->tx_desc.num_free; + cdf_spin_lock_bh(&pdev->tx_desc.flow_pool_list_lock); + TAILQ_FOREACH(pool, &pdev->tx_desc.flow_pool_list, + flow_pool_list_elem) { + cdf_spin_lock_bh(&pool->flow_pool_lock); + free_desc += pool->avail_desc; + cdf_spin_unlock_bh(&pool->flow_pool_lock); + } + cdf_spin_unlock_bh(&pdev->tx_desc.flow_pool_list_lock); + + return free_desc; +} + #else /** * ol_tx_get_desc_global_pool_size() - get global pool size @@ -344,6 +370,19 @@ uint32_t ol_tx_get_desc_global_pool_size(struct ol_txrx_pdev_t *pdev) { return ol_cfg_target_tx_credit(pdev->ctrl_pdev); } + +/** + * ol_tx_get_total_free_desc() - get total free descriptors + * @pdev: pdev handle + * + * Return: total free descriptors + */ +static inline +uint32_t ol_tx_get_total_free_desc(struct ol_txrx_pdev_t *pdev) +{ + return pdev->tx_desc.num_free; +} + #endif /** @@ -1859,7 +1898,7 @@ int ol_txrx_get_tx_pending(ol_txrx_pdev_handle pdev_handle) total = ol_tx_get_desc_global_pool_size(pdev); - return total - pdev->tx_desc.num_free; + return total - ol_tx_get_total_free_desc(pdev); } void ol_txrx_discard_tx_pending(ol_txrx_pdev_handle pdev_handle)