diff --git a/dp/wifi3.0/dp_tx.c b/dp/wifi3.0/dp_tx.c index 26b6f3d22260..82f0fe494005 100644 --- a/dp/wifi3.0/dp_tx.c +++ b/dp/wifi3.0/dp_tx.c @@ -969,14 +969,6 @@ static QDF_STATUS dp_tx_hw_enqueue(struct dp_soc *soc, struct dp_vdev *vdev, hal_tx_desc_sync(hal_tx_desc_cached, hal_tx_desc); DP_STATS_INC_PKT(vdev, tx_i.processed, 1, length); - /* - * If one packet is enqueued in HW, PM usage count needs to be - * incremented by one to prevent future runtime suspend. This - * should be tied with the success of enqueuing. It will be - * decremented after the packet has been sent. - */ - hif_pm_runtime_get_noresume(soc->hif_handle); - return QDF_STATUS_SUCCESS; } @@ -3052,8 +3044,6 @@ uint32_t dp_tx_comp_handler(struct dp_soc *soc, void *hal_srng, uint32_t quota) } num_processed += !(count & DP_TX_NAPI_BUDGET_DIV_MASK); - /* Decrement PM usage count if the packet has been sent.*/ - hif_pm_runtime_put(soc->hif_handle); /* * Processed packet count is more than given quota diff --git a/dp/wifi3.0/dp_tx_desc.h b/dp/wifi3.0/dp_tx_desc.h index ff9d34452177..79ca24724086 100644 --- a/dp/wifi3.0/dp_tx_desc.h +++ b/dp/wifi3.0/dp_tx_desc.h @@ -185,6 +185,15 @@ dp_tx_desc_alloc(struct dp_soc *soc, uint8_t desc_pool_id) } else { qdf_spin_unlock_bh(&pool->flow_pool_lock); } + + /* + * If one packet is going to be sent, PM usage count + * needs to be incremented by one to prevent future + * runtime suspend. This should be tied with the + * success of allocating one descriptor. It will be + * decremented after the packet has been sent. + */ + hif_pm_runtime_get_noresume(soc->hif_handle); } else { pool->pkt_drop_no_desc++; qdf_spin_unlock_bh(&pool->flow_pool_lock); @@ -230,7 +239,7 @@ dp_tx_desc_free(struct dp_soc *soc, struct dp_tx_desc_s *tx_desc, qdf_spin_unlock_bh(&pool->flow_pool_lock); qdf_print("%s %d pool is freed!!", __func__, __LINE__); - return; + goto out; } break; @@ -244,6 +253,12 @@ dp_tx_desc_free(struct dp_soc *soc, struct dp_tx_desc_s *tx_desc, qdf_spin_unlock_bh(&pool->flow_pool_lock); +out: + /** + * Decrement PM usage count if the packet has been sent. This + * should be tied with the success of freeing one descriptor. + */ + hif_pm_runtime_put(soc->hif_handle); } #else /* QCA_LL_TX_FLOW_CONTROL_V2 */