diff options
| author | Nirav Shah <nnshah@qti.qualcomm.com> | 2016-01-21 10:00:16 +0530 |
|---|---|---|
| committer | Akash Patel <akashp@codeaurora.org> | 2016-02-17 15:20:53 -0800 |
| commit | dc2b5f5e8dabfe148c72275c670b2c5a79b62b0f (patch) | |
| tree | 289c8c4fcc6a07ec408a78c6b1463f10e645dbe1 | |
| parent | 01c7dd9c4ee1e8bab5c798e45d197c34c64f5666 (diff) | |
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
| -rw-r--r-- | core/dp/txrx/ol_txrx.c | 41 |
1 files changed, 40 insertions, 1 deletions
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) |
