From 52456c60442916db07a64cabdc33776d3f96bac2 Mon Sep 17 00:00:00 2001 From: "Padma, Santhosh Kumar" Date: Thu, 5 Jan 2017 12:14:08 +0530 Subject: [PATCH] qcacld-3.0: Avoid waiting if driver is not in connecting stage qcacld-2.0 to qcacld-3.0 propagation If disconnect is already in progress because of deauth received from AP when disconnect is also received from supplicant, there is a possibility that completion variable disconnect_comp_var gets reset in hdd_DisConnectHandler because of disconnection in progress from AP before completion variable disconnect_comp_var gets initialized in wlan_hdd_disconnect to handle disconnect from supplicant. This can cause a delay of 5 seconds eventhough disconnect was already happened. This waiting is not required when previous connection status was not eConnectionState_Connecting. Fix this delay by adding a check to avoid waiting when previous connection status was not eConnectionState_Connecting. Change-Id: I58ac638622c5164fa1e9fe45c52ebf60fab2340f CRs-Fixed: 1093562 --- core/hdd/src/wlan_hdd_cfg80211.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c index 054492e0c7ba..0b814c8bfd44 100644 --- a/core/hdd/src/wlan_hdd_cfg80211.c +++ b/core/hdd/src/wlan_hdd_cfg80211.c @@ -14115,6 +14115,7 @@ static int wlan_hdd_disconnect(hdd_adapter_t *pAdapter, u16 reason) unsigned long rc; hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter); hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter); + eConnectionState prev_conn_state; ENTER(); @@ -14123,6 +14124,8 @@ static int wlan_hdd_disconnect(hdd_adapter_t *pAdapter, u16 reason) if (0 != status) return status; + prev_conn_state = pHddStaCtx->conn_info.connState; + /*stop tx queues */ hdd_notice("Disabling queues"); wlan_hdd_netif_queue_control(pAdapter, WLAN_NETIF_TX_DISABLE_N_CARRIER, @@ -14135,13 +14138,18 @@ static int wlan_hdd_disconnect(hdd_adapter_t *pAdapter, u16 reason) status = sme_roam_disconnect(WLAN_HDD_GET_HAL_CTX(pAdapter), pAdapter->sessionId, reason); - /* - * Wait here instead of returning directly, this will block the next - * connect command and allow processing of the scan for ssid and - * the previous connect command in CSR. Else we might hit some - * race conditions leading to SME and HDD out of sync. - */ - if (QDF_STATUS_CMD_NOT_QUEUED == status) { + if ((QDF_STATUS_CMD_NOT_QUEUED == status) && + prev_conn_state != eConnectionState_Connecting) { + hdd_notice("status = %d, already disconnected", status); + result = 0; + goto disconnected; + } else if (QDF_STATUS_CMD_NOT_QUEUED == status) { + /* + * Wait here instead of returning directly, this will block the + * next connect command and allow processing of the scan for + * ssid and the previous connect command in CSR. Else we might + * hit some race conditions leading to SME and HDD out of sync. + */ hdd_info("Already disconnected or connect was in sme/roam pending list and removed by disconnect"); } else if (0 != status) { hdd_err("csr_roam_disconnect failure, returned %d",