wlan: Fix conn_state stuck connecting and scan return -EBUSY.
sme_RoamConnect() has a direct path (when roamCmdPendingList is empty)
to call hdd_smeRoamCallback(). inturn it calls either
hdd_AssociationCompletionHandler() or hdd_DisConnectHandler(), where
conn_state accordingly changed to NotConnected or Associated.
After sme_RoamConnect() is returned SUCESS, we wrongly set to conn_state
to Connecting
- Fixes change conn_state to Connecting before sme_RoamConnect()
- When sme_RoamConnect() return succeed, we do not need to modify
conn_state. It will be either remain connecting (if the connection is
pending) or it may be already set to correct state (NotConnected or
Asosciated).
- If sme_RoamConnect() return failures, revert Connecting to
NotConnected.
Change-Id: I96c48a949f791c654d88d343826bb89c7aba3dce
CR-Fixed: 422187
diff --git a/CORE/HDD/src/wlan_hdd_cfg80211.c b/CORE/HDD/src/wlan_hdd_cfg80211.c
index 70e6fe9..ad9ac0c 100644
--- a/CORE/HDD/src/wlan_hdd_cfg80211.c
+++ b/CORE/HDD/src/wlan_hdd_cfg80211.c
@@ -3882,7 +3882,8 @@
(WLAN_HDD_GET_STATION_CTX_PTR(pAdapter))->conn_info.connState) )
{
hddLog(VOS_TRACE_LEVEL_ERROR,
- "%s: Connection in progress: Scan request denied (EBUSY)", __func__);
+ "%s: %p(%d) Connection in progress: Scan request denied (EBUSY)", __func__, \
+ WLAN_HDD_GET_STATION_CTX_PTR(pAdapter), pAdapter->sessionId);
return -EBUSY;
}
@@ -4356,24 +4357,29 @@
pRoamProfile->ChannelInfo.numOfChannels = 1;
}
+ /* change conn_state to connecting before sme_RoamConnect(), because sme_RoamConnect()
+ * has a direct path to call hdd_smeRoamCallback(), which will change the conn_state
+ * If direct path, conn_state will be accordingly changed to NotConnected or Associated
+ * by either hdd_AssociationCompletionHandler() or hdd_DisConnectHandler() in sme_RoamCallback()
+ */
+ hdd_connSetConnectionState(WLAN_HDD_GET_STATION_CTX_PTR(pAdapter),
+ eConnectionState_Connecting);
+
status = sme_RoamConnect( WLAN_HDD_GET_HAL_CTX(pAdapter),
pAdapter->sessionId, pRoamProfile, &roamId);
pRoamProfile->ChannelInfo.ChannelList = NULL;
pRoamProfile->ChannelInfo.numOfChannels = 0;
- if( (eHAL_STATUS_SUCCESS == status) &&
+ if( (eHAL_STATUS_SUCCESS != status) &&
(WLAN_HDD_INFRA_STATION == pAdapter->device_mode) )
{
+ hddLog(VOS_TRACE_LEVEL_ERROR, "%s: sme_RoamConnect (session %d) failed with "
+ "status %d. -> NotConnected", __func__, pAdapter->sessionId, status);
+ /* change back to NotAssociated */
hdd_connSetConnectionState(WLAN_HDD_GET_STATION_CTX_PTR(pAdapter),
- eConnectionState_Connecting);
- }
-
- if( status != eHAL_STATUS_SUCCESS )
- {
- hddLog(VOS_TRACE_LEVEL_ERROR, "%s: sme_RoamConnect failed with "
- "status %d", __func__, status);
+ eConnectionState_NotConnected);
}
}
else