From 11df417c3b6972c68827a5ce152dbac89bd5d95c Mon Sep 17 00:00:00 2001 From: Yu Tian Date: Fri, 29 Jul 2022 02:10:41 -0700 Subject: [PATCH] qcacmn: Add Link stats check before ring access directly Throughput based RTPM logic of ring access may fail and lead to NOC error in some corner cases. Change is aimed to add additional link states check to prevent invalid SRNG access. Change-Id: I7e7edbadfd21b4857efa4faff0ada6d94d682f2c CRs-Fixed: 3256702 --- dp/wifi3.0/dp_tx.c | 6 +++++- hif/inc/hif.h | 7 +++++++ hif/src/hif_runtime_pm.c | 5 +++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/dp/wifi3.0/dp_tx.c b/dp/wifi3.0/dp_tx.c index 5a98aa25ba..6224d11c9e 100644 --- a/dp/wifi3.0/dp_tx.c +++ b/dp/wifi3.0/dp_tx.c @@ -1520,7 +1520,11 @@ dp_tx_check_and_flush_hp(struct dp_soc *soc, #ifdef FEATURE_RUNTIME_PM static inline int dp_get_rtpm_tput_policy_requirement(struct dp_soc *soc) { - return qdf_atomic_read(&soc->rtpm_high_tput_flag); + int ret; + + ret = qdf_atomic_read(&soc->rtpm_high_tput_flag) && + (hif_rtpm_get_state() <= HIF_RTPM_STATE_ON); + return ret; } /** * dp_tx_ring_access_end_wrapper() - Wrapper for ring access end diff --git a/hif/inc/hif.h b/hif/inc/hif.h index dfca7f0986..5168d6932d 100644 --- a/hif/inc/hif.h +++ b/hif/inc/hif.h @@ -1516,6 +1516,13 @@ int hif_runtime_resume(struct hif_opaque_softc *hif_ctx); * fastpath only applicable to legacy copy engine */ void hif_fastpath_resume(struct hif_opaque_softc *hif_ctx); + +/** + * hif_rtpm_get_state(): get rtpm link state + * + * Return: state + */ +int hif_rtpm_get_state(void); #else static inline QDF_STATUS hif_rtpm_register(uint32_t id, void (*hif_rpm_cbk)(void)) diff --git a/hif/src/hif_runtime_pm.c b/hif/src/hif_runtime_pm.c index d633187c1e..0c78863964 100644 --- a/hif/src/hif_runtime_pm.c +++ b/hif/src/hif_runtime_pm.c @@ -1025,6 +1025,11 @@ void hif_rtpm_set_state(enum hif_rtpm_state state) qdf_atomic_set(&gp_hif_rtpm_ctx->pm_state, state); } +int hif_rtpm_get_state(void) +{ + return qdf_atomic_read(&gp_hif_rtpm_ctx->pm_state); +} + int hif_pre_runtime_suspend(struct hif_opaque_softc *hif_ctx) { if (!hif_can_suspend_link(hif_ctx)) {