Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f3a1788f authored by Jianmin Zhu's avatar Jianmin Zhu Committed by snandini
Browse files

qcacld-3.0: Fix long ping delay after enable RTPM

Issue1: Driver RTPM state is ON/NONE, Kernel state is RESUMING.
cdp_runtime_resume is already complete,
hif_pm_runtime_get return -E_INPROGRESS,
dp_tx_hw_enqueue will set the flush event,
but cdp_runtime_resume is already done,
this flush event will be handled only on next pkt tx.

Issue2: Driver RTPM state: Resuming
hif_pm_runtime_get returns -EBUSY,
dp_tx_hw_enqueue is interrupted by any IRQ,
cdp_runtime_resume is completed,
dp_tx_hw_enqueue will set the flush event,
This flush event will be handled only on next pkt tx.

Fix:
Introduce a link_state_up atomic variable in hif to track the link state
change by pld_cb.
Set atomic variable link_state_up=1 in pmo_core_psoc_bus_runtime_resume
just after pld_cb. pld_cb brings the PCIe bus out of suspend state.
Set atomic variable link_state_up=0 in pmo_core_psoc_bus_runtime_suspend
just before pld_cb. pld_cb puts the PCIe bus into suspend state.

Introduce dp_runtime_get and dp_runtime_put.
dp_runtime_get get refcount with increment of an atomic variable.
dp_runtime_put return refcount with decrement of  this atomic variable.
If hif_pm_runtime_get returns -EBUSY or -EINPROGRESS,
take the dp runtime refcount using dp_runtime_get,
check if the link state is up, write TX ring HP,
return the dp runtime refcount using dp_runtime_put.

cdp_runtime_suspend should reject the suspend, if dp_runtime_get is non
zero.
cdp_runtime_resume should wait until dp_runtime_get becomes zero or time
out, then flush pending tx for runtime suspend.

Change-Id: I7f38b3dc6975fcc208ad85e913564dfef5cc1cb7
CRs-Fixed: 2849002
parent 0594b969
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -1032,6 +1032,8 @@ QDF_STATUS pmo_core_psoc_bus_runtime_suspend(struct wlan_objmgr_psoc *psoc,
	if (status != QDF_STATUS_SUCCESS)
		goto resume_htc;

	hif_pm_set_link_state(hif_ctx, HIF_PM_LINK_STATE_DOWN);

	status = pmo_core_psoc_bus_suspend_req(psoc, QDF_RUNTIME_SUSPEND,
					       &wow_params);
	if (status != QDF_STATUS_SUCCESS)
@@ -1158,6 +1160,8 @@ QDF_STATUS pmo_core_psoc_bus_runtime_resume(struct wlan_objmgr_psoc *psoc,
	if (status != QDF_STATUS_SUCCESS)
		goto fail;

	hif_pm_set_link_state(hif_ctx, HIF_PM_LINK_STATE_UP);

	status = pmo_core_psoc_configure_resume(psoc, true);
	if (status != QDF_STATUS_SUCCESS)
		goto fail;