소스 검색

qcacld-3.0: Avoid sme lock from connect/disconnect callback

Avoid sme lock from connect/disconnect callback as the callback
already takes connection manager or sme lock.

Change-Id: Ifd5499f6756be7208d350afaae6cf637e7d69349
CRs-Fixed: 2870854
gaurank kathpalia 4 년 전
부모
커밋
636dcb384c
5개의 변경된 파일42개의 추가작업 그리고 46개의 파일을 삭제
  1. 3 1
      core/hdd/src/wlan_hdd_cm_api.h
  2. 12 0
      core/hdd/src/wlan_hdd_cm_disconnect.c
  3. 7 0
      core/hdd/src/wlan_hdd_main.c
  4. 20 39
      core/sme/src/common/sme_api.c
  5. 0 6
      core/sme/src/common/sme_ft_api.c

+ 3 - 1
core/hdd/src/wlan_hdd_cm_api.h

@@ -47,7 +47,9 @@ int wlan_hdd_cm_connect(struct wiphy *wiphy,
  * wlan_hdd_cm_issue_disconnect() - initiate disconnect from osif
  * @adapter: Pointer to adapter
  * @reason: Disconnect reason code
- * @sync: true if wait for disconnect to complete is required.
+ * @sync: true if wait for disconnect to complete is required. for the
+ *        supplicant initiated disconnect or during vdev delete/change interface
+ *        sync should be true.
  *
  * This function is used to issue disconnect request to conection manager
  *

+ 12 - 0
core/hdd/src/wlan_hdd_cm_disconnect.c

@@ -268,6 +268,18 @@ int wlan_hdd_cm_disconnect(struct wiphy *wiphy,
 		qdf_dp_trace_dump_all(
 				WLAN_DEAUTH_DPTRACE_DUMP_COUNT,
 				QDF_TRACE_DEFAULT_PDEV_ID);
+	/*
+	 * for Supplicant initiated disconnect always wait for complete,
+	 * as for WPS connection or back to back connect, supplicant initiate a
+	 * disconnect which is followed by connect and if kernel is not yet
+	 * disconnected, this new connect will be rejected by kernel with status
+	 * EALREADY. In case connect is rejected with EALREADY, supplicant will
+	 * queue one more disconnect followed by connect immediately, Now if
+	 * driver is not disconnected by this time, the kernel will again reject
+	 * connect and thus the failing the connect req in supplicant.
+	 * Thus we need to wait for disconnect to complete in this case,
+	 * and thus use sync API here.
+	 */
 	status = wlan_hdd_cm_issue_disconnect(adapter, reason, true);
 
 	return qdf_status_to_os_return(status);

+ 7 - 0
core/hdd/src/wlan_hdd_main.c

@@ -7171,6 +7171,13 @@ QDF_STATUS hdd_stop_adapter(struct hdd_context *hdd_ctx,
 				 * future
 				 */
 #ifdef FEATURE_CM_ENABLE
+				/*
+				 * On vdev delete wait for disconnect to
+				 * complete. i.e use sync API, so that the
+				 * vdev ref of MLME are cleaned and disconnect
+				 * complete before vdev is moved to logically
+				 * deleted.
+				 */
 				status = wlan_hdd_cm_issue_disconnect(adapter,
 								      reason,
 								      true);

+ 20 - 39
core/sme/src/common/sme_api.c

@@ -8408,33 +8408,24 @@ QDF_STATUS sme_set_auto_shutdown_timer(mac_handle_t mac_handle,
 	struct auto_shutdown_cmd *auto_sh_cmd;
 	struct scheduler_msg message = {0};
 
-	status = sme_acquire_global_lock(&mac->sme);
-	if (QDF_STATUS_SUCCESS == status) {
-		auto_sh_cmd = qdf_mem_malloc(sizeof(*auto_sh_cmd));
-		if (!auto_sh_cmd) {
-			sme_release_global_lock(&mac->sme);
-			return QDF_STATUS_E_NOMEM;
-		}
+	auto_sh_cmd = qdf_mem_malloc(sizeof(*auto_sh_cmd));
+	if (!auto_sh_cmd)
+		return QDF_STATUS_E_NOMEM;
 
-		auto_sh_cmd->timer_val = timer_val;
 
-		/* serialize the req through MC thread */
-		message.bodyptr = auto_sh_cmd;
-		message.type = WMA_SET_AUTO_SHUTDOWN_TIMER_REQ;
-		qdf_status = scheduler_post_message(QDF_MODULE_ID_SME,
-						    QDF_MODULE_ID_WMA,
-						    QDF_MODULE_ID_WMA,
-						    &message);
-		if (!QDF_IS_STATUS_SUCCESS(qdf_status)) {
-			QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR,
-				  "%s: Post Auto shutdown MSG fail", __func__);
-			qdf_mem_free(auto_sh_cmd);
-			sme_release_global_lock(&mac->sme);
-			return QDF_STATUS_E_FAILURE;
-		}
-		QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG,
-			  "%s: Posted Auto shutdown MSG", __func__);
-		sme_release_global_lock(&mac->sme);
+	auto_sh_cmd->timer_val = timer_val;
+
+	/* serialize the req through MC thread */
+	message.bodyptr = auto_sh_cmd;
+	message.type = WMA_SET_AUTO_SHUTDOWN_TIMER_REQ;
+	qdf_status = scheduler_post_message(QDF_MODULE_ID_SME,
+					    QDF_MODULE_ID_WMA,
+					    QDF_MODULE_ID_WMA,
+					    &message);
+	if (!QDF_IS_STATUS_SUCCESS(qdf_status)) {
+		sme_err("Post Auto shutdown MSG fail");
+		qdf_mem_free(auto_sh_cmd);
+		return QDF_STATUS_E_FAILURE;
 	}
 
 	return status;
@@ -9226,20 +9217,13 @@ QDF_STATUS sme_update_dsc_pto_up_mapping(mac_handle_t mac_handle,
 	struct csr_roam_session *pCsrSession = NULL;
 	struct pe_session *pSession = NULL;
 
-	status = sme_acquire_global_lock(&mac->sme);
-	if (!QDF_IS_STATUS_SUCCESS(status))
-		return status;
 	pCsrSession = CSR_GET_SESSION(mac, sessionId);
 	if (!pCsrSession) {
-		QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR,
-				FL("Session lookup fails for CSR session"));
-		sme_release_global_lock(&mac->sme);
+		sme_err("Session lookup fails for dvev %d", sessionId);
 		return QDF_STATUS_E_FAILURE;
 	}
 	if (!CSR_IS_SESSION_VALID(mac, sessionId)) {
-		QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR,
-				FL("Invalid session Id %u"), sessionId);
-		sme_release_global_lock(&mac->sme);
+		sme_err("Invalid session Id %u", sessionId);
 		return QDF_STATUS_E_FAILURE;
 	}
 
@@ -9248,15 +9232,13 @@ QDF_STATUS sme_update_dsc_pto_up_mapping(mac_handle_t mac_handle,
 				&peSessionId);
 
 	if (!pSession) {
-		QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR,
-				FL(" Session lookup fails for BSSID"));
-		sme_release_global_lock(&mac->sme);
+		sme_err("Session lookup fails for " QDF_MAC_ADDR_FMT,
+			QDF_MAC_ADDR_REF(pCsrSession->connectedProfile.bssid.bytes));
 		return QDF_STATUS_E_FAILURE;
 	}
 
 	if (!pSession->QosMapSet.present) {
 		sme_debug("QOS Mapping IE not present");
-		sme_release_global_lock(&mac->sme);
 		return QDF_STATUS_E_FAILURE;
 	}
 
@@ -9271,7 +9253,6 @@ QDF_STATUS sme_update_dsc_pto_up_mapping(mac_handle_t mac_handle,
 			dscpmapping[pSession->QosMapSet.dscp_exceptions[i][0]] =
 				pSession->QosMapSet.dscp_exceptions[i][1];
 
-	sme_release_global_lock(&mac->sme);
 	return status;
 }
 

+ 0 - 6
core/sme/src/common/sme_ft_api.c

@@ -263,7 +263,6 @@ QDF_STATUS sme_check_ft_status(mac_handle_t mac_handle, uint32_t session_id)
 #ifdef WLAN_FEATURE_HOST_ROAM
 bool sme_ft_key_ready_for_install(mac_handle_t mac_handle, uint32_t session_id)
 {
-	QDF_STATUS status;
 	bool ret = false;
 	struct mac_context *mac = MAC_CONTEXT(mac_handle);
 	struct csr_roam_session *session = CSR_GET_SESSION(mac, session_id);
@@ -273,16 +272,11 @@ bool sme_ft_key_ready_for_install(mac_handle_t mac_handle, uint32_t session_id)
 		return false;
 	}
 
-	status = sme_acquire_global_lock(&mac->sme);
-	if (!(QDF_IS_STATUS_SUCCESS(status)))
-		return false;
-
 	if (sme_get_ft_pre_auth_state(mac_handle, session_id) &&
 	    session->ftSmeContext.FTState == eFT_START_READY) {
 		ret = true;
 		sme_set_ft_pre_auth_state(mac_handle, session_id, false);
 	}
-	sme_release_global_lock(&mac->sme);
 
 	return ret;
 }