浏览代码

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
gaurank kathpalia 5 年之前
父节点
当前提交
b2f7206d97
共有 1 个文件被更改,包括 12 次插入6 次删除
  1. 12 6
      core/sap/src/sap_fsm.c

+ 12 - 6
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 */