From b2f7206d97470b7a726545ebdb9ac0f24ac65729 Mon Sep 17 00:00:00 2001 From: gaurank kathpalia Date: Tue, 6 Aug 2019 14:10:44 +0530 Subject: [PATCH] qcacld-3.0: Avoid scan if no channel found in ACS If no channel is found suitable for ACS, don't scan all the channels as done currently by the driver, and send ACS fail code to the userspace as SAP cannot be started on the band specified by the use. Change-Id: I18edff6aaf384384841487d06474fd5fba28fc2f CRs-Fixed: 2476347 --- core/sap/src/sap_fsm.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/core/sap/src/sap_fsm.c b/core/sap/src/sap_fsm.c index 5b37ba164387..8a808c24b77c 100644 --- a/core/sap/src/sap_fsm.c +++ b/core/sap/src/sap_fsm.c @@ -961,6 +961,18 @@ QDF_STATUS sap_channel_sel(struct sap_context *sap_context) if (sap_context->channel) return sap_validate_chan(sap_context, true, false); + if (sap_context->freq_list) { + qdf_mem_free(sap_context->freq_list); + sap_context->freq_list = NULL; + sap_context->num_of_channel = 0; + } + + sap_get_freq_list(sap_context, &freq_list, &num_of_channels); + if (!num_of_channels) { + sap_err("No freq sutiable for SAP in current list, SAP failed"); + return QDF_STATUS_E_FAILURE; + } + if (policy_mgr_concurrent_beaconing_sessions_running(mac_ctx->psoc) || ((sap_context->cc_switch_mode == QDF_MCC_TO_SCC_SWITCH_FORCE_PREFERRED_WITHOUT_DISCONNECTION) && @@ -1022,7 +1034,6 @@ QDF_STATUS sap_channel_sel(struct sap_context *sap_context) req->scan_req.scan_req_id = sap_context->req_id; req->scan_req.scan_priority = SCAN_PRIORITY_HIGH; req->scan_req.scan_f_bcast_probe = true; - sap_get_freq_list(sap_context, &freq_list, &num_of_channels); #ifdef FEATURE_WLAN_AP_AP_ACS_OPTIMIZE if (num_of_channels != 0) { @@ -1031,11 +1042,6 @@ QDF_STATUS sap_channel_sel(struct sap_context *sap_context) req->scan_req.chan_list.num_chan = num_of_channels; for (i = 0; i < num_of_channels; i++) req->scan_req.chan_list.chan[i].freq = freq_list[i]; - if (sap_context->freq_list) { - qdf_mem_free(sap_context->freq_list); - sap_context->freq_list = NULL; - sap_context->num_of_channel = 0; - } sap_context->freq_list = freq_list; sap_context->num_of_channel = num_of_channels; /* Set requestType to Full scan */