Browse Source

qcacmn: Add INI configuration for MLO scoring params

Add INI parameters to configure MLO scoring parameters

Change-Id: Idbdb6194dcf5230a1e6cefbbaab472bb986fa6a4
CRs-Fixed: 2958676
Bapiraju Alla 4 years ago
parent
commit
700ff4bdc8

+ 129 - 23
umac/mlme/connection_mgr/core/src/wlan_cm_bss_scoring.c

@@ -32,20 +32,8 @@
 #include "wlan_mlme_api.h"
 #endif
 
-#define CM_20MHZ_BW_INDEX                  0
-#define CM_40MHZ_BW_INDEX                  1
-#define CM_80MHZ_BW_INDEX                  2
-#define CM_160MHZ_BW_INDEX                 3
-#define CM_MAX_BW_INDEX                    4
-
 #define CM_PCL_RSSI_THRESHOLD -75
 
-#define CM_NSS_1x1_INDEX                   0
-#define CM_NSS_2x2_INDEX                   1
-#define CM_NSS_3x3_INDEX                   2
-#define CM_NSS_4x4_INDEX                   3
-#define CM_MAX_NSS_INDEX                   4
-
 #define CM_BAND_2G_INDEX                   0
 #define CM_BAND_5G_INDEX                   1
 #define CM_BAND_6G_INDEX                   2
