qcacmn: Add DP callbacks for flow_pool create and delete

Current lithim_dp flow pool created in wma_vdev_start, wma_vdev_start
is called for same vdev multiple times for vdev. This leads to creation
of multiple flow pools for each vdev. Instead create from policy_manager
when session become active.

Register flow pool create/delete callbacks with policy manager.
So that lithium_dp vdev flow pools are created/deleted when vdev
become active/not-active.

Change-Id: Iaf6aaece47c79c7e6f7745feaee35a6bc5cd1297
CRs-Fixed: 2231601
This commit is contained in:
Manjunathappa Prakash
2018-05-08 19:55:25 -07:00
committed by nshrivas
parent 92d87f5161
commit e6aba4f65f
5 changed files with 36 additions and 5 deletions

View File

@@ -121,16 +121,17 @@ struct dp_tx_desc_pool_s *dp_tx_create_flow_pool(struct dp_soc *soc,
uint32_t stop_threshold;
uint32_t start_threshold;
if (!soc) {
if (flow_pool_id >= MAX_TXDESC_POOLS) {
QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR,
"%s: soc is NULL\n", __func__);
"%s: invalid flow_pool_id %d", __func__, flow_pool_id);
return NULL;
}
pool = &soc->tx_desc[flow_pool_id];
qdf_spin_lock_bh(&pool->flow_pool_lock);
if (pool->status == FLOW_POOL_INVALID) {
if ((pool->status != FLOW_POOL_INACTIVE) || pool->pool_create_cnt) {
QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR,
"%s: flow pool already allocated\n", __func__);
"%s: flow pool already allocated, attached %d times\n",
__func__, pool->pool_create_cnt);
if (pool->avail_desc > pool->start_th)
pool->status = FLOW_POOL_ACTIVE_UNPAUSED;
else
@@ -155,6 +156,7 @@ struct dp_tx_desc_pool_s *dp_tx_create_flow_pool(struct dp_soc *soc,
/* INI is in percentage so divide by 100 */
pool->start_th = (start_threshold * flow_pool_size)/100;
pool->stop_th = (stop_threshold * flow_pool_size)/100;
pool->pool_create_cnt++;
qdf_spin_unlock_bh(&pool->flow_pool_lock);
@@ -185,10 +187,25 @@ int dp_tx_delete_flow_pool(struct dp_soc *soc, struct dp_tx_desc_pool_s *pool,
}
qdf_spin_lock_bh(&pool->flow_pool_lock);
if (!pool->pool_create_cnt) {
QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR,
"flow pool either not created or alread deleted");
qdf_spin_unlock_bh(&pool->flow_pool_lock);
return -ENOENT;
}
pool->pool_create_cnt--;
if (pool->pool_create_cnt) {
QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_ERROR,
"%s: pool is still attached, pending detach %d\n",
__func__, pool->pool_create_cnt);
qdf_spin_unlock_bh(&pool->flow_pool_lock);
return -EAGAIN;
}
if (pool->avail_desc < pool->pool_size) {
pool->status = FLOW_POOL_INVALID;
qdf_spin_unlock_bh(&pool->flow_pool_lock);
return EAGAIN;
return -EAGAIN;
}
/* We have all the descriptors for the pool, we can delete the pool */