From 7c43a7a55f6f3075ac2ed241e2ddea81d0718bb2 Mon Sep 17 00:00:00 2001 From: Vignesh Viswanathan Date: Mon, 24 Sep 2018 15:52:47 +0530 Subject: [PATCH] qcacld-3.0: Check SME connection status before issuing reassoc Currently when the supplicant sends a connect with bssid_hint and prev_bssid, driver issues a roam_invoke (fast reassoc) command to the FW. However, when this connect is received in the supplicant context and if the driver is currently processing a disassoc/deauth from the AP in the mc thread, then the CSR roam connection state would not be associated but the HDD STA context connection state would still be associated. In this scenario, since the disconnection is in progress and VDEV Down might already be sent to the FW, the roam_invoke command is ignored and FW does not send any response. However the driver assumes that roaming is in progress and blocks all incoming scan/ connect requests from supplicant leading to a state where no further connections can go through. In hdd_reassoc, check the CSR Connection state also to check if the current state is associated and then issue roam_invoke to FW. Change-Id: I321e99b060d6ce22517a3dd604b0f4d08dd5918d CRs-Fixed: 2319641 --- core/hdd/src/wlan_hdd_ioctl.c | 14 ++++++++++++-- core/sme/inc/sme_api.h | 12 ++++++++++++ core/sme/src/common/sme_api.c | 7 +++++++ 3 files changed, 31 insertions(+), 2 deletions(-) diff --git a/core/hdd/src/wlan_hdd_ioctl.c b/core/hdd/src/wlan_hdd_ioctl.c index 004b1085d28f..38e5f882b73e 100644 --- a/core/hdd/src/wlan_hdd_ioctl.c +++ b/core/hdd/src/wlan_hdd_ioctl.c @@ -710,8 +710,18 @@ int hdd_reassoc(struct hdd_adapter *adapter, const uint8_t *bssid, sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter); - /* if not associated, no need to proceed with reassoc */ - if (eConnectionState_Associated != sta_ctx->conn_info.connState) { + /* + * pHddStaCtx->conn_info.connState is set to disconnected only + * after the disconnect done indication from SME. If the SME is + * in the process of disconnecting, the SME Connection state is + * set to disconnected and the pHddStaCtx->conn_info.connState + * will still be associated till the disconnect is done. + * So check both the HDD state and SME state here. + * If not associated, no need to proceed with reassoc + */ + if ((eConnectionState_Associated != sta_ctx->conn_info.connState) || + (!sme_is_conn_state_connected(hdd_ctx->mac_handle, + adapter->session_id))) { hdd_warn("Not associated"); ret = -EINVAL; goto exit; diff --git a/core/sme/inc/sme_api.h b/core/sme/inc/sme_api.h index 454633f8eeea..ffea233ea0a2 100644 --- a/core/sme/inc/sme_api.h +++ b/core/sme/inc/sme_api.h @@ -2265,6 +2265,18 @@ static inline QDF_STATUS sme_set_he_bss_color(tHalHandle hal, } #endif +/** + * sme_is_conn_state_connected() -- check if SME connection state is connected + * @hal: global hal handle + * @session_id: current Session Id + * + * This API checks if the current SME connection state is connected for the + * given session id. + * + * Return: True if connected, false if any other state. + */ +bool sme_is_conn_state_connected(mac_handle_t hal, uint8_t session_id); + /** * sme_scan_get_result_for_bssid - gets the scan result from scan cache for the * bssid specified diff --git a/core/sme/src/common/sme_api.c b/core/sme/src/common/sme_api.c index a3ca045a50e4..0798d8e8a9cd 100644 --- a/core/sme/src/common/sme_api.c +++ b/core/sme/src/common/sme_api.c @@ -15990,6 +15990,13 @@ static bool sme_get_status_for_candidate(tHalHandle hal, return false; } +bool sme_is_conn_state_connected(mac_handle_t hal, uint8_t session_id) +{ + tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal); + + return csr_is_conn_state_connected(mac_ctx, session_id); +} + /** * wlan_hdd_get_bss_transition_status() - get bss transition status all cadidates * @adapter : Pointer to adapter