Просмотр исходного кода

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
Yue Ma 6 лет назад
Родитель
Сommit
442d36e967
2 измененных файлов с 16 добавлено и 11 удалено
  1. 0 10
      dp/wifi3.0/dp_tx.c
  2. 16 1
      dp/wifi3.0/dp_tx_desc.h

+ 0 - 10
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

+ 16 - 1
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 */