@@ -322,7 +310,7 @@ static int32_t cm_calculate_bandwidth_score(struct scan_cache_entry *entry,
 	uint8_t ch_width_index;
 	bool is_vht = false;
 
-	bw_weight_per_idx = score_config->bandwidth_weight_per_index;
+	bw_weight_per_idx = score_config->bandwidth_weight_per_index[0];
 
 	if (WLAN_REG_IS_24GHZ_CH_FREQ(entry->channel.chan_freq)) {
 		bw_above_20 = phy_config->bw_above_20_24ghz;
@@ -515,19 +503,19 @@ static int32_t cm_calculate_nss_score(struct wlan_objmgr_psoc *psoc,
 	/* TODO: enhance for 8x8 */
 	if (nss == 4)
 		score_pct = CM_GET_SCORE_PERCENTAGE(
-				score_config->nss_weight_per_index,
+				score_config->nss_weight_per_index[0],
 				CM_NSS_4x4_INDEX);
 	else if (nss == 3)
 		score_pct = CM_GET_SCORE_PERCENTAGE(
-				score_config->nss_weight_per_index,
+				score_config->nss_weight_per_index[0],
 				CM_NSS_3x3_INDEX);
 	else if (nss == 2)
 		score_pct = CM_GET_SCORE_PERCENTAGE(
-				score_config->nss_weight_per_index,
+				score_config->nss_weight_per_index[0],
 				CM_NSS_2x2_INDEX);
 	else
 		score_pct = CM_GET_SCORE_PERCENTAGE(
-				score_config->nss_weight_per_index,
+				score_config->nss_weight_per_index[0],
 				CM_NSS_1x1_INDEX);
 
 	return (score_config->weight_config.nss_weightage * score_pct *
@@ -1962,6 +1950,124 @@ cm_limit_max_per_index_score(uint32_t per_index_score)
 	return per_index_score;
 }
 
+#ifdef WLAN_FEATURE_11BE_MLO
+
+#define CM_EHT_CAP_WEIGHTAGE 2
+#define CM_MLO_WEIGHTAGE 3
+#define CM_WLM_INDICATION_WEIGHTAGE 2
+#define CM_EMLSR_WEIGHTAGE 3
+
+static void cm_init_mlo_score_config(struct wlan_objmgr_psoc *psoc,
+				     struct scoring_cfg *score_cfg,
+				     uint32_t *total_weight)
+{
+	score_cfg->weight_config.eht_caps_weightage =
+		cfg_get(psoc, CFG_SCORING_EHT_CAPS_WEIGHTAGE);
+
+	score_cfg->weight_config.mlo_weightage =
+		cfg_get(psoc, CFG_SCORING_MLO_WEIGHTAGE);
+
+	score_cfg->weight_config.wlm_indication_weightage =
+		cfg_get(psoc, CFG_SCORING_WLM_INDICATION_WEIGHTAGE);
+
+	score_cfg->weight_config.joint_rssi_alpha =
+				cfg_get(psoc, CFG_SCORING_JOINT_RSSI_ALPHA);
+
+	score_cfg->weight_config.low_band_rssi_boost =
+				cfg_get(psoc, CFG_SCORING_LOW_BAND_RSSI_BOOST);
+
+	score_cfg->weight_config.joint_esp_alpha =
+				cfg_get(psoc, CFG_SCORING_JOINT_ESP_ALPHA);
+
+	score_cfg->weight_config.low_band_esp_boost =
+				cfg_get(psoc, CFG_SCORING_LOW_BAND_ESP_BOOST);
+
+	score_cfg->weight_config.joint_oce_alpha =
+				cfg_get(psoc, CFG_SCORING_JOINT_OCE_ALPHA);
+
+	score_cfg->weight_config.low_band_oce_boost =
+				cfg_get(psoc, CFG_SCORING_LOW_BAND_OCE_BOOST);
+
+	score_cfg->weight_config.emlsr_weightage =
+		cfg_get(psoc, CFG_SCORING_EMLSR_WEIGHTAGE);
+
+	score_cfg->mlsr_link_selection =
+		cfg_get(psoc, CFG_SCORING_MLSR_LINK_SELECTION);
+
+	*total_weight += score_cfg->weight_config.eht_caps_weightage +
+			 score_cfg->weight_config.mlo_weightage +
+			 score_cfg->weight_config.wlm_indication_weightage +
+			 score_cfg->weight_config.emlsr_weightage;
+}
+
+static void cm_set_default_mlo_weights(struct scoring_cfg *score_cfg)
+{
+	score_cfg->weight_config.eht_caps_weightage = CM_EHT_CAP_WEIGHTAGE;
+	score_cfg->weight_config.mlo_weightage = CM_MLO_WEIGHTAGE;
+	score_cfg->weight_config.wlm_indication_weightage =
+						CM_WLM_INDICATION_WEIGHTAGE;
+	score_cfg->weight_config.emlsr_weightage = CM_EMLSR_WEIGHTAGE;
+}
+
+static void cm_init_bw_weight_per_index(struct wlan_objmgr_psoc *psoc,
+					struct scoring_cfg *score_cfg)
+{
+	score_cfg->bandwidth_weight_per_index[0] =
+		cm_limit_max_per_index_score(
+			cfg_get(psoc, CFG_SCORING_BW_WEIGHT_PER_IDX));
+
+	score_cfg->bandwidth_weight_per_index[1] =
+		cm_limit_max_per_index_score(
+			cfg_get(psoc, CFG_SCORING_ML_BW_WEIGHT_PER_IDX_4_TO_7));
+
+	score_cfg->bandwidth_weight_per_index[2] =
+		cm_limit_max_per_index_score(
+		     cfg_get(psoc, CFG_SCORING_ML_BW_WEIGHT_PER_IDX_8_TO_11));
+
+	score_cfg->bandwidth_weight_per_index[3] =
+		cm_limit_max_per_index_score(
+		    cfg_get(psoc, CFG_SCORING_ML_BW_WEIGHT_PER_IDX_12_TO_15));
+}
+
+static void cm_init_nss_weight_per_index(struct wlan_objmgr_psoc *psoc,
+					 struct scoring_cfg *score_cfg)
+{
+	score_cfg->nss_weight_per_index[0] =
+		cm_limit_max_per_index_score(
+			cfg_get(psoc, CFG_SCORING_NSS_WEIGHT_PER_IDX));
+
+	score_cfg->nss_weight_per_index[1] =
+		cm_limit_max_per_index_score(
+		      cfg_get(psoc, CFG_SCORING_ML_NSS_WEIGHT_PER_IDX_4_TO_7));
+}
+#else
+static void cm_init_mlo_score_config(struct wlan_objmgr_psoc *psoc,
+				     struct scoring_cfg *score_cfg,
+				     uint32_t *total_weight)
+{
+}
+
+static void cm_set_default_mlo_weights(struct scoring_cfg *score_cfg)
+{
+}
+
+static void cm_init_bw_weight_per_index(struct wlan_objmgr_psoc *psoc,
+					struct scoring_cfg *score_cfg)
+{
+	score_cfg->bandwidth_weight_per_index[0] =
+		cm_limit_max_per_index_score(
+			cfg_get(psoc, CFG_SCORING_BW_WEIGHT_PER_IDX));
+}
+
+static void cm_init_nss_weight_per_index(struct wlan_objmgr_psoc *psoc,
+					 struct scoring_cfg *score_cfg)
+{
+	score_cfg->nss_weight_per_index[0] =
+		cm_limit_max_per_index_score(
+			cfg_get(psoc, CFG_SCORING_NSS_WEIGHT_PER_IDX));
+}
+#endif
+
 void wlan_cm_init_score_config(struct wlan_objmgr_psoc *psoc,
 			       struct scoring_cfg *score_cfg)
 {
@@ -1996,6 +2102,8 @@ void wlan_cm_init_score_config(struct wlan_objmgr_psoc *psoc,
 	score_cfg->weight_config.sae_pk_ap_weightage =
 				cfg_get(psoc, CFG_SAE_PK_AP_WEIGHTAGE);
 
+	cm_init_mlo_score_config(psoc, score_cfg, &total_weight);
+
 	total_weight =  score_cfg->weight_config.rssi_weightage +
 			score_cfg->weight_config.ht_caps_weightage +
 			score_cfg->weight_config.vht_caps_weightage +
@@ -2043,6 +2151,7 @@ void wlan_cm_init_score_config(struct wlan_objmgr_psoc *psoc,
 						CM_OCE_SUBNET_ID_WEIGHTAGE;
 		score_cfg->weight_config.sae_pk_ap_weightage =
 						CM_SAE_PK_AP_WEIGHTAGE;
+		cm_set_default_mlo_weights(score_cfg);
 	}
 
 	score_cfg->rssi_score.best_rssi_threshold =
@@ -2095,12 +2204,6 @@ void wlan_cm_init_score_config(struct wlan_objmgr_psoc *psoc,
 		cm_limit_max_per_index_score(
 			cfg_get(psoc, CFG_SCORING_OCE_WAN_SCORE_IDX_15_TO_12));
 
-	score_cfg->bandwidth_weight_per_index =
-		cm_limit_max_per_index_score(
-			cfg_get(psoc, CFG_SCORING_BW_WEIGHT_PER_IDX));
-	score_cfg->nss_weight_per_index =
-		cm_limit_max_per_index_score(
-			cfg_get(psoc, CFG_SCORING_NSS_WEIGHT_PER_IDX));
 	score_cfg->band_weight_per_index =
 		cm_limit_max_per_index_score(
 			cfg_get(psoc, CFG_SCORING_BAND_WEIGHT_PER_IDX));
@@ -2110,4 +2213,7 @@ void wlan_cm_init_score_config(struct wlan_objmgr_psoc *psoc,
 			cfg_get(psoc, CFG_VENDOR_ROAM_SCORE_ALGORITHM);
 	score_cfg->check_assoc_disallowed = true;
 	cm_fill_6ghz_params(psoc, score_cfg);
+
+	cm_init_bw_weight_per_index(psoc, score_cfg);
+	cm_init_nss_weight_per_index(psoc, score_cfg);
 }

+ 487 - 1
umac/mlme/connection_mgr/dispatcher/inc/cfg_mlme_score_params.h

@@ -1161,6 +1161,491 @@
 #define CFG_6GHZ_CONFIG
 #endif
 
+#ifdef WLAN_FEATURE_11BE_MLO
+/**
+ * <ini>
+ * eht_caps_weightage - EHT caps Weightage to calculate best candidate
+ * @Min: 0
+ * @Max: 100
+ * @Default: 2
+ *
+ * This ini is used to increase/decrease EHT caps weightage in best candidate
+ * selection. If AP supports EHT caps, AP will get additional weightage with
+ * this param. Weightage will be given only if dot11mode is EHT capable.
+ *
+ * Related: None
+ *
+ * Supported Feature: STA Candidate selection
+ *
+ * Usage: External
+ *
+ * </ini>
+ */
+#define CFG_SCORING_EHT_CAPS_WEIGHTAGE CFG_INI_UINT( \
+	"eht_caps_weightage", \
+	0, \
+	100, \
+	2, \
+	CFG_VALUE_OR_DEFAULT, \
+	"EHT Caps Weightage")
+
+/**
+ * <ini>
+ * mlo_weightage - MLO Weightage to calculate best candidate
+ * @Min: 0
+ * @Max: 100
+ * @Default: 3
+ *
+ * This ini is used to increase/decrease MLO weightage in best candidate
+ * selection. If AP supports MLO, AP will get additional weightage with
+ * this param.
+ *
+ * Related: None
+ *
+ * Supported Feature: STA Candidate selection
+ *
+ * Usage: External
+ *
+ * </ini>
+ */
+#define CFG_SCORING_MLO_WEIGHTAGE CFG_INI_UINT( \
+	"mlo_weightage", \
+	0, \
+	100, \
+	3, \
+	CFG_VALUE_OR_DEFAULT, \
+	"MLO Weightage")
+
+/**
+ * <ini>
+ * emlsr_weightage - eMLSR Weightage to calculate best candidate
+ * @Min: 0
+ * @Max: 100
+ * @Default: 3
+ *
+ * This ini is used to increase/decrease eMLSR weightage in best candidate
+ * selection. If AP supports eMLSR, AP will get additional weightage with
+ * this param.
+ *
+ * Related: None
+ *
+ * Supported Feature: STA Candidate selection
+ *
+ * Usage: External
+ *
+ * </ini>
+ */
+#define CFG_SCORING_EMLSR_WEIGHTAGE CFG_INI_UINT( \
+	"emlsr_weightage", \
+	0, \
+	100, \
+	3, \
+	CFG_VALUE_OR_DEFAULT, \
+	"eMLSR Weightage")
+
+/**
+ * <ini>
+ * wlm_indication_weightage - WLM indication Weightage to calculate best
+ *                            candidate
+ * @Min: 0
+ * @Max: 100
+ * @Default: 2
+ *
+ * This ini is used to increase/decrease WLM indication weightage in best
+ * candidate selection. AP will get additional weightage with this param based
+ * on WLM indicates ultra low latency or low latency.
+ *
+ * Related: None
+ *
+ * Supported Feature: STA Candidate selection
+ *
+ * Usage: External
+ *
+ * </ini>
+ */
+#define CFG_SCORING_WLM_INDICATION_WEIGHTAGE CFG_INI_UINT( \
+	"wlm_indication_weightage", \
+	0, \
+	100, \
+	2, \
+	CFG_VALUE_OR_DEFAULT, \
+	"WLM indication Weightage")
+
+/**
+ * <ini>
+ * mlsr_link_selection - MLSR link selection criteria
+ * @Min: 0
+ * @Max: 1
+ * @Default: 0
+ *
+ * This ini is used to select the link to operate in MLSR mode.
+ *
+ * The values are defined as follows:
+ *    0 : ML Link with highest link score
+ *    1 : Link corresponds to best average ML score
+ *
+ * Related: None
+ *
+ * Supported Feature: STA Candidate selection
+ *
+ * Usage: External
+ *
+ * </ini>
+ */
+#define CFG_SCORING_MLSR_LINK_SELECTION CFG_INI_UINT( \
+	"mlsr_link_selection", \
+	0, \
+	1, \
+	0, \
+	CFG_VALUE_OR_DEFAULT, \
+	"MLSR link selection")
+
+/**
+ * <ini>
+ * joint_rssi_alpha - Joint RSSI alpha to select best ML candidate
+ * @Min: 0
+ * @Max: 100
+ * @Default: 50
+ *
+ * This ini is used to increase/decrease joint RSSI alpha percentage for
+ * an MLO candidate in best candidate selection. Using this the joint RSSI
+ * will be calculated as below.
+ *
+ *     joint_rssi = (alpha % Link1 RSSI) + ((100 - alpha)% Link2 RSSI)
+ *
+ * Related: low_band_rssi_boost
+ *
+ * Supported Feature: STA Candidate selection
+ *
+ * Usage: External
+ *
+ * </ini>
+ */
+#define CFG_SCORING_JOINT_RSSI_ALPHA CFG_INI_UINT( \
+	"joint_rssi_alpha", \
+	0, \
+	100, \
+	50, \
+	CFG_VALUE_OR_DEFAULT, \
+	"Joint RSSI alpha")
+
+/**
+ * <ini>
+ * low_band_rssi_boost - Low band RSSI boost in joint RSSI calculation
+ * @Min: 0
+ * @Max: 1
+ * @Default: 1
+ *
+ * If joint RSSI alpha is not 50 then joint RSSI calculation will depend on
+ * this INI param as explained below.
+ *
+ * If this INI set to 1, then lower band will be given more weightage.
+ * Otherwise higher band will get more weightage.
+ *
+ *    Example: Joint RSSI alpha is 70
+ *	if (low_band_rssi_boost)
+ *		joint_rssi_5g_6g = (70 * 5g_rssi) + (30 * 6g_rssi)
+ *	else
+ *		joint_rssi_5g_6g = (30 * 5g_rssi) + (70 * 6g_rssi)
+ *
+ * Related: joint_rssi_alpha
+ *
+ * Supported Feature: STA Candidate selection
+ *
+ * Usage: External
+ *
+ * </ini>
+ */
+#define CFG_SCORING_LOW_BAND_RSSI_BOOST CFG_INI_BOOL( \
+				"low_band_rssi_boost", \
+				1, \
+				"Low band RSSI boost ")
+
+/**
+ * <ini>
+ * joint_esp_alpha - Joint ESP alpha to select best ML candidate
+ * @Min: 0
+ * @Max: 100
+ * @Default: 50
+ *
+ * This ini is used to increase/decrease joint ESP alpha percentage for
+ * an MLO candidate in best candidate selection. Using this the joint ESP
+ * will be calculated as below.
+ *
+ *     joint_esp = (alpha % Link1 ESP) + ((100 - alpha)% Link2 ESP)
+ *
+ * Related: low_band_esp_boost
+ *
+ * Supported Feature: STA Candidate selection
+ *
+ * Usage: External
+ *
+ * </ini>
+ */
+#define CFG_SCORING_JOINT_ESP_ALPHA CFG_INI_UINT( \
+	"joint_esp_alpha", \
+	0, \
+	100, \
+	50, \
+	CFG_VALUE_OR_DEFAULT, \
+	"Joint ESP alpha")
+
+/**
+ * <ini>
+ * low_band_esp_boost - Low band ESP boost in joint ESP calculation
+ * @Min: 0
+ * @Max: 1
+ * @Default: 1
+ *
+ * If joint ESP alpha is not 50 then joint ESP calculation will depend on
+ * this INI param as explained below.
+ *
+ * If this INI set to 1, then lower band will be given more weightage.
+ * Otherwise higher band will get more weightage.
+ *
+ *    Example: Joint ESP alpha is 70
+ *	if (low_band_esp_boost)
+ *		joint_esp_5g_6g = (70 * 5g_esp) + (30 * 6g_esp)
+ *	else
+ *		joint_esp_5g_6g = (30 * 5g_esp) + (70 * 6g_esp)
+ *
+ * Related: joint_esp_alpha
+ *
+ * Supported Feature: STA Candidate selection
+ *
+ * Usage: External
+ *
+ * </ini>
+ */
+#define CFG_SCORING_LOW_BAND_ESP_BOOST CFG_INI_BOOL( \
+				"low_band_esp_boost", \
+				1, \
+				"Low band ESP boost ")
+
+/**
+ * <ini>
+ * joint_oce_alpha - Joint OCE alpha to select best ML candidate
+ * @Min: 0
+ * @Max: 100
+ * @Default: 50
+ *
+ * This ini is used to increase/decrease joint OCE alpha percentage for
+ * an MLO candidate in best candidate selection. Using this the joint OCE
+ * will be calculated as below.
+ *
+ *     joint_oce = (alpha % Link1 OCE) + ((100 - alpha)% Link2 OCE)
+ *
+ * Related: low_band_oce_boost
+ *
+ * Supported Feature: STA Candidate selection
+ *
+ * Usage: External
+ *
+ * </ini>
+ */
+#define CFG_SCORING_JOINT_OCE_ALPHA CFG_INI_UINT( \
+	"joint_oce_alpha", \
+	0, \
+	100, \
+	50, \
+	CFG_VALUE_OR_DEFAULT, \
+	"Joint OCE alpha")
+
+/**
+ * <ini>
+ * low_band_oce_boost - Low band OCE boost in joint OCE calculation
+ * @Min: 0
+ * @Max: 1
+ * @Default: 1
+ *
+ * If joint OCE alpha is not 50 then joint OCE calculation will depend on
+ * this INI param as explained below.
+ *
+ * If this INI set to 1, then lower band will be given more weightage.
+ * Otherwise higher band will get more weightage.
+ *
+ *    Example: Joint OCE alpha is 70
+ *	if (low_band_oce_boost)
+ *		joint_oce_5g_6g = (70 * 5g_oce) + (30 * 6g_oce)
+ *	else
+ *		joint_oce_5g_6g = (30 * 5g_oce) + (70 * 6g_oce)
+ *
+ * Related: joint_oce_alpha
+ *
+ * Supported Feature: STA Candidate selection
+ *
+ * Usage: External
+ *
+ * </ini>
+ */
+#define CFG_SCORING_LOW_BAND_OCE_BOOST CFG_INI_BOOL( \
+				"low_band_oce_boost", \
+				1, \
+				"Low band OCE boost ")
+
+/*
+ * <ini>
+ * ml_bandwidth_weight_per_index_4_to_7 - percentage as per bandwidth
+ * @Min: 0x00000000
+ * @Max: 0x64646464
+ * @Default: 0x342A1F14
+ *
+ * This INI give percentage value of chan_width_weightage to be used as per
+ * peer bandwidth for two links. Self BW is also considered while calculating
+ * score. Eg if self BW is 20+20 MHZ 20% will be given for all AP irrespective
+ * of the AP  capability.
+ *
+ * Indexes are defined in this way.
+ *     4 Index (BITS 0-7): 20+20 MHz - Def 20%
+ *     5 Index (BITS 8-15): 20+40 MHz - Def 31%
+ *     6 Index (BITS 16-23): 40+40 MHz - Def 42%
+ *     7 Index (BITS 24-31): 20+80 MHz - Def 52%
+ * These percentage values are stored in HEX. For any index max value, can be 64
+ *
+ * Indexes 0-3 are considered as part of the INI bandwidth_weight_per_index
+ *
+ * Related: chan_width_weightage
+ *
+ * Supported Feature: STA Candidate selection
+ *
+ * Usage: External
+ *
+ * </ini>
+ */
+#define CFG_SCORING_ML_BW_WEIGHT_PER_IDX_4_TO_7 CFG_INI_UINT( \
+	"ml_bandwidth_weight_per_index_4_to_7", \
+	0x00000000, \
+	0x64646464, \
+	0x342A1F14, \
+	CFG_VALUE_OR_DEFAULT, \
+	"ML Bandwidth weight per index 4 to 7")
+
+/*
+ * <ini>
+ * ml_bandwidth_weight_per_index_8_to_11 - percentage as per bandwidth
+ * @Min: 0x00000000
+ * @Max: 0x64646464
+ * @Default: 0x5A57553F
+ *
+ * This INI give percentage value of chan_width_weightage to be used as per
+ * peer bandwidth for two links. Self BW is also considered while calculating
+ * score. Eg if self BW is 20+20 MHZ 20% will be given for all AP irrespective
+ * of the AP  capability.
+ *
+ * Indexes are defined in this way.
+ *     8 Index (BITS 0-7): 40+80 MHz - Def 63%
+ *     9 Index (BITS 8-15): 80+80 MHz - Def 85%
+ *     10 Index (BITS 16-23): 20+160 MHz - Def 87%
+ *     11 Index (BITS 24-31): 40+160 MHz - Def 90%
+ * These percentage values are stored in HEX. For any index max value, can be 64
+ *
+ * Related: chan_width_weightage
+ *
+ * Supported Feature: STA Candidate selection
+ *
+ * Usage: External
+ *
+ * </ini>
+ */
+#define CFG_SCORING_ML_BW_WEIGHT_PER_IDX_8_TO_11 CFG_INI_UINT( \
+	"ml_bandwidth_weight_per_index_8_to_11", \
+	0x00000000, \
+	0x64646464, \
+	0x5A57553F, \
+	CFG_VALUE_OR_DEFAULT, \
+	"ML Bandwidth weight per index 8 to 11")
+
+/*
+ * <ini>
+ * ml_bandwidth_weight_per_index_12_to_15 - percentage as per bandwidth
+ * @Min: 0x00000000
+ * @Max: 0x00646464
+ * @Default: 0x0064645F
+ *
+ * This INI give percentage value of chan_width_weightage to be used as per
+ * peer bandwidth for two links. Self BW is also considered while calculating
+ * score. Eg if self BW is 20+20 MHZ 20% will be given for all AP irrespective
+ * of the AP  capability.
+ *
+ * Indexes are defined in this way.
+ *     12 Index (BITS 0-7): 80+160 MHz - Def 95%
+ *     13 Index (BITS 8-15): 160+160 MHz - Def 100%
+ *     14 Index (BITS 16-23): 320 MHz - Def 100%
+ *     15 Index (BITS 24-31): Reserved - Def 0
+ * These percentage values are stored in HEX. For any index max value, can be 64
+ *
+ * Related: chan_width_weightage
+ *
+ * Supported Feature: STA Candidate selection
+ *
+ * Usage: External
+ *
+ * </ini>
+ */
+#define CFG_SCORING_ML_BW_WEIGHT_PER_IDX_12_TO_15 CFG_INI_UINT( \
+	"ml_bandwidth_weight_per_index_12_to_15", \
+	0x00000000, \
+	0x00646464, \
+	0x0064645F, \
+	CFG_VALUE_OR_DEFAULT, \
+	"ML Bandwidth weight per index 12 to 15")
+
+/*
+ * <ini>
+ * ml_nss_weight_per_index_4_to_7 - percentage as per NSS
+ * @Min: 0x00000000
+ * @Max: 0x00646464
+ * @Default: 0x00645019
+ *
+ * This INI give percentage value of nss_weightage to be used as per peer NSS.
+ * Self NSS capability is also considered. Eg if self NSS is 1x1 10% will be
+ * given for all AP irrespective of the AP capability.
+ *
+ * Indexes are defined in this way.
+ *     4 Index (BITS 0-7): 2x2 + 2x2 - Def 25%
+ *     5 Index (BITS 8-15): 4x4 + 4x4 - Def 80%
+ *     6 Index (BITS 16-23): 8X8- Def 100%
+ *     7 Index (BITS 24-31): Reserved - Def 0
+ * These percentage values are stored in HEX. For any index max value, can be 64
+ *
+ * Indexes 0-3 are considered as part of the INI nss_weight_per_index
+ *
+ * Related: nss_weightage
+ *
+ * Supported Feature: STA Candidate selection
+ *
+ * Usage: External
+ *
+ * </ini>
+ */
+#define CFG_SCORING_ML_NSS_WEIGHT_PER_IDX_4_TO_7 CFG_INI_UINT( \
+	"ml_nss_weight_per_index_4_to_7", \
+	0x00000000, \
+	0x00646464, \
+	0x00645019, \
+	CFG_VALUE_OR_DEFAULT, \
+	"ML NSS weight per index 4 to 7")
+
+#define CFG_MLO_CONFIG \
+	CFG(CFG_SCORING_EHT_CAPS_WEIGHTAGE) \
+	CFG(CFG_SCORING_EMLSR_WEIGHTAGE) \
+	CFG(CFG_SCORING_JOINT_ESP_ALPHA) \
+	CFG(CFG_SCORING_JOINT_OCE_ALPHA) \
+	CFG(CFG_SCORING_JOINT_RSSI_ALPHA) \
+	CFG(CFG_SCORING_LOW_BAND_ESP_BOOST) \
+	CFG(CFG_SCORING_LOW_BAND_OCE_BOOST) \
+	CFG(CFG_SCORING_LOW_BAND_RSSI_BOOST) \
+	CFG(CFG_SCORING_ML_BW_WEIGHT_PER_IDX_4_TO_7) \
+	CFG(CFG_SCORING_ML_BW_WEIGHT_PER_IDX_8_TO_11) \
+	CFG(CFG_SCORING_ML_BW_WEIGHT_PER_IDX_12_TO_15) \
+	CFG(CFG_SCORING_ML_NSS_WEIGHT_PER_IDX_4_TO_7) \
+	CFG(CFG_SCORING_MLO_WEIGHTAGE) \
+	CFG(CFG_SCORING_MLSR_LINK_SELECTION) \
+	CFG(CFG_SCORING_WLM_INDICATION_WEIGHTAGE)
+#else
+#define CFG_MLO_CONFIG
+#endif
+
 #define CFG_MLME_SCORE_ALL \
 	CFG(CFG_SCORING_RSSI_WEIGHTAGE) \
 	CFG(CFG_SCORING_HT_CAPS_WEIGHTAGE) \
