Sfoglia il codice sorgente

qcacmn: Select best link as assoc link

For mlo 5+6, 6 GHz band score is higher than 5 GHz, so 6+5 total score is
higher than 5+6, 6+5 is always selected before 5+6 even 6 GHz link score is
much worse than 5 GHz.

To fix it, calculate each link score for each MLO AP, if assoc link is
best link, add a boost score, then it can be selected first.

Update band weight and score for both SLO and MLO, select average of link
band score as MLO band score.

Change-Id: If0714fa94031d5746d89388917540f0e34086d86
CRs-Fixed: 3483850
Jianmin Zhu 2 anni fa
parent
commit
da25bf14e9

+ 92 - 31
umac/mlme/connection_mgr/core/src/wlan_cm_bss_scoring.c

@@ -83,6 +83,7 @@
 #define CM_MAX_PCT_SCORE 100
 #define CM_MAX_INDEX_PER_INI 4
 #define CM_SLO_CONGESTION_MAX_SCORE 80
+#define CM_ASSOC_INK_BEST_BOOST 20
 
 /*
  * This macro give percentage value of security_weightage to be used as per
@@ -1824,6 +1825,13 @@ static int8_t cm_estimate_rssi(int8_t rssi_entry, uint32_t freq_entry,
 	return rssi_entry;
 }
 
+static int cm_calculate_bss_score(struct wlan_objmgr_psoc *psoc,
+				  struct scan_cache_entry *entry,
+				  int pcl_chan_weight,
+				  struct qdf_mac_addr *bssid_hint,
+				  qdf_list_t *scan_list,
+				  bool is_link_score);
+
 /**
  * cm_calculate_mlo_bss_score() - Calculate mlo bss score
  * @psoc: Pointer to psoc object
@@ -1832,6 +1840,7 @@ static int8_t cm_estimate_rssi(int8_t rssi_entry, uint32_t freq_entry,
  * @phy_config: Phy config
  * @scan_list: Scan entry list of bss candidates after filtering
  * @rssi_prorated_pct: Rssi prorated percent
+ * @pcl_chan_weight: PCL chan weight
  *
  * For MLMR case, besides adding MLMR boost score,
  * calculate joint RSSI/band width/congestion score for combination of
@@ -1845,7 +1854,8 @@ static int cm_calculate_mlo_bss_score(struct wlan_objmgr_psoc *psoc,
 				      struct scoring_cfg *score_params,
 				      struct psoc_phy_config *phy_config,
 				      qdf_list_t *scan_list,
-				      uint8_t *rssi_prorated_pct)
+				      uint8_t *rssi_prorated_pct,
+				      int pcl_chan_weight)
 {
 	struct scan_cache_entry *entry_partner[MLD_MAX_LINKS - 1];
 	int32_t rssi[MLD_MAX_LINKS - 1];
@@ -1872,6 +1882,13 @@ static int cm_calculate_mlo_bss_score(struct wlan_objmgr_psoc *psoc,
 	bool eht_capab;
 	struct partner_link_info tmp_link_info;
 	uint32_t tmp_total_score = 0;
+	uint32_t assoc_score = 0;
+	uint32_t link_score[MLD_MAX_LINKS - 1] = {0};
+	bool is_assoc_link_best = true;
+	uint32_t assoc_band_score;
+	uint32_t link_band_score[MLD_MAX_LINKS - 1] = {0};
+	uint32_t total_band_score[MLD_MAX_LINKS - 1] = {0};
+
 
 	wlan_psoc_mlme_get_11be_capab(psoc, &eht_capab);
 	if (!eht_capab)
@@ -1883,6 +1900,15 @@ static int cm_calculate_mlo_bss_score(struct wlan_objmgr_psoc *psoc,
 	cong_score = cm_calculate_congestion_score(entry,
 						   score_params,
 						   &cong_pct, false);
+
+	assoc_score =
+		cm_calculate_bss_score(psoc, entry, pcl_chan_weight,
+				       NULL, scan_list, true);
+	entry->ml_info.link_score = assoc_score;
+
+	assoc_band_score = cm_get_band_score(entry->channel.chan_freq,
+					     score_params);
+
 	link = &entry->ml_info.link_info[0];
 	for (i = 0; i < entry->ml_info.num_links; i++) {
 		if (!link[i].is_valid_link)
@@ -1897,7 +1923,14 @@ static int cm_calculate_mlo_bss_score(struct wlan_objmgr_psoc *psoc,
 					freq[i], freq_entry);
 			continue;
 		}
+
 		if (entry_partner[i]) {
+			link_score[i] =
+				cm_calculate_bss_score(psoc, entry_partner[i],
+						       pcl_chan_weight,
+						       NULL, scan_list, true);
+			entry_partner[i]->ml_info.link_score = link_score[i];
+
 			rssi[i] = entry_partner[i]->rssi_raw;
 			ch_width[i] = cm_get_ch_width(entry_partner[i],
 						      phy_config);
@@ -1935,18 +1968,25 @@ static int cm_calculate_mlo_bss_score(struct wlan_objmgr_psoc *psoc,
 						    congestion_score[i],
 						    score_params);
 
+		link_band_score[i] = cm_get_band_score(freq[i], score_params);
+		total_band_score[i] =
+			(assoc_band_score + link_band_score[i]) / 2;
+
 		total_score[i] = rssi_score[i] + bandwidth_score[i] +
-				 cong_total_score[i];
+				 cong_total_score[i] + total_band_score[i];
 		if (total_score[i] > best_total_score) {
 			best_total_score = total_score[i];
 			best_partner_index = i;
 		}
-		mlme_nofl_debug("ML score: link index %u rssi %d %d rssi score %u pror %u freq %u %u bw %u %u, bw score %u congest score %u %u %u, total score %u",
+
+		mlme_nofl_debug("ML score: link index %u rssi %d %d rssi score %u pror %u freq %u %u bw %u %u, bw score %u congest score %u %u %u, band score: %u %u, total %u",
 				i, entry->rssi_raw,  rssi[i], rssi_score[i],
 				prorated_pct[i], freq_entry, freq[i],
 				chan_width, ch_width[i], bandwidth_score[i],
 				cong_score, congestion_score[i],
-				cong_total_score[i], total_score[i]);
+				cong_total_score[i],
+				assoc_band_score, link_band_score[i],
+				total_score[i]);
 	}
 
 	*rssi_prorated_pct = prorated_pct[best_partner_index];
@@ -1973,6 +2013,18 @@ static int cm_calculate_mlo_bss_score(struct wlan_objmgr_psoc *psoc,
 		total_score[j] = 0;
 	}
 
+	for (i = 0; i < entry->ml_info.num_links; i++) {
+		if (link_score[i] > assoc_score) {
+			is_assoc_link_best = false;
+			break;
+		}
+	}
+	if (is_assoc_link_best) {
+		mlme_nofl_debug("asoc link is best, boost %d",
+				CM_ASSOC_INK_BEST_BOOST);
+		best_total_score += CM_ASSOC_INK_BEST_BOOST;
+	}
+
 	best_total_score += weight_config->mlo_weightage *
 			    mlo_boost_pct[MLMR];
 	entry->ml_info.ml_bss_score = best_total_score;
@@ -1998,7 +2050,8 @@ static int cm_calculate_mlo_bss_score(struct wlan_objmgr_psoc *psoc,
 				      struct scoring_cfg *score_params,
 				      struct psoc_phy_config *phy_config,
 				      qdf_list_t *scan_list,
-				      uint8_t *rssi_prorated_pct)
+				      uint8_t *rssi_prorated_pct,
+				      int pcl_chan_weight)
 {
 	return 0;
 }
@@ -2099,11 +2152,28 @@ cm_sort_vendor_algo_mlo_bss_entry(struct wlan_objmgr_psoc *psoc,
 {}
 #endif
 
+/**
+ * cm_calculate_bss_score() - Calculate score of AP or 1 link of MLO AP
+ * @psoc: Pointer to psoc object
+ * @entry: Bss scan entry
+ * @pcl_chan_weight: pcl chan weight
+ * @bssid_hint: bssid hint
+ * @scan_list: Scan entry list of bss candidates after filtering
+ * @is_link_score: true: calculate 1 link score of MLO AP
+ *
+ * For MLO AP, consider partner link to calculate combined score, prefer to
+ * select best link as assoc link.
+ * For legacy AP or 1 link of MLO AP, just consider single link.
+ * Prefer to select AP of higher score to connect by sort AP by score.
+ *
+ * Return: score of AP or 1 link of MLO AP
+ */
 static int cm_calculate_bss_score(struct wlan_objmgr_psoc *psoc,
 				  struct scan_cache_entry *entry,
 				  int pcl_chan_weight,
 				  struct qdf_mac_addr *bssid_hint,
-				  qdf_list_t *scan_list)
+				  qdf_list_t *scan_list,
+				  bool is_link_score)
 {
 	int32_t score = 0;
 	int32_t rssi_score = 0;
@@ -2159,6 +2229,7 @@ static int cm_calculate_bss_score(struct wlan_objmgr_psoc *psoc,
 				CM_BEST_CANDIDATE_MAX_BSS_SCORE);
 		return CM_BEST_CANDIDATE_MAX_BSS_SCORE;
 	}
