Browse Source

qcacld-3.0: Use acs scan request timestamp in scan req

Currently the driver flushes all the scan results during
ACS request, and then scans the specific channels as
mentioned in the request, which leads to a scan again
for the STA interface as no scan results are available.

Fix is to have a timestamp, and get only the latest scan
results, instead of the scan database flush.

Change-Id: Icc343fcca77fb7074071ca1d467947ef70fd1930
CRs-Fixed: 2446490
gaurank kathpalia 6 years ago
parent
commit
d778617b39

+ 15 - 1
core/sap/src/sap_api_link_cntl.c

@@ -185,6 +185,7 @@ QDF_STATUS wlansap_pre_start_bss_acs_scan_callback(mac_handle_t mac_handle,
 	QDF_STATUS scan_get_result_status = QDF_STATUS_E_FAILURE;
 	uint8_t oper_channel = 0;
 	QDF_STATUS status = QDF_STATUS_E_FAILURE;
+	tCsrScanResultFilter *filter;
 
 	host_log_acs_scan_done(acs_scan_done_status_str(scan_status),
 			  sessionid, scanid);
@@ -204,6 +205,16 @@ QDF_STATUS wlansap_pre_start_bss_acs_scan_callback(mac_handle_t mac_handle,
 	}
 	QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO_HIGH,
 		FL("CSR scan_status = eCSR_SCAN_SUCCESS (%d)"), scan_status);
+
+	filter = qdf_mem_malloc(sizeof(tCsrScanResultFilter));
+	if (!filter) {
+		QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO_HIGH,
+			  FL("Memory allocation for filter failed"));
+	} else {
+		filter->csrPersona = QDF_SAP_MODE;
+		filter->age_threshold = qdf_get_time_of_the_day_ms() -
+						sap_ctx->acs_req_timestamp;
+	}
 	/*
 	* Now do
 	* 1. Get scan results
@@ -212,7 +223,10 @@ QDF_STATUS wlansap_pre_start_bss_acs_scan_callback(mac_handle_t mac_handle,
 	*/
 	scan_get_result_status = sme_scan_get_result(mac_handle,
 					sap_ctx->sessionId,
-					NULL, &presult);
+					filter, &presult);
+	if (filter)
+		qdf_mem_free(filter);
+
 	if ((scan_get_result_status != QDF_STATUS_SUCCESS) &&
 		(scan_get_result_status != QDF_STATUS_E_NULL_VALUE)) {
 		/*

+ 2 - 5
core/sap/src/sap_fsm.c

@@ -1036,11 +1036,8 @@ QDF_STATUS sap_channel_sel(struct sap_context *sap_context)
 		/* Set requestType to Full scan */
 		QDF_TRACE(QDF_MODULE_ID_SAP, QDF_TRACE_LEVEL_INFO_HIGH,
 			  FL("calling ucfg_scan_start"));
-#ifdef FEATURE_WLAN_AP_AP_ACS_OPTIMIZE
-		if (sap_context->acs_cfg->skip_scan_status ==
-		    eSAP_DO_NEW_ACS_SCAN)
-#endif
-			sme_scan_flush_result(mac_handle);
+
+		sap_context->acs_req_timestamp = qdf_get_time_of_the_day_ms();
 		qdf_ret_status = ucfg_scan_start(req);
 		wlan_objmgr_vdev_release_ref(vdev, WLAN_LEGACY_SME_ID);
 			if (qdf_ret_status != QDF_STATUS_SUCCESS) {

+ 2 - 0
core/sap/src/sap_internal.h

@@ -176,6 +176,8 @@ struct sap_context {
 	bool enableOverLapCh;
 	struct sap_acs_cfg *acs_cfg;
 
+	qdf_time_t acs_req_timestamp;
+
 #ifdef FEATURE_WLAN_MCC_TO_SCC_SWITCH
 	uint8_t cc_switch_mode;
 #endif

+ 1 - 0
core/sme/inc/csr_api.h

@@ -317,6 +317,7 @@ typedef struct tagCsrScanResultFilter {
 	bool realm_check;
 	uint8_t fils_realm[2];
 	bool force_rsne_override;
+	qdf_time_t age_threshold;
 } tCsrScanResultFilter;
 
 typedef struct sCsrChnPower_ {

+ 3 - 1
core/sme/src/csr/csr_api_scan.c

@@ -2396,6 +2396,8 @@ static QDF_STATUS csr_prepare_scan_filter(struct mac_context *mac_ctx,
 			pFilter->BSSIDs.bssid[i].bytes,
 			QDF_MAC_ADDR_SIZE);
 
+	filter->age_threshold = pFilter->age_threshold;
+
 	filter->num_of_ssid = pFilter->SSIDs.numOfSSIDs;
 	if (filter->num_of_ssid > WLAN_SCAN_FILTER_NUM_SSID)
 		filter->num_of_ssid = WLAN_SCAN_FILTER_NUM_SSID;
@@ -2978,7 +2980,7 @@ QDF_STATUS csr_scan_get_result(struct mac_context *mac_ctx,
 		/* Fail or No one wants the result. */
 		csr_scan_result_purge(mac_ctx, (tScanResultHandle) ret_list);
 	else {
-		if (pFilter) {
+		if (pFilter && pFilter->csrPersona == QDF_STA_MODE) {
 			csr_filter_ap_due_to_rssi_reject(mac_ctx, ret_list);
 			csr_remove_ap_with_assoc_disallowed(mac_ctx, ret_list);
 		}