Sfoglia il codice sorgente

qcacld-3.0: Trim ACS scan freq list based on last scan ageout time

If particular channel's last scan time is less than the last_scan_ageout
threshold, skip that channel from ACS scan frequency list.

This change optimises the ACS scan time by reducing the number of
channels in ACS scan request to firmware.

Change-Id: Id81815035a89039ef1f492a622c5d89cb4aa298e
CRs-Fixed: 3239387
Surabhi Vishnoi 2 anni fa
parent
commit
a6e1be96f5
2 ha cambiato i file con 75 aggiunte e 0 eliminazioni
  1. 74 0
      core/sap/src/sap_fsm.c
  2. 1 0
      core/sap/src/sap_internal.h

+ 74 - 0
core/sap/src/sap_fsm.c

@@ -1203,6 +1203,59 @@ validation_done:
 	return QDF_STATUS_SUCCESS;
 }
 
+#ifdef WLAN_FEATURE_SAP_ACS_OPTIMIZE
+/**
+ * sap_acs_scan_freq_list_optimize - optimize the ACS scan freq list based
+ * on when last scan was performed on particular frequency. If last scan
+ * performed on particular frequency is less than configured last_scan_ageout
+ * time, then skip that frequency from ACS scan freq list.
+ *
+ * sap_ctx: sap context
+ * list: ACS scan frequency list
+ * ch_count: number of frequency in list
+ *
+ * Return: None
+ */
+static void sap_acs_scan_freq_list_optimize(struct sap_context *sap_ctx,
+					    struct chan_list *list,
+					    uint8_t *ch_count)
+{
+	int loop_count = 0, j = 0;
+	uint32_t ts_last_scan;
+
+	sap_ctx->partial_acs_scan = false;
+
+	while (loop_count < *ch_count) {
+		ts_last_scan = scm_get_last_scan_time_per_channel(
+				sap_ctx->vdev, list->chan[loop_count].freq);
+
+		if (qdf_system_time_before(
+		    qdf_get_time_of_the_day_ms(),
+		    ts_last_scan + sap_ctx->acs_cfg->last_scan_ageout_time)) {
+			sap_info("ACS chan %d skipped from scan as last scan ts %d\n",
+				 list->chan[loop_count].freq,
+				 qdf_get_time_of_the_day_ms() - ts_last_scan);
+
+			for (j = loop_count; j < *ch_count - 1; j++)
+				list->chan[j].freq = list->chan[j + 1].freq;
+
+			(*ch_count)--;
+			sap_ctx->partial_acs_scan = true;
+			continue;
+		}
+		loop_count++;
+	}
+	if (*ch_count == 0)
+		sap_info("All ACS freq channels are scanned recently, skip ACS scan\n");
+}
+#else
+static void sap_acs_scan_freq_list_optimize(struct sap_context *sap_ctx,
+					    struct chan_list *list,
+					    uint8_t *ch_count)
+{
+}
+#endif
+
 QDF_STATUS sap_channel_sel(struct sap_context *sap_context)
 {
 	QDF_STATUS qdf_ret_status;
@@ -1312,6 +1365,26 @@ QDF_STATUS sap_channel_sel(struct sap_context *sap_context)
 		sap_context->num_of_channel = num_of_channels;
 		/* Set requestType to Full scan */
 
+		/*
+		 * send partial channels to be scanned in SCAN request if
+		 * vendor command included last scan ageout time to be used to
+		 * optimize the SAP bring up time
+		 */
+		if (sap_context->acs_cfg->last_scan_ageout_time)
+			sap_acs_scan_freq_list_optimize(
+					sap_context, &req->scan_req.chan_list,
+					&req->scan_req.chan_list.num_chan);
+
+		if (!req->scan_req.chan_list.num_chan) {
+			sap_info("## SKIPPED ACS SCAN");
+			wlansap_pre_start_bss_acs_scan_callback(
+				mac_handle, sap_context, sap_context->sessionId,
+				0, eCSR_SCAN_SUCCESS);
+			qdf_mem_free(req);
+			qdf_ret_status = QDF_STATUS_SUCCESS;
+			goto release_vdev_ref;
+		}
+
 		sap_context->acs_req_timestamp = qdf_get_time_of_the_day_ms();
 		qdf_ret_status = wlan_scan_start(req);
 		if (qdf_ret_status != QDF_STATUS_SUCCESS) {
@@ -1340,6 +1413,7 @@ QDF_STATUS sap_channel_sel(struct sap_context *sap_context)
 			wlansap_dump_acs_ch_freq(sap_context);
 			host_log_acs_scan_start(scan_id, vdev_id);
 		}
+
 #ifdef FEATURE_WLAN_AP_AP_ACS_OPTIMIZE
 	} else {
 		sap_context->acs_cfg->skip_scan_status = eSAP_SKIP_ACS_SCAN;

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

@@ -242,6 +242,7 @@ struct sap_context {
 	uint32_t restriction_mask;
 #endif
 	bool require_h2e;
+	bool partial_acs_scan;
 };
 
 /*----------------------------------------------------------------------------