@@ -1199,6 +1684,7 @@
 	CFG(CFG_SCORING_OCE_WAN_SCORE_IDX_15_TO_12) \
 	CFG(CFG_IS_BSSID_HINT_PRIORITY) \
 	CFG(CFG_VENDOR_ROAM_SCORE_ALGORITHM) \
-	CFG_6GHZ_CONFIG
+	CFG_6GHZ_CONFIG \
+	CFG_MLO_CONFIG
 
 #endif /* __CFG_MLME_SCORE_PARAMS_H */

+ 73 - 3
umac/mlme/connection_mgr/dispatcher/inc/wlan_cm_bss_score_param.h

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2017-2021, The Linux Foundation. All rights reserved.
  *
  * Permission to use, copy, modify, and/or distribute this software for any
  * purpose with or without fee is hereby granted, provided that the above
@@ -40,6 +40,16 @@
  * @oce_ap_tx_pwr_weightage: OCE AP tx power weigtage
  * @oce_subnet_id_weightage: OCE subnet id weigtage
  * @sae_pk_ap_weightage: SAE-PK AP weigtage
+ * @eht_caps_weightage: EHT caps weightage
+ * @mlo_weightage: MLO weightage
+ * @joint_rssi_alpha: Joint RSSI alpha value
+ * @joint_esp_alpha: Joint ESP alpha value
+ * @joint_oce_alpha: Joint OCE alpha value
+ * @low_band_rssi_boost: Flag to assign higher alpha weightage low band RSSI
+ * @low_band_esp_boost: Flag to assign higher alpha weightage low band esp
+ * @low_band_oce_boost: Flag to assign higher alpha weightage low band oce
+ * @wlm_indication_weightage: WLM indication weightage
+ * @emlsr_weightage: eMLSR weightage
  */
 struct weight_cfg {
 	uint8_t rssi_weightage;
@@ -56,6 +66,19 @@ struct weight_cfg {
 	uint8_t oce_ap_tx_pwr_weightage;
 	uint8_t oce_subnet_id_weightage;
 	uint8_t sae_pk_ap_weightage;
+#ifdef WLAN_FEATURE_11BE_MLO
+	uint8_t eht_caps_weightage;
+	uint8_t mlo_weightage;
+	uint8_t joint_rssi_alpha;
+	uint8_t joint_esp_alpha;
+	uint8_t joint_oce_alpha;
+	uint8_t low_band_rssi_boost:1,
+		low_band_esp_boost:1,
+		low_band_oce_boost:1,
+		reserved:5;
+	uint8_t wlm_indication_weightage;
+	uint8_t emlsr_weightage;
+#endif
 };
 
 /**
@@ -116,6 +139,49 @@ struct per_slot_score {
 	uint32_t score_pcnt15_to_12;
 };
 
+#ifndef WLAN_FEATURE_11BE_MLO
+#define CM_20MHZ_BW_INDEX                  0
+#define CM_40MHZ_BW_INDEX                  1
+#define CM_80MHZ_BW_INDEX                  2
+#define CM_160MHZ_BW_INDEX                 3
+#define CM_MAX_BW_INDEX                    4
+
+#define CM_NSS_1x1_INDEX                   0
+#define CM_NSS_2x2_INDEX                   1
+#define CM_NSS_3x3_INDEX                   2
+#define CM_NSS_4x4_INDEX                   3
+#define CM_MAX_NSS_INDEX                   4
+#else
+enum cm_bw_idx {
+	CM_20MHZ_BW_INDEX,
+	CM_40MHZ_BW_INDEX,
+	CM_80MHZ_BW_INDEX,
+	CM_160MHZ_BW_INDEX,
+	CM_MLO_20_PLUS_20MHZ_BW_INDEX,
+	CM_MLO_20_PLUS_40MHZ_BW_INDEX,
+	CM_MLO_40_PLUS_40MHZ_BW_INDEX,
+	CM_MLO_20_PLUS_80MHZ_BW_INDEX,
+	CM_MLO_40_PLUS_80MHZ_BW_INDEX,
+	CM_MLO_80_PLUS_80MHZ_BW_INDEX,
+	CM_MLO_20_PLUS_160HZ_BW_INDEX,
+	CM_MLO_40_PLUS_160HZ_BW_INDEX,
+	CM_MLO_80_PLUS_160HZ_BW_INDEX,
+	CM_MLO_160_PLUS_160HZ_BW_INDEX,
+	CM_320MHZ_BW_INDEX,
+	CM_MAX_BW_INDEX
+};
+
+enum cm_nss_idx {
+	CM_NSS_1x1_INDEX,
+	CM_NSS_2x2_INDEX,
+	CM_NSS_3x3_INDEX,
+	CM_NSS_4x4_INDEX,
+	CM_NSS_2x2_PLUS_2x2_INDEX,
+	CM_NSS_4x4_PLUS_4x4_INDEX,
+	CM_MAX_NSS_INDEX
+};
+#endif
+
 /**
  * struct scoring_cfg - Scoring related configuration
  * @weight_cfg: weigtage config for config
@@ -130,20 +196,24 @@ struct per_slot_score {
  * @vendor_roam_score_algorithm: Preferred ETP vendor roam score algorithm
  * @check_6ghz_security: check security for 6Ghz candidate
  * @key_mgmt_mask_6ghz: user configurable mask for 6ghz AKM
+ * @mlsr_link_selection: MLSR link selection config
  */
 struct scoring_cfg {
 	struct weight_cfg weight_config;
 	struct rssi_config_score rssi_score;
 	struct per_slot_score esp_qbss_scoring;
 	struct per_slot_score oce_wan_scoring;
-	uint32_t bandwidth_weight_per_index;
-	uint32_t nss_weight_per_index;
+	uint32_t bandwidth_weight_per_index[qdf_ceil(CM_MAX_BW_INDEX, 4)];
+	uint32_t nss_weight_per_index[qdf_ceil(CM_MAX_NSS_INDEX, 4)];
 	uint32_t band_weight_per_index;
 	uint8_t is_bssid_hint_priority:1,
 		 check_assoc_disallowed:1,
 		 vendor_roam_score_algorithm:1,
 		 check_6ghz_security:1;
 	uint32_t key_mgmt_mask_6ghz;
+#ifdef WLAN_FEATURE_11BE_MLO
+	uint8_t mlsr_link_selection;
+#endif
 };
 
 /**