qcacmn: Add a force TX ring HP flush when TX is pending

There is a timing race condition between RTPM suspend flow and
DP TX flow. When TX is queued during RTPM suspend flow. TX
ring update may be delayed. Add a force TX HP flush when RTPM
is rejected due to TX pending frame. This can help to improve
TX pending frames delay when race condition happens.

Change-Id: I6f60f2902dfda630f81528dcf978da6644d18ba7
CRs-Fixed: 2942744
This commit is contained in:
Yu Tian
2021-05-11 13:20:30 +08:00
committed by Madan Koyyalamudi
parent 4dc1443151
commit 434c3f1532

View File

@@ -12082,46 +12082,6 @@ static struct cdp_mesh_latency_ops dp_ops_mesh_latency = {
#endif
#ifdef FEATURE_RUNTIME_PM
/**
* dp_runtime_suspend() - ensure DP is ready to runtime suspend
* @soc_hdl: Datapath soc handle
* @pdev_id: id of data path pdev handle
*
* DP is ready to runtime suspend if there are no pending TX packets.
*
* Return: QDF_STATUS
*/
static QDF_STATUS dp_runtime_suspend(struct cdp_soc_t *soc_hdl, uint8_t pdev_id)
{
struct dp_soc *soc = cdp_soc_t_to_dp_soc(soc_hdl);
struct dp_pdev *pdev;
pdev = dp_get_pdev_from_soc_pdev_id_wifi3(soc, pdev_id);
if (!pdev) {
dp_err("pdev is NULL");
return QDF_STATUS_E_INVAL;
}
/* Abort if there are any pending TX packets */
if (dp_get_tx_pending(dp_pdev_to_cdp_pdev(pdev)) > 0) {
dp_init_info("%pK: Abort suspend due to pending TX packets", soc);
return QDF_STATUS_E_AGAIN;
}
if (dp_runtime_get_refcount(soc)) {
dp_init_info("refcount: %d", dp_runtime_get_refcount(soc));
return QDF_STATUS_E_AGAIN;
}
if (soc->intr_mode == DP_INTR_POLL)
qdf_timer_stop(&soc->int_timer);
dp_rx_fst_update_pm_suspend_status(soc, true);
return QDF_STATUS_SUCCESS;
}
/**
* dp_flush_ring_hptp() - Update ring shadow
* register HP/TP address when runtime
@@ -12145,6 +12105,55 @@ void dp_flush_ring_hptp(struct dp_soc *soc, hal_ring_handle_t hal_srng)
}
}
/**
* dp_runtime_suspend() - ensure DP is ready to runtime suspend
* @soc_hdl: Datapath soc handle
* @pdev_id: id of data path pdev handle
*
* DP is ready to runtime suspend if there are no pending TX packets.
*
* Return: QDF_STATUS
*/
static QDF_STATUS dp_runtime_suspend(struct cdp_soc_t *soc_hdl, uint8_t pdev_id)
{
struct dp_soc *soc = cdp_soc_t_to_dp_soc(soc_hdl);
struct dp_pdev *pdev;
uint8_t i;
pdev = dp_get_pdev_from_soc_pdev_id_wifi3(soc, pdev_id);
if (!pdev) {
dp_err("pdev is NULL");
return QDF_STATUS_E_INVAL;
}
/* Abort if there are any pending TX packets */
if (dp_get_tx_pending(dp_pdev_to_cdp_pdev(pdev)) > 0) {
dp_init_info("%pK: Abort suspend due to pending TX packets", soc);
/* perform a force flush if tx is pending */
for (i = 0; i < soc->num_tcl_data_rings; i++) {
hal_srng_set_event(soc->tcl_data_ring[i].hal_srng,
HAL_SRNG_FLUSH_EVENT);
dp_flush_ring_hptp(soc, soc->tcl_data_ring[i].hal_srng);
}
return QDF_STATUS_E_AGAIN;
}
if (dp_runtime_get_refcount(soc)) {
dp_init_info("refcount: %d", dp_runtime_get_refcount(soc));
return QDF_STATUS_E_AGAIN;
}
if (soc->intr_mode == DP_INTR_POLL)
qdf_timer_stop(&soc->int_timer);
dp_rx_fst_update_pm_suspend_status(soc, true);
return QDF_STATUS_SUCCESS;
}
#define DP_FLUSH_WAIT_CNT 10
#define DP_RUNTIME_SUSPEND_WAIT_MS 10
/**