Bläddra i källkod

qcacld-3.0: Update 6 GHz channel max weight

ACS will mark non ACS channel(filtered by PCL) to SAP_ACS_WEIGHT_MAX.
But the filtered channel still need a reasonable weight to
calculate the combined weight for ACS bw 40/80/160/320.
Assign weight value SAP_ACS_WEIGHT_ADJUSTABLE to such channels and
update it with reasonable after all channels weight are computed.

Change-Id: Iba6565a0f57cc3fe4997427733e922eefc917516
CRs-Fixed: 3537962
Liangwei Dong 1 år sedan
förälder
incheckning
c5c0b9bbed
2 ändrade filer med 74 tillägg och 3 borttagningar
  1. 8 0
      core/sap/inc/sap_api.h
  2. 66 3
      core/sap/src/sap_ch_select.c

+ 8 - 0
core/sap/inc/sap_api.h

@@ -63,6 +63,14 @@ extern "C" {
 #define       SAP_MAX_NUM_SESSION          5
 #define       SAP_MAX_OBSS_STA_CNT         1    /* max # of OBSS STA */
 #define       SAP_ACS_WEIGHT_MAX           (26664)
+/* ACS will mark non ACS channels(filtered by PCL) or channels not in
+ * ACS scan list to SAP_ACS_WEIGHT_MAX.
+ * But the filtered channel still need a reasonable weight to
+ * calculate the combined weight for ACS bw 40/80/160/320.
+ * Assign SAP_ACS_WEIGHT_ADJUSTABLE to such channels and update it
+ * with reasonable weight after all channels weight are computed.
+ */
+#define       SAP_ACS_WEIGHT_ADJUSTABLE    (SAP_ACS_WEIGHT_MAX - 1)
 
 #define SAP_DEFAULT_24GHZ_CHANNEL     (6)
 #define SAP_DEFAULT_5GHZ_CHANNEL      (40)

+ 66 - 3
core/sap/src/sap_ch_select.c

@@ -525,8 +525,14 @@ static bool sap_chan_sel_init(mac_handle_t mac_handle,
 		if (!ignore_acs_range &&
 		    !wlansap_is_channel_present_in_acs_list(
 		    *pChans, sap_ctx->acs_cfg->freq_list,
-		    sap_ctx->acs_cfg->ch_list_count))
+		    sap_ctx->acs_cfg->ch_list_count)) {
+			if (wlansap_is_channel_present_in_acs_list(
+					pSpectCh->chan_freq,
+					sap_ctx->acs_cfg->master_freq_list,
+					sap_ctx->acs_cfg->master_ch_list_count))
+				pSpectCh->weight = SAP_ACS_WEIGHT_ADJUSTABLE;
 			continue;
+		}
 
 		pSpectCh->valid = true;
 		if (!ch_support_puncture)
@@ -1422,6 +1428,48 @@ sap_normalize_channel_weight_with_factors(struct mac_context *mac,
 	}
 }
 
