From e5724cc36e25495c4a4c1558d848aaef9912f127 Mon Sep 17 00:00:00 2001 From: gaurank kathpalia Date: Wed, 21 Aug 2019 16:32:25 +0530 Subject: [PATCH] qcacld-3.0: Prevent wlan suspend if conn in progress Currently the driver does not check if the state is key exchange in progress and suspends wlan before set-key happens which further results in FW also in wake up state. This would result in delayed EAP exchange, and also in power loss. Scenario:- 1. Turn on STA and try to connect to enterprise network 2. Turn off display. Here the display turn off would trigger APPS suspend while the STA is trying to connect, and authenticate and since there is no check in driver to prevent suspend in set key in progress state, it would result in a FW assert, as the expectation of FW is to allow suspend only after set key has been done. Fix is to prevent WLAN-suspend in case of connection in progress, and allow suspend only in connected and authenticated state. Change-Id: Ic173116f7ba424005d938a43c75831a6a4dc874c CRs-Fixed: 2512866 --- core/hdd/src/wlan_hdd_power.c | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/core/hdd/src/wlan_hdd_power.c b/core/hdd/src/wlan_hdd_power.c index 3fe1a9916b16..7818c2dbcbf4 100644 --- a/core/hdd/src/wlan_hdd_power.c +++ b/core/hdd/src/wlan_hdd_power.c @@ -1806,23 +1806,15 @@ static int __wlan_hdd_cfg80211_suspend_wlan(struct wiphy *wiphy, ucfg_p2p_cleanup_tx_by_psoc(hdd_ctx->psoc); ucfg_p2p_cleanup_roc_by_psoc(hdd_ctx->psoc); - /* Stop ongoing scan on each interface */ - hdd_for_each_adapter(hdd_ctx, adapter) { - if (sme_neighbor_middle_of_roaming(mac_handle, - adapter->vdev_id) || - hdd_is_roaming_in_progress(hdd_ctx)) { - hdd_err("Roaming in progress, do not allow suspend"); - wlan_hdd_inc_suspend_stats(hdd_ctx, - SUSPEND_FAIL_ROAM); - return -EAGAIN; - } - - wlan_abort_scan(hdd_ctx->pdev, INVAL_PDEV_ID, - adapter->vdev_id, INVALID_SCAN_ID, false); + if (hdd_is_connection_in_progress(NULL, NULL)) { + hdd_err_rl("Connection is in progress, rejecting suspend"); + return -EINVAL; } - /* flush any pending powersave timers */ + /* abort ongoing scan and flush any pending powersave timers */ hdd_for_each_adapter(hdd_ctx, adapter) { + wlan_abort_scan(hdd_ctx->pdev, INVAL_PDEV_ID, + adapter->vdev_id, INVALID_SCAN_ID, false); if (wlan_hdd_validate_vdev_id(adapter->vdev_id)) continue;