Преглед на файлове

qcacld-3.0: Avoid waiting for SME messages while holding SME global lock

Avoid waiting for SME response messages while holding the SME global
lock. Currently a wait for 500ms happens in cds_handle_conc_multiport
after the holding the SME global lock. Because of this, the set hw mode
response posted by LIM is not processed by SME as SME would be waiting
for the lock.

Change-Id: Ib7890cb7124f5879316f46b1bf9f0ad3fb225665
CRs-Fixed: 939026
Chandrasekaran, Manishekar преди 9 години
родител
ревизия
430ee2ec1f
променени са 5 файла, в които са добавени 63 реда и са изтрити 20 реда
  1. 1 1
      core/cds/inc/cds_concurrency.h
  2. 6 16
      core/cds/src/cds_concurrency.c
  3. 2 0
      core/sme/inc/csr_internal.h
  4. 11 3
      core/sme/src/csr/csr_api_roam.c
  5. 43 0
      core/sme/src/csr/csr_util.c

+ 1 - 1
core/cds/inc/cds_concurrency.h

@@ -604,7 +604,7 @@ static inline bool cds_handle_conc_rule2(hdd_context_t *hdd_ctx,
 uint8_t cds_search_and_check_for_session_conc(uint8_t session_id,
 		tCsrRoamProfile * roam_profile);
 bool cds_check_for_session_conc(uint8_t session_id, uint8_t channel);
-bool cds_handle_conc_multiport(uint8_t session_id, uint8_t channel);
+CDF_STATUS cds_handle_conc_multiport(uint8_t session_id, uint8_t channel);
 
 #ifdef FEATURE_WLAN_FORCE_SAP_SCC
 void cds_force_sap_on_scc(hdd_context_t *hdd_ctx, eCsrRoamResult roam_result);

+ 6 - 16
core/cds/src/cds_concurrency.c

@@ -6241,16 +6241,16 @@ bool cds_check_for_session_conc(uint8_t session_id,
  * This routine will handle STA side concurrency when policy manager
  * is enabled.
  *
- * Return: true or false
+ * Return: CDF_STATUS
  */
-bool cds_handle_conc_multiport(uint8_t session_id,
+CDF_STATUS cds_handle_conc_multiport(uint8_t session_id,
 		uint8_t channel)
 {
 	CDF_STATUS status;
 
 	if (!cds_check_for_session_conc(session_id, channel)) {
 		cds_err("Conc not allowed for the session %d", session_id);
-		return false;
+		return CDF_STATUS_E_FAILURE;
 	}
 
 	status = cdf_reset_connection_update();
@@ -6262,20 +6262,10 @@ bool cds_handle_conc_multiport(uint8_t session_id,
 			CDS_UPDATE_REASON_NORMAL_STA);
 	if (CDF_STATUS_E_FAILURE == status) {
 		cds_err("connections update failed");
-		return false;
-	}
-	/*
-	 * wait only if status is successful. connection update API
-	 * will return success only in case if DBS update is required.
-	 */
-	if (CDF_STATUS_SUCCESS == status) {
-		status = cdf_wait_for_connection_update();
-		if (!CDF_IS_STATUS_SUCCESS(status)) {
-			cds_err("wait for event failed");
-			return false;
-		}
+		return status;
 	}
-	return true;
+
+	return status;
 }
 
 #ifdef FEATURE_WLAN_FORCE_SAP_SCC

+ 2 - 0
core/sme/inc/csr_internal.h

@@ -1409,4 +1409,6 @@ CDF_STATUS csr_scan_process_single_bssdescr(tpAniSirGlobal pMac,
 		tSirBssDescription *pSirBssDescription,
 		uint32_t scan_id, uint32_t flags);
 
+bool csr_wait_for_connection_update(tpAniSirGlobal mac,
+		bool do_release_reacquire_lock);
 #endif

+ 11 - 3
core/sme/src/csr/csr_api_roam.c

@@ -7250,9 +7250,17 @@ CDF_STATUS csr_roam_connect(tpAniSirGlobal pMac, uint32_t sessionId,
 			 (pScanFilter->csrPersona == CDF_P2P_CLIENT_MODE))) {
 			csr_get_bssdescr_from_scan_handle(hBSSList,
 					&first_ap_profile);
-			if (!cds_handle_conc_multiport(sessionId,
-						first_ap_profile.channelId)) {
-				sms_log(pMac, LOG1, FL("conc multiport error"));
+			status = cds_handle_conc_multiport(sessionId,
+						first_ap_profile.channelId);
+			if ((CDF_IS_STATUS_SUCCESS(status)) &&
+				(!csr_wait_for_connection_update(pMac, true))) {
+					sms_log(pMac, LOG1,
+						FL("conn update error"));
+					csr_scan_result_purge(pMac, hBSSList);
+					fCallCallback = true;
+					goto error;
+			} else if (status == CDF_STATUS_E_FAILURE) {
+				sms_log(pMac, LOG1, FL("conn update error"));
 				csr_scan_result_purge(pMac, hBSSList);
 				fCallCallback = true;
 				goto error;

+ 43 - 0
core/sme/src/csr/csr_util.c

@@ -41,6 +41,7 @@
 #include "sme_qos_internal.h"
 #include "wma_types.h"
 #include "cds_utils.h"
+#include "cds_concurrency.h"
 
 
 uint8_t csr_wpa_oui[][CSR_WPA_OUI_SIZE] = {
@@ -5624,3 +5625,45 @@ void csr_diag_event_report(tpAniSirGlobal pmac, uint16_t event_type,
 	return;
 }
 #endif
+
+/**
+ * csr_wait_for_connection_update() - Wait for hw mode update
+ * @mac: Pointer to the MAC context
+ * @do_release_reacquire_lock: Indicates whether release and
+ * re-acquisition of SME global lock is required.
+ *
+ * Waits for CONNECTION_UPDATE_TIMEOUT time so that the
+ * hw mode update can get processed.
+ *
+ * Return: True if the wait was successful, false otherwise
+ */
+bool csr_wait_for_connection_update(tpAniSirGlobal mac,
+		bool do_release_reacquire_lock)
+{
+	CDF_STATUS status, ret;
+
+	if (do_release_reacquire_lock == true) {
+		ret = sme_release_global_lock(&mac->sme);
+		if (!CDF_IS_STATUS_SUCCESS(ret)) {
+			cds_err("lock release fail %d", ret);
+			return false;
+		}
+	}
+
+	status = cdf_wait_for_connection_update();
+
+	if (do_release_reacquire_lock == true) {
+		ret = sme_acquire_global_lock(&mac->sme);
+		if (!CDF_IS_STATUS_SUCCESS(ret)) {
+			cds_err("lock acquire fail %d", ret);
+			return false;
+		}
+	}
+
+	if (!CDF_IS_STATUS_SUCCESS(status)) {
+		cds_err("wait for event failed");
+		return false;
+	}
+
+	return true;
+}