From 442d36e967304663b5e684ffadabc715ff1308f3 Mon Sep 17 00:00:00 2001 From: Yue Ma Date: Thu, 23 Aug 2018 12:39:23 -0700 Subject: [PATCH] qcacmn: Tie PM usage count to descriptor allocation and free Tie increment and decrement PM usage count to descriptor allocation and free instead of HW enqueue and TX completion since allocation and free will be the most accurate places to track if the packet has been sent or not. Change-Id: Ia61c5bb26386d20590e87149d0fe88dba02d0fb7 CRs-fixed: 2302214 --- dp/wifi3.0/dp_tx.c | 10 ---------- dp/wifi3.0/dp_tx_desc.h | 17 ++++++++++++++++- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/dp/wifi3.0/dp_tx.c b/dp/wifi3.0/dp_tx.c index 26b6f3d222..82f0fe4940 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 ff9d344521..79ca247240 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 */