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

qcacld-3.0: Using util API to check scan result

SCAN_EVENT_TYPE_DEQUEUED means this scan request have been dequeued
in fw. Driver should close this session and free related resouce if
recevie DEQUEUED.

In sap_scan_event_callback and csr_scan_callback,
those functions will return if receive DEQUEUED.Which cause memory leak.

So using util_is_scan_success to check scan result in scan callback.
And check sap resouce whether be freed when rmmod.If not clear it.

Change-Id: Iaf1f077dd7221236944d94d2b543f4df63de29fd
CRs-Fixed: 2242823
Jiachao Wu преди 6 години
родител
ревизия
b8f8921958
променени са 4 файла, в които са добавени 23 реда и са изтрити 31 реда
  1. 6 9
      core/sap/src/sap_api_link_cntl.c
  2. 6 0
      core/sap/src/sap_module.c
  3. 6 9
      core/sme/src/csr/csr_api_scan.c
  4. 5 13
      core/sme/src/rrm/sme_rrm.c

+ 6 - 9
core/sap/src/sap_api_link_cntl.c

@@ -49,6 +49,7 @@
 #include <wlan_objmgr_vdev_obj.h>
 #include <wlan_objmgr_pdev_obj.h>
 #include "wlan_reg_services_api.h"
+#include <wlan_scan_utils_api.h>
 
 /*----------------------------------------------------------------------------
  * Preprocessor Definitions and Constants
@@ -1365,6 +1366,7 @@ void sap_scan_event_callback(struct wlan_objmgr_vdev *vdev,
 {
 	uint32_t scan_id;
 	uint8_t session_id;
+	bool success = false;
 	eCsrScanStatus scan_status = eCSR_SCAN_FAILURE;
 	tHalHandle hal_handle;
 	struct sap_context *sap_ctx = arg;
@@ -1378,17 +1380,12 @@ void sap_scan_event_callback(struct wlan_objmgr_vdev *vdev,
 		return;
 	}
 
-	if ((event->type == SCAN_EVENT_TYPE_COMPLETED) &&
-		((event->reason == SCAN_REASON_CANCELLED) ||
-		(event->reason == SCAN_REASON_TIMEDOUT) ||
-		(event->reason == SCAN_REASON_INTERNAL_FAILURE)))
-		scan_status = eCSR_SCAN_FAILURE;
-	else if ((event->type == SCAN_EVENT_TYPE_COMPLETED) &&
-			(event->reason == SCAN_REASON_COMPLETED))
-		scan_status = eCSR_SCAN_SUCCESS;
-	else
+	if (!util_is_scan_completed(event, &success))
 		return;
 
+	if (success)
+		scan_status = eCSR_SCAN_SUCCESS;
+
 	if (!sap_ctx->sap_acs_pre_start_bss)
 		wlansap_scan_callback(hal_handle, arg, session_id, scan_id,
 				scan_status);

+ 6 - 0
core/sap/src/sap_module.c

@@ -367,6 +367,12 @@ QDF_STATUS sap_deinit_ctx(struct sap_context *sap_ctx)
 		sap_clear_session_param(hal, sap_ctx, sap_ctx->sessionId);
 	}
 
+	if (sap_ctx->channelList) {
+		qdf_mem_free(sap_ctx->channelList);
+		sap_ctx->channelList = NULL;
+		sap_ctx->num_of_channel = 0;
+	}
+
 	return QDF_STATUS_SUCCESS;
 }
 

+ 6 - 9
core/sme/src/csr/csr_api_scan.c

@@ -1274,19 +1274,16 @@ void csr_scan_callback(struct wlan_objmgr_vdev *vdev,
 	struct csr_roam_session *session;
 	uint32_t session_id = 0;
 	uint8_t chan = 0;
+	bool success = false;
 
 	mac_ctx = (tpAniSirGlobal)arg;
-	if ((event->type == SCAN_EVENT_TYPE_COMPLETED) &&
-			((event->reason == SCAN_REASON_CANCELLED) ||
-			(event->reason == SCAN_REASON_TIMEDOUT) ||
-			(event->reason == SCAN_REASON_INTERNAL_FAILURE)))
-		scan_status = eCSR_SCAN_FAILURE;
-	else if ((event->type == SCAN_EVENT_TYPE_COMPLETED) &&
-			(event->reason == SCAN_REASON_COMPLETED))
-		scan_status = eCSR_SCAN_SUCCESS;
-	else
+
+	if (!util_is_scan_completed(event, &success))
 		return;
 
+	if (success)
+		scan_status = eCSR_SCAN_SUCCESS;
+
 	session_id = wlan_vdev_get_id(vdev);
 	if (!CSR_IS_SESSION_VALID(mac_ctx, session_id)) {
 		sme_err("session %d is invalid", session_id);

+ 5 - 13
core/sme/src/rrm/sme_rrm.c

@@ -37,6 +37,7 @@
 
 #include "rrm_global.h"
 #include <wlan_scan_ucfg_api.h>
+#include <wlan_scan_utils_api.h>
 #include <wlan_utility.h>
 
 /* Roam score for a neighbor AP will be calculated based on the below
@@ -631,7 +632,7 @@ static void sme_rrm_scan_event_callback(struct wlan_objmgr_vdev *vdev,
 	uint8_t session_id;
 	eCsrScanStatus scan_status = eCSR_SCAN_FAILURE;
 	tHalHandle hal_handle;
-
+	bool success = false;
 	session_id = wlan_vdev_get_id(vdev);
 	scan_id = event->scan_id;
 	hal_handle = cds_get_context(QDF_MODULE_ID_SME);
@@ -640,21 +641,12 @@ static void sme_rrm_scan_event_callback(struct wlan_objmgr_vdev *vdev,
 			  FL("invalid h_hal"));
 		return;
 	}
-	if ((event->type != SCAN_EVENT_TYPE_COMPLETED) &&
-	    (event->type != SCAN_EVENT_TYPE_DEQUEUED) &&
-	    (event->type != SCAN_EVENT_TYPE_START_FAILED))
+
+	if (!util_is_scan_completed(event, &success))
 		return;
 
-	if ((event->type == SCAN_EVENT_TYPE_COMPLETED) &&
-		((event->reason == SCAN_REASON_CANCELLED) ||
-		(event->reason == SCAN_REASON_TIMEDOUT) ||
-		(event->reason == SCAN_REASON_INTERNAL_FAILURE)))
-		scan_status = eCSR_SCAN_FAILURE;
-	else if ((event->type == SCAN_EVENT_TYPE_COMPLETED) &&
-			(event->reason == SCAN_REASON_COMPLETED))
+	if (success)
 		scan_status = eCSR_SCAN_SUCCESS;
-	else
-		return;
 
 	sme_rrm_scan_request_callback(hal_handle, session_id,
 					scan_id, scan_status);