Browse Source

qcacld-3.0: Set disconnection in progress after starting disconnect

Currently, discon_in_progress flag is set in SME from HDD when
there is a disconnection request. But after setting the flag it
may wait for any on-going roaming to complete.Doing this may
unnecessarily stop the on-going roaming process. Hence set the
flag after completing the wait time and during the actual time
when the disconnection is about to be started in SME layer.

Change-Id: Ie91049ef2e385ff86d8aa6881799caf432a7e8a5
CRs-Fixed: 2266432
Varun Reddy Yeturu 6 years ago
parent
commit
363809c17a

+ 0 - 4
core/hdd/src/wlan_hdd_cfg80211.c

@@ -19048,8 +19048,6 @@ int wlan_hdd_try_disconnect(struct hdd_adapter *adapter)
 	sta_ctx = WLAN_HDD_GET_STATION_CTX_PTR(adapter);
 	mac_handle = hdd_adapter_get_mac_handle(adapter);
 	if (adapter->device_mode ==  QDF_STA_MODE) {
-		sme_indicate_disconnect_inprogress(mac_handle,
-						   adapter->session_id);
 		hdd_debug("Stop firmware roaming");
 		sme_stop_roaming(mac_handle, adapter->session_id,
 				 eCsrForcedDisassoc);
@@ -19452,8 +19450,6 @@ int wlan_hdd_disconnect(struct hdd_adapter *adapter, u16 reason)
 		return status;
 	mac_handle = hdd_ctx->mac_handle;
 	if (adapter->device_mode ==  QDF_STA_MODE) {
-		sme_indicate_disconnect_inprogress(mac_handle,
-						   adapter->session_id);
 		hdd_debug("Stop firmware roaming");
 		status = sme_stop_roaming(mac_handle, adapter->session_id,
 					  eCsrForcedDisassoc);

+ 12 - 11
core/sme/inc/sme_api.h

@@ -391,8 +391,18 @@ QDF_STATUS sme_roam_reassoc(tHalHandle hHal, uint8_t sessionId,
 		tCsrRoamModifyProfileFields modProfileFields,
 		uint32_t *pRoamId, bool fForce);
 QDF_STATUS sme_roam_connect_to_last_profile(tHalHandle hHal, uint8_t sessionId);
-QDF_STATUS sme_roam_disconnect(tHalHandle hHal, uint8_t sessionId,
-		eCsrRoamDisconnectReason reason);
+
+/**
+ * sme_roam_disconnect() - API to request CSR to disconnect
+ * @hal: HAL context
+ * @session: SME session identifier
+ * @reason: Reason to disconnect
+ *
+ * Return: QDF Status success or failure
+ */
+QDF_STATUS sme_roam_disconnect(tHalHandle hal, uint8_t session,
+			       eCsrRoamDisconnectReason reason);
+
 void sme_dhcp_done_ind(tHalHandle hal, uint8_t session_id);
 QDF_STATUS sme_roam_stop_bss(tHalHandle hHal, uint8_t sessionId);
 QDF_STATUS sme_roam_get_associated_stas(tHalHandle hHal, uint8_t sessionId,
@@ -675,15 +685,6 @@ QDF_STATUS sme_update_is_mawc_ini_feature_enabled(tHalHandle hHal,
 		const bool MAWCEnabled);
 QDF_STATUS sme_stop_roaming(tHalHandle hHal, uint8_t sessionId, uint8_t reason);
 
-/**
- * sme_indicate_disconnect_inprogress() - Indicate to csr that disconnect is in
- * progress
- * @hal: The handle returned by mac_open
- * @session_id: sessionId on which disconenct has started
- *
- * Return: void
- */
-void sme_indicate_disconnect_inprogress(tHalHandle hal, uint8_t session_id);
 QDF_STATUS sme_start_roaming(tHalHandle hHal, uint8_t sessionId,
 		uint8_t reason);
 QDF_STATUS sme_update_enable_fast_roam_in_concurrency(tHalHandle hHal,

+ 8 - 33
core/sme/src/common/sme_api.c

@@ -3238,31 +3238,23 @@ QDF_STATUS sme_roam_connect_to_last_profile(tHalHandle hHal, uint8_t sessionId)
 	return status;
 }
 
-/*
- * sme_roam_disconnect() -
- * A wrapper function to request CSR to disconnect from a network
- *   This is an asynchronous call.
- *
- * reason -- To indicate the reason for disconnecting. Currently, only
- *		     eCSR_DISCONNECT_REASON_MIC_ERROR is meanful.
- * Return QDF_STATUS
- */
-QDF_STATUS sme_roam_disconnect(tHalHandle hHal, uint8_t sessionId,
+QDF_STATUS sme_roam_disconnect(tHalHandle hal, uint8_t session_id,
 			       eCsrRoamDisconnectReason reason)
 {
 	QDF_STATUS status = QDF_STATUS_E_FAILURE;
-	tpAniSirGlobal pMac = PMAC_STRUCT(hHal);
+	tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal);
 
 	MTRACE(qdf_trace(QDF_MODULE_ID_SME,
-			 TRACE_CODE_SME_RX_HDD_ROAM_DISCONNECT, sessionId,
+			 TRACE_CODE_SME_RX_HDD_ROAM_DISCONNECT, session_id,
 			 reason));
-	status = sme_acquire_global_lock(&pMac->sme);
+	status = sme_acquire_global_lock(&mac_ctx->sme);
 	if (QDF_IS_STATUS_SUCCESS(status)) {
-		if (CSR_IS_SESSION_VALID(pMac, sessionId))
-			status = csr_roam_disconnect(pMac, sessionId, reason);
+		if (CSR_IS_SESSION_VALID(mac_ctx, session_id))
+			status = csr_roam_disconnect(mac_ctx, session_id,
+						     reason);
 		else
 			status = QDF_STATUS_E_INVAL;
-		sme_release_global_lock(&pMac->sme);
+		sme_release_global_lock(&mac_ctx->sme);
 	}
 
 	return status;
@@ -6990,23 +6982,6 @@ QDF_STATUS sme_stop_roaming(tHalHandle hal, uint8_t session_id, uint8_t reason)
 	return QDF_STATUS_SUCCESS;
 }
 
-void sme_indicate_disconnect_inprogress(tHalHandle hal, uint8_t session_id)
-{
-	tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal);
-	QDF_STATUS status = QDF_STATUS_SUCCESS;
-	struct csr_roam_session *session;
-
-	status = sme_acquire_global_lock(&mac_ctx->sme);
-	if (QDF_IS_STATUS_SUCCESS(status)) {
-		if (CSR_IS_SESSION_VALID(mac_ctx, session_id)) {
-			session = CSR_GET_SESSION(mac_ctx, session_id);
-			if (session)
-				session->discon_in_progress = true;
-		}
-		sme_release_global_lock(&mac_ctx->sme);
-	}
-}
-
 /*
  * sme_start_roaming() - Start roaming for a given sessionId
  *  This is a synchronous call

+ 8 - 7
core/sme/src/csr/csr_api_roam.c

@@ -9440,21 +9440,22 @@ QDF_STATUS csr_roam_disconnect_internal(tpAniSirGlobal pMac, uint32_t sessionId,
 	return status;
 }
 
-QDF_STATUS csr_roam_disconnect(tpAniSirGlobal pMac, uint32_t sessionId,
+QDF_STATUS csr_roam_disconnect(tpAniSirGlobal mac_ctx, uint32_t session_id,
 			       eCsrRoamDisconnectReason reason)
 {
-	struct csr_roam_session *pSession = CSR_GET_SESSION(pMac, sessionId);
+	struct csr_roam_session *session = CSR_GET_SESSION(mac_ctx, session_id);
 
-	if (!pSession) {
-		sme_err("session: %d not found ", sessionId);
+	if (!session) {
+		sme_err("session: %d not found ", session_id);
 		return QDF_STATUS_E_FAILURE;
 	}
 
-	csr_roam_cancel_roaming(pMac, sessionId);
-	csr_roam_remove_duplicate_command(pMac, sessionId, NULL,
+	session->discon_in_progress = true;
+	csr_roam_cancel_roaming(mac_ctx, session_id);
+	csr_roam_remove_duplicate_command(mac_ctx, session_id, NULL,
 					  eCsrForcedDisassoc);
 
-	return csr_roam_disconnect_internal(pMac, sessionId, reason);
+	return csr_roam_disconnect_internal(mac_ctx, session_id, reason);
 }
 
 QDF_STATUS csr_roam_save_connected_information(tpAniSirGlobal pMac,