Browse Source

qcacld-3.0: Add BSS Scoring Related INI Items

Add BSS Scoring Related CFG Items to CFG Component.

Change-Id: Icb012f2560e7ebed298d2041085a516c582e56b6
CRs-Fixed: 2318316
Vignesh Viswanathan 6 years ago
parent
commit
ff78bc174f

+ 1023 - 0
components/mlme/dispatcher/inc/cfg_mlme_scoring.h

@@ -0,0 +1,1023 @@
+/*
+ * Copyright (c) 2012-2018 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 copyright notice and this permission notice appear in all
+ * copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
+ * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
+ * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/**
+ * DOC: This file contains MLME SCORING related CFG/INI Items.
+ */
+
+#ifndef __CFG_MLME_SCORING_H
+#define __CFG_MLME_SCORING_H
+
+/*
+ * <ini>
+ * rssi_weightage - RSSI Weightage to calculate best candidate
+ * @Min: 0
+ * @Max: 100
+ * @Default: 20
+ *
+ * This ini is used to increase/decrease RSSI weightage in best candidate
+ * selection. AP with better RSSI will get more weightage.
+ *
+ * Related: None
+ *
+ * Supported Feature: STA Candidate selection
+ *
+ * Usage: External
+ *
+ * </ini>
+ */
+#define CFG_SCORING_RSSI_WEIGHTAGE CFG_INI_UINT( \
+	"rssi_weightage", \
+	0, \
+	100, \
+	20, \
+	CFG_VALUE_OR_DEFAULT, \
+	"RSSI Weightage")
+
+/*
+ * <ini>
+ * ht_caps_weightage - HT caps weightage to calculate best candidate
+ * @Min: 0
+ * @Max: 100
+ * @Default: 2
+ *
+ * This ini is used to increase/decrease HT caps weightage in best candidate
+ * selection. If AP supports HT caps, AP will get additional Weightage with
+ * this param. Weightage will be given only if dot11mode is HT capable.
+ *
+ * Related: None
+ *
+ * Supported Feature: STA Candidate selection
+ *
+ * Usage: External
+ *
+ * </ini>
+ */
+#define CFG_SCORING_HT_CAPS_WEIGHTAGE CFG_INI_UINT( \
+	"ht_caps_weightage", \
+	0, \
+	100, \
+	2, \
+	CFG_VALUE_OR_DEFAULT, \
+	"HT Caps Weightage")
+
+/*
+ * <ini>
+ * vht_caps_weightage - VHT caps Weightage to calculate best candidate
+ * @Min: 0
+ * @Max: 100
+ * @Default: 1
+ *
+ * This ini is used to increase/decrease VHT caps weightage in best candidate
+ * selection. If AP supports VHT caps, AP will get additional weightage with
+ * this param. Weightage will be given only if dot11mode is VHT capable.
+ *
+ * Related: None
+ *
+ * Supported Feature: STA Candidate selection
+ *
+ * Usage: External
+ *
+ * </ini>
+ */
+#define CFG_SCORING_VHT_CAPS_WEIGHTAGE CFG_INI_UINT( \
+	"vht_caps_weightage", \
+	0, \
+	100, \
+	1, \
+	CFG_VALUE_OR_DEFAULT, \
+	"HT Caps Weightage")
+
+/*
+ * <ini>
+ * he_caps_weightage - HE caps Weightage to calculate best candidate
+ * @Min: 0
+ * @Max: 100
+ * @Default: 2
+ *
+ * This ini is used to increase/decrease HE caps weightage in best candidate
+ * selection. If AP supports HE caps, AP will get additional weightage with
+ * this param. Weightage will be given only if dot11mode is HE capable.
+ *
+ * Related: None
+ *
+ * Supported Feature: STA Candidate selection
+ *
+ * Usage: External
+ *
+ * </ini>
+ */
+#define CFG_SCORING_HE_CAPS_WEIGHTAGE CFG_INI_UINT( \
+	"he_caps_weightage", \
+	0, \
+	100, \
+	2, \
+	CFG_VALUE_OR_DEFAULT, \
+	"HE Caps Weightage")
+
+/*
+ * <ini>
+ * chan_width_weightage - Channel Width Weightage to calculate best candidate
+ * @Min: 0
+ * @Max: 100
+ * @Default: 17
+ *
+ * This ini is used to increase/decrease Channel Width weightage in best
+ * candidate selection. AP with Higher channel width will get higher weightage
+ *
+ * Related: bandwidth_weight_per_index
+ *
+ * Supported Feature: STA Candidate selection
+ *
+ * Usage: External
+ *
+ * </ini>
+ */
+#define CFG_SCORING_CHAN_WIDTH_WEIGHTAGE CFG_INI_UINT( \
+	"chan_width_weightage", \
+	0, \
+	100, \
+	17, \
+	CFG_VALUE_OR_DEFAULT, \
+	"Channel width weightage")
+
+/*
+ * <ini>
+ * chan_band_weightage - Channel Band perferance to 5GHZ to
+ * calculate best candidate
+ * @Min: 0
+ * @Max: 100
+ * @Default: 2
+ *
+ * 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.
+ *
+ * Related: rssi_pref_5g_rssi_thresh, band_weight_per_index
+ *
+ * Supported Feature: STA Candidate selection
+ *
+ * Usage: External
+ *
+ * </ini>
+ */
+#define CFG_SCORING_CHAN_BAND_WEIGHTAGE CFG_INI_UINT( \
+	"chan_band_weightage", \
+	0, \
+	100, \
+	2, \
+	CFG_VALUE_OR_DEFAULT, \
+	"Channel Band Weightage")
+
+/*
+ * <ini>
+ * nss_weightage - NSS Weightage to calculate best candidate
+ * @Min: 0
+ * @Max: 100
+ * @Default: 16
+ *
+ * This ini is used to increase/decrease NSS weightage in best candidate
+ * selection. If there are two AP, one AP supports 2x2 and another one supports
+ * 1x1 and station supports 2X2, first A will get this additional weightage
+ * depending on self-capability.
+ *
+ * Related: nss_weight_per_index
+ *
+ * Supported Feature: STA Candidate selection
+ *
+ * Usage: External
+ *
+ * </ini>
+ */
+#define CFG_SCORING_NSS_WEIGHTAGE CFG_INI_UINT( \
+	"nss_weightage", \
+	0, \
+	100, \
+	16, \
+	CFG_VALUE_OR_DEFAULT, \
+	"NSS Weightage")
+/*
+ * <ini>
+ * beamforming_cap_weightage - Beam Forming Weightage to
+ *			       calculate best candidate
+ * @Min: 0
+ * @Max: 100
+ * @Default: 2
+ *
+ * This ini is used to increase/decrease Beam forming Weightage if some AP
+ * support Beam forming or not. If AP supports Beam forming, that AP will get
+ * additional boost of this weightage.
+ *
+ * Related: None
+ *
+ * Supported Feature: STA Candidate selection
+ *
+ * Usage: External
+ *
+ * </ini>
+ */
+#define CFG_SCORING_BEAMFORM_CAP_WEIGHTAGE CFG_INI_UINT( \
+	"beamforming_cap_weightage", \
+	0, \
+	100, \
+	2, \
+	CFG_VALUE_OR_DEFAULT, \
+	"Beamforming Cap Weightage")
+
+/*
+ * <ini>
+ * pcl_weightage - PCL Weightage to calculate best candidate
+ * @Min: 0
+ * @Max: 100
+ * @Default: 10
+ *
+ * This ini is used to increase/decrease PCL weightage in best candidate
+ * selection. If some APs are in PCL list, those AP will get addition
+ * weightage.
+ *
+ * Related: None
+ *
+ * Supported Feature: STA Candidate selection
+ *
+ * Usage: External
+ *
+ * </ini>
+ */
+#define CFG_SCORING_PCL_WEIGHTAGE CFG_INI_UINT( \
+	"pcl_weightage", \
+	0, \
+	100, \
+	10, \
+	CFG_VALUE_OR_DEFAULT, \
+	"PCL Weightage")
+
+/*
+ * <ini>
+ * channel_congestion_weightage - channel Congestion Weightage to
+ * calculate best candidate
+ * @Min: 0
+ * @Max: 100
+ * @Default: 5
+ *
+ * This ini is used to increase/decrease channel congestion weightage in
+ * candidate selection. Congestion is measured with the help of ESP/QBSS load.
+ *
+ * Related: num_esp_qbss_slots
+ *
+ * Supported Feature: STA Candidate selection
+ *
+ * Usage: External
+ *
+ * </ini>
+ */
+#define CFG_SCORING_CHAN_CONGESTION_WEIGHTAGE CFG_INI_UINT( \
+	"channel_congestion_weightage", \
+	0, \
+	100, \
+	5, \
+	CFG_VALUE_OR_DEFAULT, \
+	"Channel Congestion Weightage")
+
+/*
+ * <ini>
+ * oce_wan_weightage - OCE WAN DL capacity Weightage to calculate best candidate
+ * @Min: 0
+ * @Max: 100
+ * @Default: 2
+ *
+ * This ini is used to increase/decrease OCE WAN caps weightage in best
+ * candidate selection. If AP have OCE WAN information, give weightage depending
+ * on the downaload available capacity.
+ *
+ * Related: num_oce_wan_slots
+ *
+ * Supported Feature: STA Candidate selection
+ *
+ * Usage: External
+ *
+ * </ini>
+ */
+#define CFG_SCORING_OCE_WAN_WEIGHTAGE CFG_INI_UINT( \
+	"oce_wan_weightage", \
+	0, \
+	100, \
+	2, \
+	CFG_VALUE_OR_DEFAULT, \
+	"OCE WAN Weightage")
+
+/*
+ * <ini>
+ * best_rssi_threshold - Best Rssi for score calculation
+ * @Min: 0
+ * @Max: 96
+ * @Default: 55
+ *
+ * This ini tells limit for best RSSI. RSSI better than this limit are
+ * considered as best RSSI. The best RSSI is given full rssi_weightage.
+ *
+ * Related: rssi_weightage
+ *
+ * Supported Feature: STA Candidate selection
+ *
+ * Usage: External
+ *
+ * </ini>
+ */
+#define CFG_SCORING_BEST_RSSI_THRESHOLD CFG_INI_UINT( \
+	"best_rssi_threshold", \
+	0, \
+	96, \
+	55, \
+	CFG_VALUE_OR_DEFAULT, \
+	"Best RSSI threshold")
+
+/*
+ * <ini>
+ * good_rssi_threshold - Good Rssi for score calculation
+ * @Min: 0
+ * @Max: 96
+ * @Default: 70
+ *
+ * This ini tells limit for good RSSI. RSSI better than this limit and less
+ * than best_rssi_threshold is considered as good RSSI.
+ *
+ * Related: rssi_weightage, best_rssi_threshold
+ *
+ * Supported Feature: STA Candidate selection
+ *
+ * Usage: External
+ *
+ * </ini>
+ */
+#define CFG_SCORING_GOOD_RSSI_THRESHOLD CFG_INI_UINT( \
+	"good_rssi_threshold", \
+	0, \
+	96, \
+	70, \
+	CFG_VALUE_OR_DEFAULT, \
+	"Good RSSI threshold")
+
+/*
+ * <ini>
+ * bad_rssi_threshold - Bad Rssi for score calculation
+ * @Min: 0
+ * @Max: 96
+ * @Default: 80
+ *
+ * This ini tells limit for Bad RSSI. RSSI greater then bad_rssi_threshold
+ * is considered as bad RSSI.
+ *
+ * Related: rssi_weightage, good_rssi_threshold
+ *
+ * Supported Feature: STA Candidate selection
+ *
+ * Usage: External
+ *
+ * </ini>
+ */
+#define CFG_SCORING_BAD_RSSI_THRESHOLD CFG_INI_UINT( \
+	"bad_rssi_threshold", \
+	0, \
+	96, \
+	80, \
+	CFG_VALUE_OR_DEFAULT, \
+	"Bad RSSI threshold")
+
+/*
+ * <ini>
+ * good_rssi_pcnt - Percent Score to Good RSSI out of total RSSI score.
+ * @Min: 0
+ * @Max: 100
+ * @Default: 80
+ *
+ * This ini tells about how much percent should be given to good RSSI(RSSI
+ * between best_rssi_threshold and good_rssi_threshold) out of RSSI weightage.
+ *
+ * Related: rssi_weightage, best_rssi_threshold, good_rssi_threshold
+ *
+ * Supported Feature: STA Candidate selection
+ *
+ * Usage: External
+ *
+ * </ini>
+ */
+#define CFG_SCORING_GOOD_RSSI_PERCENT CFG_INI_UINT( \
+	"good_rssi_pcnt", \
+	0, \
+	100, \
+	80, \
+	CFG_VALUE_OR_DEFAULT, \
+	"Good RSSI Percent")
+
+/*
+ * <ini>
+ * bad_rssi_pcnt - Percent Score to BAD RSSI out of total RSSI score.
+ * @Min: 0
+ * @Max: 100
+ * @Default: 25
+ *
+ * This ini tells about how much percent should be given to bad RSSI (RSSI
+ * between good_rssi_threshold and bad_rssi_threshold) out of RSSI weightage.
+ *
+ * Related: rssi_weightage, good_rssi_threshold, bad_rssi_threshold
+ *
+ * Supported Feature: STA Candidate selection
+ *
+ * Usage: External
+ *
+ * </ini>
+ */
+#define CFG_SCORING_BAD_RSSI_PERCENT CFG_INI_UINT( \
+	"bad_rssi_pcnt", \
+	0, \
+	100, \
+	25, \
+	CFG_VALUE_OR_DEFAULT, \
+	"Bad RSSI Percent")
+
+/*
+ * <ini>
+ * good_rssi_bucket_size - Bucket size between best and good RSSI to score.
+ * @Min: 1
+ * @Max: 10
+ * @Default: 5
+ *
+ * This ini tells about bucket size for scoring between best and good RSSI.
+ * Below Best RSSI, 100% score will be given. Between best and good RSSI, RSSI
+ * is divided in buckets and score will be assigned bucket wise starting from
+ * good_rssi_pcnt.
+ *
+ * Related: rssi_weightage, good_rssi_pcnt
+ *
+ * Supported Feature: STA Candidate selection
+ *
+ * Usage: External
+ *
+ * </ini>
+ */
+#define CFG_SCORING_GOOD_RSSI_BUCKET_SIZE CFG_INI_UINT( \
+	"good_rssi_bucket_size", \
+	1, \
+	10, \
+	5, \
+	CFG_VALUE_OR_DEFAULT, \
+	"Good RSSI Bucket Size")
+
+/*
+ * <ini>
+ * bad_rssi_bucket_size - Bucket size between good and bad RSSI to score.
+ * @Min: 1
+ * @Max: 10
+ * @Default: 5
+ *
+ * This ini tells about bucket size for scoring between good and bad RSSI.
+ * Between good and bad RSSI, RSSI is divided in buckets and score will be
+ * assigned bucket wise starting from bad_rssi_pcnt.
+ *
+ * Related: rssi_weightage, bad_rssi_pcnt
+ *
+ * Supported Feature: STA Candidate selection
+ *
+ * Usage: External
+ *
+ * </ini>
+ */
+#define CFG_SCORING_BAD_RSSI_BUCKET_SIZE CFG_INI_UINT( \
+	"bad_rssi_bucket_size", \
+	1, \
+	10, \
+	5, \
+	CFG_VALUE_OR_DEFAULT, \
+	"Bad RSSI Bucket Size")
+
+/*
+ * <ini>
+ * rssi_pref_5g_rssi_thresh - A RSSI threshold above which 5 GHz is not favored
+ * @Min: 0
+ * @Max: 96
+ * @Default: 76
+ *
+ * 5G AP are given chan_band_weightage. This ini tells about RSSI threshold
+ * above which 5GHZ is not favored.
+ *
+ * Related: chan_band_weightage
+ *
+ * Supported Feature: STA Candidate selection
+ *
+ * Usage: External
+ *
+ * </ini>
+ */
+#define CFG_SCORING_RSSI_PREF_5G_THRESHOLD CFG_INI_UINT( \
+	"rssi_pref_5g_rssi_thresh", \
+	0, \
+	96, \
+	76, \
+	CFG_VALUE_OR_DEFAULT, \
+	"RSSI Pref 5G Threshold")
+
+/*
+ * <ini>
+ * bandwidth_weight_per_index - percentage as per bandwidth
+ * @Min: 0x00000000
+ * @Max: 0x64646464
+ * @Default: 0x6432190C
+ *
+ * This INI give percentage value of chan_width_weightage to be used as per
+ * peer bandwidth. Self BW is also considered while calculating score. Eg if
+ * self BW is 20 MHZ 10% will be given for all AP irrespective of the AP
+ * capability.
+ *
+ * Indexes are defined in this way.
+ *     0 Index (BITS 0-7): 20 MHz - Def 12%
+ *     1 Index (BITS 8-15): 40 MHz - Def 25%
+ *     2 Index (BITS 16-23): 80 MHz - Def 50%
+ *     3 Index (BITS 24-31): 160 MHz - Def 100%
+ * 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_BW_WEIGHT_PER_IDX CFG_INI_UINT( \
+	"bandwidth_weight_per_index", \
+	0x00000000, \
+	0x64646464, \
+	0x6432190C, \
+	CFG_VALUE_OR_DEFAULT, \
+	"Bandwidth weight per index")
+
+/*
+ * <ini>
+ * nss_weight_per_index - percentage as per NSS
+ * @Min: 0x00000000
+ * @Max: 0x64646464
+ * @Default: 0x6432190C
+ *
+ * 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.
+ *     0 Index (BITS 0-7): 1X1- Def 12%
+ *     1 Index (BITS 8-15): 2X2- Def 25%
+ *     2 Index (BITS 16-23): 3X3- Def 50%
+ *     3 Index (BITS 24-31): 4X4- Def 100%
+ * These percentage values are stored in HEX. For any index max value, can be 64
+ *
+ * Related: nss_weightage
+ *
+ * Supported Feature: STA Candidate selection
+ *
+ * Usage: External
+ *
+ * </ini>
+ */
+#define CFG_SCORING_NSS_WEIGHT_PER_IDX CFG_INI_UINT( \
+	"nss_weight_per_index", \
+	0x00000000, \
+	0x64646464, \
+	0x6432190C, \
+	CFG_VALUE_OR_DEFAULT, \
+	"NSS weight per index")
+
+/*
+ * <ini>
+ * 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.
+ *
+ * Indexes are defined in this way.
+ *     0 Index (BITS 0-7): 2.4GHz - Def 10%
+ *     1 Index (BITS 8-15): 5GHz - Def 20%
+ *     2 Index (BITS 16-23): Reserved
+ *     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
+ *
+ * Supported Feature: STA Candidate selection
+ *
+ * Usage: External
+ *
+ * </ini>
+ */
+#define CFG_SCORING_BAND_WEIGHT_PER_IDX CFG_INI_UINT( \
+	"band_weight_per_index", \
+	0x00000000, \
+	0x64646464, \
+	0x0000644B, \
+	CFG_VALUE_OR_DEFAULT, \
+	"Band weight per index")
+
+/*
+ * <ini>
+ * num_esp_qbss_slots - number of slots in which the esp/qbss load will
+ * be divided
+ *
+ * @Min: 1
+ * @Max: 15
+ * @Default: 4
+ *
+ * Number of slots in which the esp/qbss load will be divided. Max 15. index 0
+ * is used for 'not_present. Num_slot will equally divide 100. e.g, if
+ * num_slot = 4 slot 1 = 0-25% load, slot 2 = 26-50% load, slot 3 = 51-75% load,
+ * slot 4 = 76-100% load. Remaining unused index can be 0.
+ *
+ * Usage: External
+ *
+ * </ini>
+ */
+#define CFG_SCORING_NUM_ESP_QBSS_SLOTS CFG_INI_UINT( \
+	"num_esp_qbss_slots", \
+	1, \
+	15, \
+	4, \
+	CFG_VALUE_OR_DEFAULT, \
+	"Num ESP QPSS Slots")
+
+/*
+ * <ini>
+ * esp_qbss_score_idx3_to_0 - percentage for  esp/qbss load for slots 0-3
+ * @Min: 0x00000000
+ * @Max: 0x64646464
+ * @Default: 0x19326432
+ *
+ * This INI give percentage value of channel_congestion_weightage to be used as
+ * index in which the load value falls. Index 0 is for percentage when ESP/QBSS
+ * is not present.
+ *
+ * Indexes are defined in this way.
+ *     0 Index (BITS 0-7): when ESP/QBSS is not present
+ *     1 Index (BITS 8-15): SLOT_1
+ *     2 Index (BITS 16-23): SLOT_2
+ *     3 Index (BITS 24-31): SLOT_3
+ * These percentage values are stored in HEX. For any index max value, can be 64
+ *
+ * Related: channel_congestion_weightage, num_esp_qbss_slots
+ *
+ * Supported Feature: STA Candidate selection
+ *
+ * Usage: External
+ *
+ * </ini>
+ */
+#define CFG_SCORING_ESP_QBSS_SCORE_IDX_3_TO_0 CFG_INI_UINT( \
+	"esp_qbss_score_idx3_to_0", \
+	0x00000000, \
+	0x64646464, \
+	0x19326432, \
+	CFG_VALUE_OR_DEFAULT, \
+	"ESP QPSS Score Index 3 to 0")
+
+/*
+ * <ini>
+ * esp_qbss_score_idx7_to_4 - percentage for  esp/qbss load for slots 4-7
+ * @Min: 0x00000000
+ * @Max: 0x64646464
+ * @Default: 0x0000000A
+ *
+ * This INI give percentage value of channel_congestion_weightage to be used as
+ * index in which the load value falls. Used only if num_esp_qbss_slots is
+ * greater than 3.
+ *
+ * Indexes are defined in this way.
+ *     0 Index (BITS 0-7): SLOT_4
+ *     1 Index (BITS 8-15): SLOT_5
+ *     2 Index (BITS 16-23): SLOT_6
+ *     3 Index (BITS 24-31): SLOT_7
+ * These percentage values are stored in HEX. For any index max value, can be 64
+ *
+ * Related: channel_congestion_weightage, num_esp_qbss_slots
+ *
+ * Supported Feature: STA Candidate selection
+ *
+ * Usage: External
+ *
+ * </ini>
+ */
+#define CFG_SCORING_ESP_QBSS_SCORE_IDX_7_TO_4 CFG_INI_UINT( \
+	"esp_qbss_score_idx7_to_4", \
+	0x00000000, \
+	0x64646464, \
+	0x0000000A, \
+	CFG_VALUE_OR_DEFAULT, \
+	"ESP QPSS Score Index 7 to 4")
+
+/*
+ * <ini>
+ * esp_qbss_score_idx11_to_8 - percentage for  esp/qbss load for slots 8-11
+ * @Min: 0x00000000
+ * @Max: 0x64646464
+ * @Default: 0x00000000
+ *
+ * This INI give percentage value of channel_congestion_weightage to be used as
+ * index in which the load value falls. Used only if num_esp_qbss_slots is
+ * greater than 7.
+ *
+ * Indexes are defined in this way.
+ *     0 Index (BITS 0-7): SLOT_8
+ *     1 Index (BITS 8-15): SLOT_9
+ *     2 Index (BITS 16-23): SLOT_10
+ *     3 Index (BITS 24-31): SLOT_11
+ * These percentage values are stored in HEX. For any index max value, can be 64
+ *
+ * Related: channel_congestion_weightage, num_esp_qbss_slots
+ *
+ * Supported Feature: STA Candidate selection
+ *
+ * Usage: External
+ *
+ * </ini>
+ */
+#define CFG_SCORING_ESP_QBSS_SCORE_IDX_11_TO_8 CFG_INI_UINT( \
+	"esp_qbss_score_idx11_to_8", \
+	0x00000000, \
+	0x64646464, \
+	0x00000000, \
+	CFG_VALUE_OR_DEFAULT, \
+	"ESP QPSS Score Index 11 to 8")
+
+/*
+ * <ini>
+ * esp_qbss_score_idx15_to_12 - percentage for	esp/qbss load for slots 12-15
+ * @Min: 0x00000000
+ * @Max: 0x64646464
+ * @Default: 0x00000000
+ *
+ * This INI give percentage value of channel_congestion_weightage to be used as
+ * index in which the load value falls. Used only if num_esp_qbss_slots is
+ * greater than 11.
+ *
+ * Indexes are defined in this way.
+ *     0 Index (BITS 0-7): SLOT_12
+ *     1 Index (BITS 8-15): SLOT_13
+ *     2 Index (BITS 16-23): SLOT_14
+ *     3 Index (BITS 24-31): SLOT_15
+ * These percentage values are stored in HEX. For any index max value, can be 64
+ *
+ * Related: channel_congestion_weightage, num_esp_qbss_slots
+ *
+ * Supported Feature: STA Candidate selection
+ *
+ * Usage: External
+ *
+ * </ini>
+ */
+#define CFG_SCORING_ESP_QBSS_SCORE_IDX_15_TO_12 CFG_INI_UINT( \
+	"esp_qbss_score_idx15_to_12", \
+	0x00000000, \
+	0x64646464, \
+	0x00000000, \
+	CFG_VALUE_OR_DEFAULT, \
+	"ESP QPSS Score Index 15 to 12")
+
+/*
+ * <ini>
+ * num_oce_wan_slots - number of slots in which the oce wan metrics will
+ * be divided
+ *
+ * @Min: 1
+ * @Max: 15
+ * @Default: 8
+ *
+ * Number of slots in which the oce wan metrics will be divided. Max 15. index 0
+ * is used for not_present. Num_slot will equally divide 100. e.g, if
+ * num_slot = 4 slot 1 = 0-3 DL CAP, slot 2 = 4-7 DL CAP, slot 3 = 8-11 DL CAP,
+ * slot 4 = 12-15 DL CAP. Remaining unused index can be 0.
+ *
+ * Related: oce_wan_weightage
+ *
+ * Usage: External
+ *
+ * </ini>
+ */
+#define CFG_SCORING_NUM_OCE_WAN_SLOTS CFG_INI_UINT( \
+	"num_oce_wan_slots", \
+	1, \
+	15, \
+	15, \
+	CFG_VALUE_OR_DEFAULT, \
+	"Num OCE WAN Slots")
+
+/*
+ * <ini>
+ * oce_wan_score_idx3_to_0 - percentage for OCE WAN metrics score for slots 0-3
+ * @Min: 0x00000000
+ * @Max: 0x64646464
+ * @Default: 0x00000032
+ *
+ * This INI give percentage value of OCE WAN metrics DL CAP, to be used as
+ * index in which the DL CAP value falls. Index 0 is for percentage when
+ * OCE WAN metrics DL CAP is not present.
+ *
+ * Indexes are defined in this way.
+ *     0 Index (BITS 0-7): when OCE WAN metrics DL CAP is not present
+ *     1 Index (BITS 8-15): SLOT_1
+ *     2 Index (BITS 16-23): SLOT_2
+ *     3 Index (BITS 24-31): SLOT_3
+ * These percentage values are stored in HEX. For any index max value, can be 64
+ *
+ * Related: num_oce_wan_slots, oce_wan_weightage
+ *
+ * Supported Feature: STA Candidate selection
+ *
+ * Usage: External
+ *
+ * </ini>
+ */
+#define CFG_SCORING_OCE_WAN_SCORE_IDX_3_TO_0 CFG_INI_UINT( \
+	"oce_wan_score_idx3_to_0", \
+	0x00000000, \
+	0x64646464, \
+	0x00000032, \
+	CFG_VALUE_OR_DEFAULT, \
+	"OCE WAN Score Index 3 to 0")
+
+/*
+ * <ini>
+ * oce_wan_score_idx7_to_4 - percentage for OCE WAN metrics score for slots 4-7
+ * @Min: 0x00000000
+ * @Max: 0x64646464
+ * @Default: 0x00000000
+ *
+ * This INI give percentage value of OCE WAN metrics DL CAP, to be used as
+ * index in which the DL CAP value falls. Used only if num_oce_wan_slots is
+ * greater than 3.
+ *
+ * Indexes are defined in this way.
+ *     0 Index (BITS 0-7): SLOT_4
+ *     1 Index (BITS 8-15): SLOT_5
+ *     2 Index (BITS 16-23): SLOT_6
+ *     3 Index (BITS 24-31): SLOT_7
+ * These percentage values are stored in HEX. For any index max value, can be 64
+ *
+ * Related: num_oce_wan_slots, oce_wan_weightage
+ *
+ * Supported Feature: STA Candidate selection
+ *
+ * Usage: External
+ *
+ * </ini>
+ */
+#define CFG_SCORING_OCE_WAN_SCORE_IDX_7_TO_4 CFG_INI_UINT( \
+	"oce_wan_score_idx7_to_4", \
+	0x00000000, \
+	0x64646464, \
+	0x00000000, \
+	CFG_VALUE_OR_DEFAULT, \
+	"OCE WAN Score Index 7 to 4")
+
+/*
+ * <ini>
+ * oce_wan_score_idx11_to_8 - percentage for OCE WAN metrics score for slot 8-11
+ * @Min: 0x00000000
+ * @Max: 0x64646464
+ * @Default: 0x06030000
+ *
+ * This INI give percentage value of OCE WAN metrics DL CAP, to be used as
+ * index in which the DL CAP value falls. Used only if num_oce_wan_slots is
+ * greater than 7.
+ *
+ * Indexes are defined in this way.
+ *     0 Index (BITS 0-7): SLOT_8
+ *     1 Index (BITS 8-15): SLOT_9
+ *     2 Index (BITS 16-23): SLOT_10
+ *     3 Index (BITS 24-31): SLOT_11
+ * These percentage values are stored in HEX. For any index max value, can be 64
+ *
+ * Related: num_oce_wan_slots, oce_wan_weightage
+ *
+ * Supported Feature: STA Candidate selection
+ *
+ * Usage: External
+ *
+ * </ini>
+ */
+#define CFG_SCORING_OCE_WAN_SCORE_IDX_11_TO_8 CFG_INI_UINT( \
+	"oce_wan_score_idx11_to_8", \
+	0x00000000, \
+	0x64646464, \
+	0x06030000, \
+	CFG_VALUE_OR_DEFAULT, \
+	"OCE WAN Score Index 11 to 8")
+
+/*
+ * <ini>
+ * oce_wan_score_idx15_to_12 - % for OCE WAN metrics score for slot 12-15
+ * @Min: 0x00000000
+ * @Max: 0x64646464
+ * @Default: 0x6432190C
+ *
+ * This INI give percentage value of OCE WAN metrics DL CAP, to be used as
+ * index in which the DL CAP value falls. Used only if num_oce_wan_slots is
+ * greater than 11.
+ *
+ * Indexes are defined in this way.
+ *     0 Index (BITS 0-7): SLOT_12
+ *     1 Index (BITS 8-15): SLOT_13
+ *     2 Index (BITS 16-23): SLOT_14
+ *     3 Index (BITS 24-31): SLOT_15
+ * These percentage values are stored in HEX. For any index max value, can be 64
+ *
+ * Related: num_oce_wan_slots, oce_wan_weightage
+ *
+ * Supported Feature: STA Candidate selection
+ *
+ * Usage: External
+ *
+ * </ini>
+ */
+#define CFG_SCORING_OCE_WAN_SCORE_IDX_15_TO_12 CFG_INI_UINT( \
+	"oce_wan_score_idx15_to_12", \
+	0x00000000, \
+	0x64646464, \
+	0x6432190C, \
+	CFG_VALUE_OR_DEFAULT, \
+	"OCE WAN Score Index 15 to 12")
+
+/*
+ * <ini>
+ * enable_scoring_for_roam - enable/disable scoring logic in FW for candidate
+ * selection during roaming
+ *
+ * @Min: 0
+ * @Max: 1
+ * @Default: 1
+ *
+ * This ini is used to enable/disable scoring logic in FW for candidate
+ * selection during roaming.
+ *
+ * Supported Feature: STA Candidate selection by FW during roaming based on
+ * scoring logic.
+ *
+ * Usage: External
+ *
+ * </ini>
+ */
+#define CFG_ENABLE_SCORING_FOR_ROAM CFG_INI_BOOL( \
+		"enable_scoring_for_roam", \
+		1, \
+		"Enable Scoring for Roam")
+
+#define CFG_SCORING_ALL \
+	CFG(CFG_SCORING_RSSI_WEIGHTAGE) \
+	CFG(CFG_SCORING_HT_CAPS_WEIGHTAGE) \
+	CFG(CFG_SCORING_VHT_CAPS_WEIGHTAGE) \
+	CFG(CFG_SCORING_HE_CAPS_WEIGHTAGE) \
+	CFG(CFG_SCORING_CHAN_WIDTH_WEIGHTAGE) \
+	CFG(CFG_SCORING_CHAN_BAND_WEIGHTAGE) \
+	CFG(CFG_SCORING_NSS_WEIGHTAGE) \
+	CFG(CFG_SCORING_BEAMFORM_CAP_WEIGHTAGE) \
+	CFG(CFG_SCORING_PCL_WEIGHTAGE) \
+	CFG(CFG_SCORING_CHAN_CONGESTION_WEIGHTAGE) \
+	CFG(CFG_SCORING_OCE_WAN_WEIGHTAGE) \
+	CFG(CFG_SCORING_BEST_RSSI_THRESHOLD) \
+	CFG(CFG_SCORING_GOOD_RSSI_THRESHOLD) \
+	CFG(CFG_SCORING_BAD_RSSI_THRESHOLD) \
+	CFG(CFG_SCORING_GOOD_RSSI_PERCENT) \
+	CFG(CFG_SCORING_BAD_RSSI_PERCENT) \
+	CFG(CFG_SCORING_GOOD_RSSI_BUCKET_SIZE) \
+	CFG(CFG_SCORING_BAD_RSSI_BUCKET_SIZE) \
+	CFG(CFG_SCORING_RSSI_PREF_5G_THRESHOLD) \
+	CFG(CFG_SCORING_BW_WEIGHT_PER_IDX) \
+	CFG(CFG_SCORING_NSS_WEIGHT_PER_IDX) \
+	CFG(CFG_SCORING_BAND_WEIGHT_PER_IDX) \
+	CFG(CFG_SCORING_NUM_ESP_QBSS_SLOTS) \
+	CFG(CFG_SCORING_ESP_QBSS_SCORE_IDX_3_TO_0) \
+	CFG(CFG_SCORING_ESP_QBSS_SCORE_IDX_7_TO_4) \
+	CFG(CFG_SCORING_ESP_QBSS_SCORE_IDX_11_TO_8) \
+	CFG(CFG_SCORING_ESP_QBSS_SCORE_IDX_15_TO_12) \
+	CFG(CFG_SCORING_NUM_OCE_WAN_SLOTS) \
+	CFG(CFG_SCORING_OCE_WAN_SCORE_IDX_3_TO_0) \
+	CFG(CFG_SCORING_OCE_WAN_SCORE_IDX_7_TO_4) \
+	CFG(CFG_SCORING_OCE_WAN_SCORE_IDX_11_TO_8) \
+	CFG(CFG_SCORING_OCE_WAN_SCORE_IDX_15_TO_12) \
+	CFG(CFG_ENABLE_SCORING_FOR_ROAM)
+
+#endif /* __CFG_MLME_SCORING_H */

