From 6b01576aa836b17dec0c545102ab695378f74f24 Mon Sep 17 00:00:00 2001 From: Agrawal Ashish Date: Thu, 5 May 2016 11:22:18 +0530 Subject: [PATCH] qcacld-3.0: Change conn_state to connecting before sme_roam_connect qcacld-2.0 to qcacld-3.0 propagation sme_roam_connect() has a direct path to call hdd_sme_roam_callback(), which will change the conn_state. If direct path, conn_state will be accordingly changed to NotConnected or Associated. Driver is not changing connection state to eConnectionState_Connecting when connecting with iwconfig. If connection state is not changed, connection state will remain in eConnectionState_NotConnected state. In hdd_association_completion_handler, "hddDisconInProgress" is set to true if conn state is eConnectionState_NotConnected. If "hddDisconInProgress" is set to true then cfg80211 layer is not informed of connect result indication which is an issue. Change-Id: Ieeaef582a04aa90ddcdcc373b00b68442c795337 CRs-Fixed: 900008 --- core/hdd/src/wlan_hdd_assoc.c | 33 ++++++++++++++++++++++++++ core/hdd/src/wlan_hdd_cfg80211.c | 40 +++++++++++++++++++++----------- 2 files changed, 59 insertions(+), 14 deletions(-) diff --git a/core/hdd/src/wlan_hdd_assoc.c b/core/hdd/src/wlan_hdd_assoc.c index 6bd256cd88..d1464e4d5e 100644 --- a/core/hdd/src/wlan_hdd_assoc.c +++ b/core/hdd/src/wlan_hdd_assoc.c @@ -5001,8 +5001,41 @@ static int __iw_set_essid(struct net_device *dev, (WLAN_HDD_GET_CTX(pAdapter))->config-> AdHocChannel5G); } + /* + * Change conn_state to connecting before sme_roam_connect(), + * because sme_roam_connect() has a direct path to call + * hdd_sme_roam_callback(), which will change the conn_state + * If direct path, conn_state will be accordingly changed to + * NotConnected or Associated by either + * hdd_association_completion_handler() or hdd_dis_connect_handler() + * in sme_RoamCallback()if sme_RomConnect is to be queued, + * Connecting state will remain until it is completed. + * + * If connection state is not changed, + * connection state will remain in eConnectionState_NotConnected state. + * In hdd_association_completion_handler, "hddDisconInProgress" is + * set to true if conn state is eConnectionState_NotConnected. + * If "hddDisconInProgress" is set to true then cfg80211 layer is not + * informed of connect result indication which is an issue. + */ + if (QDF_STA_MODE == pAdapter->device_mode || + QDF_P2P_CLIENT_MODE == pAdapter->device_mode) { + hdd_info("Set HDD connState to eConnectionState_Connecting"); + hdd_conn_set_connection_state(pAdapter, + eConnectionState_Connecting); + } + status = sme_roam_connect(hHal, pAdapter->sessionId, &(pWextState->roamProfile), &roamId); + if ((QDF_STATUS_SUCCESS != status) && + (QDF_STA_MODE == pAdapter->device_mode || + QDF_P2P_CLIENT_MODE == pAdapter->device_mode)) { + hdd_err("sme_roam_connect (session %d) failed with status %d. -> NotConnected", + pAdapter->sessionId, status); + /* change back to NotAssociated */ + hdd_conn_set_connection_state(pAdapter, + eConnectionState_NotConnected); + } pRoamProfile->ChannelInfo.ChannelList = NULL; pRoamProfile->ChannelInfo.numOfChannels = 0; diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c index 19b32c7555..1a21f97ae2 100644 --- a/core/hdd/src/wlan_hdd_cfg80211.c +++ b/core/hdd/src/wlan_hdd_cfg80211.c @@ -8583,20 +8583,6 @@ int wlan_hdd_cfg80211_connect_start(hdd_adapter_t *pAdapter, return -EINVAL; } - /* change conn_state to connecting before sme_roam_connect(), because sme_roam_connect() - * has a direct path to call hdd_sme_roam_callback(), which will change the conn_state - * If direct path, conn_state will be accordingly changed to NotConnected or Associated - * by either hdd_association_completion_handler() or hdd_dis_connect_handler() in sme_RoamCallback() - * if sme_RomConnect is to be queued, Connecting state will remain until it is completed. - */ - if (QDF_STA_MODE == pAdapter->device_mode || - QDF_P2P_CLIENT_MODE == pAdapter->device_mode) { - hddLog(LOG1, - FL("Set HDD connState to eConnectionState_Connecting")); - hdd_conn_set_connection_state(pAdapter, - eConnectionState_Connecting); - } - /* After 8-way handshake supplicant should give the scan command * in that it update the additional IEs, But because of scan * enhancements, the supplicant is not issuing the scan command now. @@ -8652,6 +8638,32 @@ int wlan_hdd_cfg80211_connect_start(hdd_adapter_t *pAdapter, pHddCtx->config->nChannelBondingMode24GHz; sme_update_config(pHddCtx->hHal, sme_config); qdf_mem_free(sme_config); + /* + * Change conn_state to connecting before sme_roam_connect(), + * because sme_roam_connect() has a direct path to call + * hdd_sme_roam_callback(), which will change the conn_state + * If direct path, conn_state will be accordingly changed to + * NotConnected or Associated by either + * hdd_association_completion_handler() or + * hdd_dis_connect_handler() in sme_RoamCallback()if + * sme_RomConnect is to be queued, + * Connecting state will remain until it is completed. + * + * If connection state is not changed, connection state will + * remain in eConnectionState_NotConnected state. + * In hdd_association_completion_handler, "hddDisconInProgress" + * is set to true if conn state is + * eConnectionState_NotConnected. + * If "hddDisconInProgress" is set to true then cfg80211 layer + * is not informed of connect result indication which + * is an issue. + */ + if (QDF_STA_MODE == pAdapter->device_mode || + QDF_P2P_CLIENT_MODE == pAdapter->device_mode) { + hdd_info("Set HDD connState to eConnectionState_Connecting"); + hdd_conn_set_connection_state(pAdapter, + eConnectionState_Connecting); + } status = sme_roam_connect(WLAN_HDD_GET_HAL_CTX(pAdapter), pAdapter->sessionId, pRoamProfile,