+/**
+ * sap_update_6ghz_max_weight() - Update 6 GHz channel max weight
+ * @pspectinfo_params: Pointer to the tSpectInfoParams structure
+ * @max_valid_weight: max valid weight on 6 GHz channels
+ *
+ * If ACS frequency list includes 6 GHz channels, the user prefers
+ * to start SAP on 6 GHz as much as possible. The acs logic in
+ * sap_chan_sel_init will mark channel weight to Max weight value
+ * of SAP_ACS_WEIGHT_MAX if channel is no in ACS channel list(filtered
+ * by PCL).
+ * In ACS bw 160 case, sometime the combined weight of 8 channels
+ * on 6 GHz(some of them have weight SAP_ACS_WEIGHT_MAX)
+ * may higher than 5 GHz channels and finally select 5 GHz channel.
+ * This API is to update the 6 GHz weight to max valid weight in
+ * 6 GHz instead of value SAP_ACS_WEIGHT_MAX. All those channels have
+ * special weight value SAP_ACS_WEIGHT_ADJUSTABLE which is assigned
+ * sap_chan_sel_init.
+ *
+ * Return: void
+ */
+static void sap_update_6ghz_max_weight(tSapChSelSpectInfo *pspectinfo_params,
+				       uint32_t max_valid_weight)
+{
+	uint8_t chn_num;
+	tSapSpectChInfo *pspect_ch;
+
+	sap_debug("max_valid_weight_on_6ghz_channels %d",
+		  max_valid_weight);
+	if (!max_valid_weight)
+		return;
+	for (chn_num = 0; chn_num < pspectinfo_params->numSpectChans;
+	     chn_num++) {
+		pspect_ch = &pspectinfo_params->pSpectCh[chn_num];
+		if (!wlan_reg_is_6ghz_chan_freq(pspect_ch->chan_freq))
+			continue;
+		if (pspect_ch->weight == SAP_ACS_WEIGHT_ADJUSTABLE) {
+			pspect_ch->weight = max_valid_weight;
+			pspect_ch->weight_copy = pspect_ch->weight;
+		}
+	}
+}
+
 /**
  * sap_compute_spect_weight() - Compute spectrum weight
  * @pSpectInfoParams: Pointer to the tSpectInfoParams structure
@@ -1453,6 +1501,7 @@ static void sap_compute_spect_weight(tSapChSelSpectInfo *pSpectInfoParams,
 	qdf_list_node_t *cur_lst = NULL, *next_lst = NULL;
 	struct scan_cache_node *cur_node = NULL;
 	uint32_t rssi_bss_weight = 0, chan_status_weight = 0, power_weight = 0;
+	uint32_t max_valid_weight_6ghz = 0;
 
 	sap_debug("Computing spectral weight");
 
@@ -1526,7 +1575,8 @@ static void sap_compute_spect_weight(tSapChSelSpectInfo *pSpectInfoParams,
 		if (rssi < SOFTAP_MIN_RSSI)
 			rssi = SOFTAP_MIN_RSSI;
 
-		if (pSpectCh->weight == SAP_ACS_WEIGHT_MAX) {
+		if (pSpectCh->weight == SAP_ACS_WEIGHT_MAX ||
+		    pSpectCh->weight == SAP_ACS_WEIGHT_ADJUSTABLE) {
 			pSpectCh->weight_copy = pSpectCh->weight;
 			goto debug_info;
 		}
@@ -1567,7 +1617,13 @@ static void sap_compute_spect_weight(tSapChSelSpectInfo *pSpectInfoParams,
 					(rssi_bss_weight + chan_status_weight
 					+ power_weight);
 		} else {
-			pSpectCh->weight = SAP_ACS_WEIGHT_MAX;
+			if (wlansap_is_channel_present_in_acs_list(
+					pSpectCh->chan_freq,
+					sap_ctx->acs_cfg->master_freq_list,
+					sap_ctx->acs_cfg->master_ch_list_count))
+				pSpectCh->weight = SAP_ACS_WEIGHT_ADJUSTABLE;
+			else
+				pSpectCh->weight = SAP_ACS_WEIGHT_MAX;
 			pSpectCh->rssiAgr = SOFTAP_MIN_RSSI;
 			rssi = SOFTAP_MIN_RSSI;
 			pSpectCh->bssCount = SOFTAP_MIN_COUNT;
@@ -1580,6 +1636,11 @@ static void sap_compute_spect_weight(tSapChSelSpectInfo *pSpectInfoParams,
 		pSpectCh->weight_copy = pSpectCh->weight;
 
 debug_info:
+		if (wlan_reg_is_6ghz_chan_freq(pSpectCh->chan_freq) &&
+		    pSpectCh->weight < SAP_ACS_WEIGHT_ADJUSTABLE &&
+		    max_valid_weight_6ghz < pSpectCh->weight)
+			max_valid_weight_6ghz = pSpectCh->weight;
+
 		sap_debug("freq %d valid %d weight %d(%d,%d,%d) rssi %d bss %d",
 			  pSpectCh->chan_freq, pSpectCh->valid,
 			  pSpectCh->weight, rssi_bss_weight,
@@ -1588,6 +1649,8 @@ debug_info:
 
 		pSpectCh++;
 	}
+	sap_update_6ghz_max_weight(pSpectInfoParams,
+				   max_valid_weight_6ghz);
 	sap_clear_channel_status(mac);
 }