summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYeshwanth Sriram Guntuka <ysriramg@codeaurora.org>2018-01-19 13:18:40 +0530
committerGerrit - the friendly Code Review server <code-review@localhost>2018-01-19 04:00:11 -0800
commitda1f84538893caf2988ee049866dfa63a99ffafa (patch)
tree6bd8e986bdf7699e94236cdfcb83db73fe2356d7
parent392ab0426f9d61fd3e3a66b7682d2ff8da908ccf (diff)
qcacld-2.0: Wait for disconnect to complete, even if diconnect req is not queued
If SME is in disconnecting state disconnect from supplicant will not get queued. Thus supplicant can start a connect req as soon as HDD returns from disconnect req. If this connect req is processed by HDD before the SME disconnect is indicated to HDD, it will cause HDD/supplicant and SME out of sync. This results into scan allowed even when SME is waiting for key. SME will not allow scan until set key is completed, which may not happened as HDD has indicated disconnect to supplicant after connect was received by HDD. To fix this wait for WLAN_WAIT_DISCONNECT_ALREADY_IN_PROGRESS time in HDD for SME disconnect to get processed before returning. Change-Id: I21f2c2e2f9b97fc50f9ac43bc5bbb5fd5188f3b7 CRs-Fixed: 2175203
-rw-r--r--CORE/HDD/inc/wlan_hdd_main.h1
-rw-r--r--CORE/HDD/src/wlan_hdd_cfg80211.c14
2 files changed, 13 insertions, 2 deletions
diff --git a/CORE/HDD/inc/wlan_hdd_main.h b/CORE/HDD/inc/wlan_hdd_main.h
index c9db52a7bbdc..ba12da36ab51 100644
--- a/CORE/HDD/inc/wlan_hdd_main.h
+++ b/CORE/HDD/inc/wlan_hdd_main.h
@@ -109,6 +109,7 @@
/** Maximum time(ms)to wait for disconnect to complete **/
#define WLAN_WAIT_TIME_DISCONNECT 5000
+#define WLAN_WAIT_DISCONNECT_ALREADY_IN_PROGRESS 1000
#define WLAN_WAIT_TIME_STATS 800
#define WLAN_WAIT_TIME_POWER 800
#define WLAN_WAIT_TIME_COUNTRY 1000
diff --git a/CORE/HDD/src/wlan_hdd_cfg80211.c b/CORE/HDD/src/wlan_hdd_cfg80211.c
index 03fd12441371..699f073cec63 100644
--- a/CORE/HDD/src/wlan_hdd_cfg80211.c
+++ b/CORE/HDD/src/wlan_hdd_cfg80211.c
@@ -24203,6 +24203,7 @@ int wlan_hdd_disconnect( hdd_adapter_t *pAdapter, u16 reason )
hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
hdd_context_t *pHddCtx = WLAN_HDD_GET_CTX(pAdapter);
eConnectionState prev_conn_state;
+ uint32_t wait_time = WLAN_WAIT_TIME_DISCONNECT;
ENTER();
@@ -24230,7 +24231,15 @@ int wlan_hdd_disconnect( hdd_adapter_t *pAdapter, u16 reason )
hddLog(LOG1,
FL("status = %d, already disconnected"), status);
result = 0;
- goto disconnected;
+ /*
+ * Wait here instead of returning directly. This will block the
+ * next connect command and allow processing of the disconnect
+ * in SME else we might hit some race conditions leading to SME
+ * and HDD out of sync. As disconnect is already in progress,
+ * wait here for 1 sec instead of 5 sec.
+ */
+ wait_time = WLAN_WAIT_DISCONNECT_ALREADY_IN_PROGRESS;
+ goto wait_for_disconnect;
}
/*
* Wait here instead of returning directly, this will block the next
@@ -24249,9 +24258,10 @@ int wlan_hdd_disconnect( hdd_adapter_t *pAdapter, u16 reason )
result = -EINVAL;
goto disconnected;
}
+wait_for_disconnect:
rc = wait_for_completion_timeout(
&pAdapter->disconnect_comp_var,
- msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT));
+ msecs_to_jiffies(wait_time));
if (!rc && (eHAL_STATUS_CMD_NOT_QUEUED != status)) {
hddLog(VOS_TRACE_LEVEL_ERROR,