From 7494819d8f86c192fec35d241a6c074ab3aa0c29 Mon Sep 17 00:00:00 2001 From: Abhinav Kumar Date: Wed, 9 May 2018 17:17:50 +0530 Subject: [PATCH] qcacld-3.0: Do not flush disconnect command from sme on receiving connect If disconnect command is in SME pending queue, when connect command is received, the disconnect command is flushed and as SME is already in connected state the new connect command is handled as reassoc req and as no preauth was done with this new AP, SME does not call proper HDD callback to indicate conenct failure. Thus HDD remains stuck in connecting state leading to scans rejection. To fix this do not flush disconnect command from SME on receiving connect cmd and thus clean up the SME before connect is processed. Change-Id: Icefe8866a24b332688c64d8e69a11642fd7215d9 CRs-Fixed: 2238873 --- core/hdd/src/wlan_hdd_assoc.c | 15 +++++++++++---- core/sme/src/csr/csr_api_roam.c | 15 ++++++++------- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/core/hdd/src/wlan_hdd_assoc.c b/core/hdd/src/wlan_hdd_assoc.c index 9e1a920a4de82..475ffb830c94c 100644 --- a/core/hdd/src/wlan_hdd_assoc.c +++ b/core/hdd/src/wlan_hdd_assoc.c @@ -1776,12 +1776,12 @@ static QDF_STATUS hdd_dis_connect_handler(struct hdd_adapter *adapter, if ((eConnectionState_Disconnecting == sta_ctx->conn_info.connState) || (eConnectionState_NotConnected == + sta_ctx->conn_info.connState) || + (eConnectionState_Connecting == sta_ctx->conn_info.connState)) { hdd_debug("HDD has initiated a disconnect, no need to send disconnect indication to kernel"); sendDisconInd = false; - } - - if (sta_ctx->conn_info.connState != eConnectionState_Disconnecting) { + } else { INIT_COMPLETION(adapter->disconnect_comp_var); hdd_conn_set_connection_state(adapter, eConnectionState_Disconnecting); @@ -1894,7 +1894,14 @@ static QDF_STATUS hdd_dis_connect_handler(struct hdd_adapter *adapter, } /* Clear saved connection information in HDD */ hdd_conn_remove_connect_info(sta_ctx); - hdd_conn_set_connection_state(adapter, eConnectionState_NotConnected); + /* + * eConnectionState_Connecting state mean that connection is in + * progress so no need to set state to eConnectionState_NotConnected + */ + if ((eConnectionState_Connecting != sta_ctx->conn_info.connState)) { + hdd_conn_set_connection_state(adapter, + eConnectionState_NotConnected); + } pmo_ucfg_flush_gtk_offload_req(adapter->hdd_vdev); if ((QDF_STA_MODE == adapter->device_mode) || diff --git a/core/sme/src/csr/csr_api_roam.c b/core/sme/src/csr/csr_api_roam.c index f9b7ca625e4ce..9553e9653fcbd 100644 --- a/core/sme/src/csr/csr_api_roam.c +++ b/core/sme/src/csr/csr_api_roam.c @@ -3906,12 +3906,12 @@ static void csr_roam_remove_duplicate_pending_cmd_from_list( LL_ACCESS_NOLOCK); dup_cmd = GET_BASE_ADDR(entry, tSmeCmd, Link); /* - * Remove the previous command if.. - * - the new roam command is for the same RoamReason... - * - the new roam command is a NewProfileList. - * - the new roam command is a Forced Dissoc - * - the new roam command is from an 802.11 OID - * (OID_SSID or OID_BSSID). + * If command is not NULL remove the similar duplicate cmd for + * same reason as command. If command is NULL then check if + * roam_reason is eCsrForcedDisassoc (disconnect) and remove + * all roam command for the sessionId, else if roam_reason is + * eCsrHddIssued (connect) remove all connect (non disconenct) + * commands. */ if ((command && (command->sessionId == dup_cmd->sessionId) && ((command->command == dup_cmd->command) && @@ -3934,7 +3934,8 @@ static void csr_roam_remove_duplicate_pending_cmd_from_list( ((session_id == dup_cmd->sessionId) && (eSmeCommandRoam == dup_cmd->command) && ((eCsrForcedDisassoc == roam_reason) || - (eCsrHddIssued == roam_reason)))) { + (eCsrHddIssued == roam_reason && + !CSR_IS_DISCONNECT_COMMAND(dup_cmd))))) { sme_debug("RoamReason: %d", dup_cmd->u.roamCmd.roamReason); /* Remove the roam command from the pending list */