+
 	bss_mlo_type = cm_bss_mlo_type(psoc, entry, scan_list);
 	if (score_config->vendor_roam_score_algorithm) {
 		score = cm_calculate_etp_score(psoc, entry, phy_config,
@@ -2176,7 +2247,7 @@ static int cm_calculate_bss_score(struct wlan_objmgr_psoc *psoc,
 		return score;
 	}
 
-	if (bss_mlo_type == SLO || bss_mlo_type == MLSR) {
+	if (is_link_score || bss_mlo_type == SLO || bss_mlo_type == MLSR) {
 		rssi_score =
 			cm_calculate_rssi_score(&score_config->rssi_score,
 						entry->rssi_raw,
@@ -2198,12 +2269,18 @@ static int cm_calculate_bss_score(struct wlan_objmgr_psoc *psoc,
 						      &congestion_pct, 0);
 		score += congestion_score * CM_SLO_CONGESTION_MAX_SCORE /
 			 CM_MAX_PCT_SCORE;
+
+		band_score = cm_get_band_score(entry->channel.chan_freq,
+					       score_config);
+		score += band_score;
+
 		if (bss_mlo_type == MLSR)
 			score += cm_calculate_emlsr_score(weight_config);
 	} else {
 		score += cm_calculate_mlo_bss_score(psoc, entry, score_config,
 						    phy_config, scan_list,
-						    &prorated_pcnt);
+						    &prorated_pcnt,
+						    pcl_chan_weight);
 	}
 
 	pcl_score = cm_calculate_pcl_score(psoc, pcl_chan_weight,
@@ -2271,28 +2348,10 @@ static int cm_calculate_bss_score(struct wlan_objmgr_psoc *psoc,
 	score += beamformee_score;
 
 	/*
-	 * Consider OCE WAN score and band preference score only if
+	 * Consider OCE WAN score score only if
 	 * congestion_pct is greater than CONGESTION_THRSHOLD_FOR_BAND_OCE_SCORE
 	 */
 	if (congestion_pct < CM_CONGESTION_THRSHOLD_FOR_BAND_OCE_SCORE) {
-		/*
-		 * If AP is on 5/6 GHZ channel , extra weigtage is added to BSS
-		 * score. if RSSI is greater than 5g rssi threshold or fall in
-		 * same bucket else give weigtage to 2.4 GHZ AP.
-		 */
-		if ((entry->rssi_raw > rssi_pref_5g_rssi_thresh) &&
-		    !same_bucket) {
-			if (!WLAN_REG_IS_24GHZ_CH_FREQ(entry->channel.chan_freq))
-				band_score = cm_get_band_score(
-						entry->channel.chan_freq,
-						score_config);
-		} else if (WLAN_REG_IS_24GHZ_CH_FREQ(
-			   entry->channel.chan_freq)) {
-			band_score = cm_get_band_score(entry->channel.chan_freq,
-						       score_config);
-		}
-		score += band_score;
-
 		oce_wan_score = cm_calculate_oce_wan_score(entry, score_config);
 		score += oce_wan_score;
 	}
@@ -2336,6 +2395,9 @@ static int cm_calculate_bss_score(struct wlan_objmgr_psoc *psoc,
 					   prorated_pcnt);
 	score += eht_score;
 
+	if (!is_link_score)
+		entry->bss_score = score;
+
 	mlme_nofl_debug("Candidate("QDF_MAC_ADDR_FMT" freq %d): rssi %d HT %d VHT %d HE %d EHT %d su bfer %d phy %d  air time frac %d qbss %d cong_pct %d NSS %d ap_tx_pwr_dbm %d oce_subnet_id_present %d sae_pk_cap_present %d prorated_pcnt %d keymgmt 0x%x mlo type %d",
 			QDF_MAC_ADDR_REF(entry->bssid.bytes),
 			entry->channel.chan_freq,
@@ -2350,15 +2412,14 @@ static int cm_calculate_bss_score(struct wlan_objmgr_psoc *psoc,
 			sae_pk_cap_present, prorated_pcnt,
 			entry->neg_sec_info.key_mgmt, bss_mlo_type);
 
-	mlme_nofl_debug("Scores: rssi %d pcl %d ht %d vht %d he %d bfee %d bw %d band %d congestion %d nss %d oce wan %d oce ap tx pwr %d subnet %d sae_pk %d eht %d security %d TOTAL %d",
+	mlme_nofl_debug("%s score: rssi %d pcl %d ht %d vht %d he %d bfee %d bw %d band %d congestion %d nss %d oce wan %d oce ap tx pwr %d subnet %d sae_pk %d eht %d security %d TOTAL %d",
+			is_link_score ? "Link" : "AP",
 			rssi_score, pcl_score, ht_score,
 			vht_score, he_score, beamformee_score, bandwidth_score,
 			band_score, congestion_score, nss_score, oce_wan_score,
 			oce_ap_tx_pwr_score, oce_subnet_id_score,
 			sae_pk_score, eht_score, security_score, score);
 
-	entry->bss_score = score;
-
 	return score;
 }
 
@@ -2562,7 +2623,7 @@ void wlan_cm_calculate_bss_score(struct wlan_objmgr_pdev *pdev,
 		     CM_DLM_REMOVE)) {
 			cm_calculate_bss_score(psoc, scan_entry->entry,
 					       pcl_chan_weight, bssid_hint,
-					       scan_list);
+					       scan_list, false);
 		} else if (denylist_action == CM_DLM_AVOID) {
 			/* add min score so that it is added back in the end */
 			scan_entry->entry->bss_score =

+ 10 - 17
umac/mlme/connection_mgr/dispatcher/inc/cfg_mlme_score_params.h

@@ -177,14 +177,13 @@
  * calculate best candidate
  * @Min: 0
  * @Max: 100
- * @Default: 2
+ * @Default: 3
  *
  * This ini is used to increase/decrease Channel Band Preference weightage
- * in best candidate selection. 5GHZ AP get this additional boost compare to
- * 2GHZ AP before   rssi_pref_5g_rssi_thresh and 2.4Ghz get weightage after
- * rssi_pref_5g_rssi_thresh.
+ * in best candidate selection. 5/6 GHz AP get additional boost compare to
+ * 2 GHz AP.
  *
- * Related: rssi_pref_5g_rssi_thresh, band_weight_per_index
+ * Related: band_weight_per_index
  *
  * Supported Feature: STA Candidate selection
  *
@@ -196,7 +195,7 @@
 	"chan_band_weightage", \
 	0, \
 	100, \
-	2, \
+	3, \
 	CFG_VALUE_OR_DEFAULT, \
 	"Channel Band Weightage")
 
@@ -795,20 +794,14 @@
  * band_weight_per_index - percentage as per band
  * @Min: 0x00000000
  * @Max: 0x64646464
- * @Default: 0x0000644B
- *
- * This INI give percentage value of chan_band_weightage to be used as per band.
- * If RSSI is greater than rssi_pref_5g_rssi_thresh preference is given for 5Ghz
- * else, it's given for 2.4Ghz.
+ * @Default: 0x00644300
  *
  * Indexes are defined in this way.
- *     0 Index (BITS 0-7): 2.4GHz - Def 10%
- *     1 Index (BITS 8-15): 5GHz - Def 20%
+ *     0 Index (BITS 0-7): 2.4GHz - Def 0%
+ *     1 Index (BITS 8-15): 5GHz - Def 67%
  *     2 Index (BITS 16-23): 6Ghz - Def - 100%
  *     3 Index (BITS 24-31): Reserved
- * These percentage values are stored in HEX. For any index max value, can be 64
- *
- * Related: chan_band_weightage, rssi_pref_5g_rssi_thresh
+ * These percentage values are stored in HEX. For any index max value is 0x64
  *
  * Supported Feature: STA Candidate selection
  *
@@ -820,7 +813,7 @@
 	"band_weight_per_index", \
 	0x00000000, \
 	0x64646464, \
-	0x00644B32, \
+	0x00644300, \
 	CFG_VALUE_OR_DEFAULT, \
 	"Band weight per index")
 

+ 2 - 0
umac/scan/dispatcher/inc/wlan_scan_public_structs.h

@@ -540,6 +540,7 @@ struct partner_link_info {
  * @self_link_id: Link id of the scan entry
  * @link_info: Array containing partner links information
  * @ml_bss_score: Multi link BSS score
+ * @link_score: MLO link score
  */
 struct ml_info {
 	struct qdf_mac_addr mld_mac_addr;
@@ -547,6 +548,7 @@ struct ml_info {
 	uint8_t self_link_id;
 	struct partner_link_info link_info[MLD_MAX_LINKS - 1];
 	uint16_t ml_bss_score;
+	uint16_t link_score;
 };
 
 /**