summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAbhishek Singh <absingh@codeaurora.org>2018-06-05 10:04:08 +0530
committernshrivas <nshrivas@codeaurora.org>2018-06-07 16:17:38 -0700
commitc6baa67b541d5e4a93fa46a097e7dd34766b22a2 (patch)
tree7b238c553b6dcdec60711791bb3997d7cbe82baf
parent180454ec58b61e56acb7520132fe9855294de90e (diff)
qcacld-3.0: Avoid timeout in case of back to back connect req
In case of back to back connect req, if the 1st connect is in scan for ssid phase, the 2nd connect req try to cleanup the 1st connect and wait for disconnect complete variable for 5 sec. In this scenario as cleanup is pending the scan for ssid will fail and result in the association failure. But in association failure the disconnect complete variable is not completed and thus the 2nd connect req keeps on waiting for 5 sec. To fix this complete the disconnect complete variable in association failure, if reason is scan for ssid failure and hdd disconnect is pending. Change-Id: Ibc0cfb72d04442e82847dd624ede15eda340b766 CRs-Fixed: 2256376
-rw-r--r--core/hdd/src/wlan_hdd_assoc.c10
-rw-r--r--core/hdd/src/wlan_hdd_cfg80211.c37
2 files changed, 36 insertions, 11 deletions
diff --git a/core/hdd/src/wlan_hdd_assoc.c b/core/hdd/src/wlan_hdd_assoc.c
index 681989c10753..8aa30132d3de 100644
--- a/core/hdd/src/wlan_hdd_assoc.c
+++ b/core/hdd/src/wlan_hdd_assoc.c
@@ -3251,12 +3251,22 @@ static QDF_STATUS hdd_association_completion_handler(hdd_adapter_t *pAdapter,
hdd_conn_set_connection_state(pAdapter,
eConnectionState_NotConnected);
}
+
hdd_wmm_init(pAdapter);
hdd_debug("Disabling queues");
wlan_hdd_netif_queue_control(pAdapter,
WLAN_STOP_ALL_NETIF_QUEUE_N_CARRIER,
WLAN_CONTROL_PATH);
+ /*
+ * if hddDisconInProgress is set and roamResult is
+ * eCSR_ROAM_RESULT_SCAN_FOR_SSID_FAILURE that mean HDD is
+ * waiting on disconnect_comp_var so unblock anyone waiting for
+ * disconnect to complete.
+ */
+ if ((roamResult == eCSR_ROAM_RESULT_SCAN_FOR_SSID_FAILURE) &&
+ hddDisconInProgress)
+ complete(&pAdapter->disconnect_comp_var);
}
if (QDF_STATUS_SUCCESS != cds_check_and_restart_sap(
diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c
index e99813cab363..db9b7632f13f 100644
--- a/core/hdd/src/wlan_hdd_cfg80211.c
+++ b/core/hdd/src/wlan_hdd_cfg80211.c
@@ -18028,6 +18028,7 @@ int wlan_hdd_try_disconnect(hdd_adapter_t *pAdapter)
hdd_context_t *hdd_ctx;
int status, result = 0;
tHalHandle hal;
+ uint32_t wait_time = WLAN_WAIT_TIME_DISCONNECT;
hdd_ctx = WLAN_HDD_GET_CTX(pAdapter);
pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
@@ -18063,6 +18064,9 @@ int wlan_hdd_try_disconnect(hdd_adapter_t *pAdapter)
(eConnectionState_Associated == pHddStaCtx->conn_info.connState) ||
(eConnectionState_Connecting == pHddStaCtx->conn_info.connState) ||
(eConnectionState_IbssConnected == pHddStaCtx->conn_info.connState)) {
+ eConnectionState prev_conn_state;
+
+ prev_conn_state = pHddStaCtx->conn_info.connState;
hdd_conn_set_connection_state(pAdapter,
eConnectionState_Disconnecting);
/* Issue disconnect to CSR */
@@ -18071,13 +18075,25 @@ int wlan_hdd_try_disconnect(hdd_adapter_t *pAdapter)
status = sme_roam_disconnect(WLAN_HDD_GET_HAL_CTX(pAdapter),
pAdapter->sessionId,
eCSR_DISCONNECT_REASON_UNSPECIFIED);
- /*
- * 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 (QDF_STATUS_CMD_NOT_QUEUED == status) {
+
+ if ((status == QDF_STATUS_CMD_NOT_QUEUED) &&
+ prev_conn_state != eConnectionState_Connecting) {
+ hdd_debug("Already disconnect in progress");
+ result = 0;
+ /*
+ * Wait here instead of returning directly. This will
+ * block the connect command and allow processing
+ * of the disconnect in SME. As disconnect is already
+ * in progress, wait here for 1 sec instead of 5 sec.
+ */
+ wait_time = WLAN_WAIT_DISCONNECT_ALREADY_IN_PROGRESS;
+ } else if (status == QDF_STATUS_CMD_NOT_QUEUED) {
+ /*
+ * Wait here instead of returning directly, this will
+ * block the connect command and allow processing
+ * of the scan for ssid and the previous connect command
+ * in CSR.
+ */
hdd_debug("Already disconnected or connect was in sme/roam pending list and removed by disconnect");
} else if (0 != status) {
hdd_err("sme_roam_disconnect failure, status: %d",
@@ -18087,9 +18103,8 @@ int wlan_hdd_try_disconnect(hdd_adapter_t *pAdapter)
goto disconnected;
}
- rc = wait_for_completion_timeout(
- &pAdapter->disconnect_comp_var,
- msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT));
+ rc = wait_for_completion_timeout(&pAdapter->disconnect_comp_var,
+ msecs_to_jiffies(wait_time));
if (!rc && (QDF_STATUS_CMD_NOT_QUEUED != status)) {
hdd_err("Sme disconnect event timed out session Id: %d staDebugState: %d",
pAdapter->sessionId, pHddStaCtx->staDebugState);
@@ -18098,7 +18113,7 @@ int wlan_hdd_try_disconnect(hdd_adapter_t *pAdapter)
} else if (eConnectionState_Disconnecting ==
pHddStaCtx->conn_info.connState) {
rc = wait_for_completion_timeout(&pAdapter->disconnect_comp_var,
- msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT));
+ msecs_to_jiffies(wait_time));
if (!rc) {
hdd_err("Disconnect event timed out session Id: %d staDebugState: %d",
pAdapter->sessionId, pHddStaCtx->staDebugState);