From ed315cdbdd0b3170c6ff176594f376e99c2af5d3 Mon Sep 17 00:00:00 2001 From: Vevek Venkatesan Date: Mon, 10 Jun 2019 23:35:19 +0530 Subject: [PATCH] qcacld-3.0: Fix race condition in sending STA IPA offload enable During resource unloading, if two next to next client connect request comes, one is handled in pending event handler in wlan_ipa_uc_op_cb callback after processing FW TX suspend response and other one is handled in scheduler thread, this causes race condition in sending IPA offload enable for STA iface. So send IPA enable req to FW before queuing the client connect event to the pending events. Change-Id: Ifcabc2481e590e5e128434614c4b46fe53a34636 CRs-Fixed: 2460573 --- components/ipa/core/src/wlan_ipa_core.c | 33 ++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/components/ipa/core/src/wlan_ipa_core.c b/components/ipa/core/src/wlan_ipa_core.c index a778385f2361..4828589afb32 100644 --- a/components/ipa/core/src/wlan_ipa_core.c +++ b/components/ipa/core/src/wlan_ipa_core.c @@ -1527,6 +1527,24 @@ bool wlan_ipa_is_fw_wdi_activated(struct wlan_ipa_priv *ipa_ctx) } #endif +static inline +bool wlan_sap_no_client_connected(struct wlan_ipa_priv *ipa_ctx) +{ + return !(ipa_ctx->sap_num_connected_sta); +} + +static inline +bool wlan_sta_is_connected(struct wlan_ipa_priv *ipa_ctx) +{ + return ipa_ctx->sta_connected; +} + +static inline +bool wlan_ipa_uc_is_loaded(struct wlan_ipa_priv *ipa_ctx) +{ + return ipa_ctx->uc_loaded; +} + /** * wlan_ipa_uc_offload_enable_disable() - wdi enable/disable notify to fw * @ipa_ctx: global IPA context @@ -1659,10 +1677,23 @@ static QDF_STATUS __wlan_ipa_wlan_evt(qdf_netdev_t net_dev, uint8_t device_mode, ipa_ctx->resource_loading ? "load" : "unload"); - if (type == QDF_IPA_AP_DISCONNECT) + if (type == QDF_IPA_AP_DISCONNECT) { wlan_ipa_uc_offload_enable_disable(ipa_ctx, SIR_AP_RX_DATA_OFFLOAD, session_id, false); + } else if (type == QDF_IPA_CLIENT_CONNECT_EX && + wlan_sap_no_client_connected(ipa_ctx)) { + if (wlan_sta_is_connected(ipa_ctx) && + wlan_ipa_uc_is_loaded(ipa_ctx) && + wlan_ipa_uc_sta_is_enabled(ipa_ctx-> + config) && + !wlan_ipa_is_sta_only_offload_enabled()) { + wlan_ipa_uc_offload_enable_disable( + ipa_ctx, + SIR_STA_RX_DATA_OFFLOAD, + sta_session_id, true); + } + } qdf_mutex_acquire(&ipa_ctx->ipa_lock);