+ 114 - 0
components/mlme/dispatcher/inc/wlan_mlme_public_struct.h

@@ -376,6 +376,118 @@ struct wlan_mlme_lfr_cfg {
 	uint32_t max_num_pre_auth;
 };
 
+/**
+ * struct wlan_mlme_weight_config - weight params to
+ * calculate best candidate
+ *
+ * @rssi_weightage: RSSI weightage
+ * @ht_caps_weightage: HT caps weightage
+ * @vht_caps_weightage: VHT caps weightage
+ * @he_caps_weightage: HE caps weightage
+ * @chan_width_weightage: Channel width weightage
+ * @chan_band_weightage: Channel band weightage
+ * @nss_weightage: NSS weightage
+ * @beamforming_cap_weightage: Beamforming caps weightage
+ * @pcl_weightage: PCL weightage
+ * @channel_congestion_weightage: channel congestion weightage
+ * @oce_wan_weightage: OCE WAN metrics weightage
+ */
+struct  wlan_mlme_weight_config {
+	uint8_t rssi_weightage;
+	uint8_t ht_caps_weightage;
+	uint8_t vht_caps_weightage;
+	uint8_t he_caps_weightage;
+	uint8_t chan_width_weightage;
+	uint8_t chan_band_weightage;
+	uint8_t nss_weightage;
+	uint8_t beamforming_cap_weightage;
+	uint8_t pcl_weightage;
+	uint8_t channel_congestion_weightage;
+	uint8_t oce_wan_weightage;
+};
+
+/**
+ * struct wlan_mlme_rssi_cfg_score - RSSI params to
+ * calculate best candidate
+ *
+ * @best_rssi_threshold: Best RSSI threshold
+ * @good_rssi_threshold: Good RSSI threshold
+ * @bad_rssi_threshold: Bad RSSI threshold
+ * @good_rssi_pcnt: Good RSSI Percentage
+ * @bad_rssi_pcnt: Bad RSSI Percentage
+ * @good_rssi_bucket_size: Good RSSI Bucket Size
+ * @bad_rssi_bucket_size: Bad RSSI Bucket Size
+ * @rssi_pref_5g_rssi_thresh: Preffered 5G RSSI threshold
+ */
+struct wlan_mlme_rssi_cfg_score  {
+	uint32_t best_rssi_threshold;
+	uint32_t good_rssi_threshold;
+	uint32_t bad_rssi_threshold;
+	uint32_t good_rssi_pcnt;
+	uint32_t bad_rssi_pcnt;
+	uint32_t good_rssi_bucket_size;
+	uint32_t bad_rssi_bucket_size;
+	uint32_t rssi_pref_5g_rssi_thresh;
+};
+
+/**
+ * struct wlan_mlme_per_slot_scoring - define % score for differents slots
+ *				for a scoring param.
+ * num_slot: number of slots in which the param will be divided.
+ *           Max 15. index 0 is used for 'not_present. Num_slot will
+ *           equally divide 100. e.g, if num_slot = 4 slot 0 = 0-25%, slot
+ *           1 = 26-50% slot 2 = 51-75%, slot 3 = 76-100%
+ * score_pcnt3_to_0: Conatins score percentage for slot 0-3
+ *             BITS 0-7   :- the scoring pcnt when not present
+ *             BITS 8-15  :- SLOT_1
+ *             BITS 16-23 :- SLOT_2
+ *             BITS 24-31 :- SLOT_3
+ * score_pcnt7_to_4: Conatins score percentage for slot 4-7
+ *             BITS 0-7   :- SLOT_4
+ *             BITS 8-15  :- SLOT_5
+ *             BITS 16-23 :- SLOT_6
+ *             BITS 24-31 :- SLOT_7
+ * score_pcnt11_to_8: Conatins score percentage for slot 8-11
+ *             BITS 0-7   :- SLOT_8
+ *             BITS 8-15  :- SLOT_9
+ *             BITS 16-23 :- SLOT_10
+ *             BITS 24-31 :- SLOT_11
+ * score_pcnt15_to_12: Conatins score percentage for slot 12-15
+ *             BITS 0-7   :- SLOT_12
+ *             BITS 8-15  :- SLOT_13
+ *             BITS 16-23 :- SLOT_14
+ *             BITS 24-31 :- SLOT_15
+ */
+struct wlan_mlme_per_slot_scoring {
+	uint32_t num_slot;
+	uint32_t score_pcnt3_to_0;
+	uint32_t score_pcnt7_to_4;
+	uint32_t score_pcnt11_to_8;
+	uint32_t score_pcnt15_to_12;
+};
+
+/*
+ * struct wlan_mlme_score_config - MLME BSS Scoring related config
+ * @enable_scoring_for_roam: Enable/disable BSS Scoring for Roaming
+ * @weight_cfg: Various Weight related Scoring Configs
+ * @rssi_score: RSSI Scoring related thresholds/percentages config
+ * @esp_qbss_scoring: ESP QBSS Scoring configs
+ * @oce_wan_scoring: OCE WAN Scoring Configs
+ * @bandwidth_weight_per_index: Bandwidth weight per index for scoring logic
+ * @nss_weight_per_index: NSS weight per index for scoring logic
+ * @band_weight_per_index: Band weight per index for scoring logic
+ */
+struct wlan_mlme_scoring_cfg {
+	bool enable_scoring_for_roam;
+	struct wlan_mlme_weight_config weight_cfg;
+	struct wlan_mlme_rssi_cfg_score rssi_score;
+	struct wlan_mlme_per_slot_scoring esp_qbss_scoring;
+	struct wlan_mlme_per_slot_scoring oce_wan_scoring;
+	uint32_t bandwidth_weight_per_index;
+	uint32_t nss_weight_per_index;
+	uint32_t band_weight_per_index;
+};
+
 /**
  * struct wlan_mlme_cfg - MLME config items
  * @ht_cfg: HT related CFG Items
@@ -385,6 +497,7 @@ struct wlan_mlme_lfr_cfg {
  * @rates: Rates related cfg items
  * @sap_protection_cfg: SAP erp protection related CFG items
  * @sta: sta CFG Items
+ * @scoring: BSS Scoring related CFG Items
  */
 struct wlan_mlme_cfg {
 	struct wlan_mlme_ht_caps ht_caps;
@@ -398,6 +511,7 @@ struct wlan_mlme_cfg {
 	struct wlan_mlme_chainmask chainmask_cfg;
 	struct wlan_mlme_cfg_sap sap_cfg;
 	struct wlan_mlme_sta_cfg sta;
+	struct wlan_mlme_scoring_cfg scoring;
 };
 
 #endif