From acfdc92a124486308e9f2d75d4aa7e5dc4c64309 Mon Sep 17 00:00:00 2001 From: Abhishek Singh Date: Wed, 30 Dec 2015 17:31:21 +0530 Subject: [PATCH] qcacld-3.0: Remove roam cmd from sme active list in case of failure qcacld-2.0 to qcacld-3.0 propagation -In case CSR is already connected and it receives connect with the same profile, csr will silently return and try to send the connect success to HDD. But if roamInfo staId is 0 this roam command is not removed from sme active list and leads to active list timeout. This back to back connect to CSR can happen if HDD and CSR go out of sync and is taken care already. -Also if disconnect is received in case scan for ssid is in progress it will be dropped and roam session state is set to disconnecting. But this roam session state is not reset for the fresh connection and thus if next connect also issue scan for ssid the connect command will be dropped assuming disconnect is in progress. This change removes roam cmd from sme active list in case of above failure and resets roam session state for fresh connections. Also does some cleanup in HDD disconnect command. Change-Id: I222626f1da6bdad83a5264668dde9aafd3dda149 CRs-Fixed: 953196 --- core/hdd/src/wlan_hdd_cfg80211.c | 8 ++++++-- core/sme/src/csr/csr_api_roam.c | 18 +++++++++++++++--- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c index 20f73e649a5a..14588985eff6 100644 --- a/core/hdd/src/wlan_hdd_cfg80211.c +++ b/core/hdd/src/wlan_hdd_cfg80211.c @@ -8949,10 +8949,15 @@ 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 (CDF_STATUS_CMD_NOT_QUEUED == status) { hddLog(LOG1, FL("status = %d, already disconnected"), (int)status); - goto disconnected; } else if (0 != status) { hddLog(LOGE, FL("csr_roam_disconnect failure, returned %d"), @@ -9130,7 +9135,6 @@ static int __wlan_hdd_cfg80211_disconnect(struct wiphy *wiphy, hddLog(LOG1, FL("convert to internal reason %d to reasonCode %d"), reason, reasonCode); - pHddStaCtx->conn_info.connState = eConnectionState_NotConnected; pScanInfo = &pAdapter->scan_info; if (pScanInfo->mScanPending) { hddLog(LOG1, diff --git a/core/sme/src/csr/csr_api_roam.c b/core/sme/src/csr/csr_api_roam.c index b7a9aefb3711..b5af6635e9bc 100644 --- a/core/sme/src/csr/csr_api_roam.c +++ b/core/sme/src/csr/csr_api_roam.c @@ -6644,10 +6644,9 @@ static bool csr_roam_process_results(tpAniSirGlobal mac_ctx, tSmeCmd *cmd, roam_info.pbFrames = session->connectedInfo.pbFrames; roam_info.staId = session->connectedInfo.staId; roam_info.u.pConnectedProfile = &session->connectedProfile; - if (0 == roam_info.staId) { + if (0 == roam_info.staId) CDF_ASSERT(0); - return false; - } + session->bRefAssocStartCnt--; csr_roam_call_callback(mac_ctx, session_id, &roam_info, cmd->u.roamCmd.roamId, @@ -7196,6 +7195,19 @@ CDF_STATUS csr_roam_connect(tpAniSirGlobal pMac, uint32_t sessionId, &pSession->connectedProfile.SSID, &pProfile->SSIDs)) csr_roam_issue_disassociate_cmd(pMac, sessionId, eCSR_DISCONNECT_REASON_UNSPECIFIED); + /* + * If roamSession.connectState is disconnecting that mean + * disconnect was received with scan for ssid in progress + * and dropped. This state will ensure that connect will + * not be issued from scan for ssid completion. Thus + * if this fresh connect also issue scan for ssid the connect + * command will be dropped assuming disconnect is in progress. + * Thus reset connectState here + */ + if (eCSR_ASSOC_STATE_TYPE_INFRA_DISCONNECTING == + pMac->roam.roamSession[sessionId].connectState) + pMac->roam.roamSession[sessionId].connectState = + eCSR_ASSOC_STATE_TYPE_NOT_CONNECTED; #ifdef FEATURE_WLAN_BTAMP_UT_RF pSession->maxRetryCount = CSR_JOIN_MAX_RETRY_COUNT; #endif