From 201e307efb7f8e1f45f70751c59110e17b254f71 Mon Sep 17 00:00:00 2001 From: Abhishek Singh Date: Tue, 28 Apr 2020 12:06:18 +0530 Subject: [PATCH] qcacmn: Change max AP score from 100 to 200 Change max AP score limit from 100 to 200 and thus change BEST_CANDIDATE_MAX_WEIGHT to 200 from 100. Also remove duplicate sanity check, which is already done while getting values from INI. Change-Id: I4f87a00e90b7d5d829007d89cbf7cfd9b70fa4dc CRs-Fixed: 2673980 --- umac/scan/core/src/wlan_scan_bss_score.c | 119 ++---------------- umac/scan/core/src/wlan_scan_cache_db.h | 9 -- .../dispatcher/inc/wlan_scan_public_structs.h | 8 +- umac/scan/dispatcher/src/wlan_scan_ucfg_api.c | 1 - 4 files changed, 13 insertions(+), 124 deletions(-) diff --git a/umac/scan/core/src/wlan_scan_bss_score.c b/umac/scan/core/src/wlan_scan_bss_score.c index 36319051e155..e99f5694a5a4 100644 --- a/umac/scan/core/src/wlan_scan_bss_score.c +++ b/umac/scan/core/src/wlan_scan_bss_score.c @@ -79,105 +79,6 @@ bool scm_is_better_bss(struct scan_default_params *params, return false; } -/** - * scm_limit_max_per_index_score() -check if per index score does not exceed - * 100% (0x64). If it exceed make it 100% - * - * @per_index_score: per_index_score as input - * - * Return: per_index_score within the max limit - */ -static uint32_t scm_limit_max_per_index_score(uint32_t per_index_score) -{ - uint8_t i, score; - - for (i = 0; i < MAX_INDEX_PER_INI; i++) { - score = WLAN_GET_SCORE_PERCENTAGE(per_index_score, i); - if (score > MAX_INDEX_SCORE) - WLAN_SET_SCORE_PERCENTAGE(per_index_score, - MAX_INDEX_SCORE, i); - } - - return per_index_score; -} - -void scm_validate_scoring_config(struct scoring_config *score_cfg) -{ - int total_weight; - - total_weight = score_cfg->weight_cfg.rssi_weightage + - score_cfg->weight_cfg.ht_caps_weightage + - score_cfg->weight_cfg.vht_caps_weightage + - score_cfg->weight_cfg.chan_width_weightage + - score_cfg->weight_cfg.chan_band_weightage + - score_cfg->weight_cfg.nss_weightage + - score_cfg->weight_cfg.beamforming_cap_weightage + - score_cfg->weight_cfg.pcl_weightage + - score_cfg->weight_cfg.channel_congestion_weightage + - score_cfg->weight_cfg.oce_wan_weightage + - score_cfg->weight_cfg.oce_ap_tx_pwr_weightage; - - if (total_weight > BEST_CANDIDATE_MAX_WEIGHT) { - - scm_err("total weight is greater than %d fallback to default values", - BEST_CANDIDATE_MAX_WEIGHT); - - score_cfg->weight_cfg.rssi_weightage = RSSI_WEIGHTAGE; - score_cfg->weight_cfg.ht_caps_weightage = - HT_CAPABILITY_WEIGHTAGE; - score_cfg->weight_cfg.vht_caps_weightage = VHT_CAP_WEIGHTAGE; - score_cfg->weight_cfg.chan_width_weightage = - CHAN_WIDTH_WEIGHTAGE; - score_cfg->weight_cfg.chan_band_weightage = - CHAN_BAND_WEIGHTAGE; - score_cfg->weight_cfg.nss_weightage = NSS_WEIGHTAGE; - score_cfg->weight_cfg.beamforming_cap_weightage = - BEAMFORMING_CAP_WEIGHTAGE; - score_cfg->weight_cfg.pcl_weightage = PCL_WEIGHT; - score_cfg->weight_cfg.channel_congestion_weightage = - CHANNEL_CONGESTION_WEIGHTAGE; - score_cfg->weight_cfg.oce_wan_weightage = OCE_WAN_WEIGHTAGE; - score_cfg->weight_cfg.oce_ap_tx_pwr_weightage = - OCE_AP_TX_POWER_WEIGHTAGE; - } - - score_cfg->bandwidth_weight_per_index = - scm_limit_max_per_index_score( - score_cfg->bandwidth_weight_per_index); - score_cfg->nss_weight_per_index = - scm_limit_max_per_index_score(score_cfg->nss_weight_per_index); - score_cfg->band_weight_per_index = - scm_limit_max_per_index_score(score_cfg->band_weight_per_index); - - - score_cfg->esp_qbss_scoring.score_pcnt3_to_0 = - scm_limit_max_per_index_score( - score_cfg->esp_qbss_scoring.score_pcnt3_to_0); - score_cfg->esp_qbss_scoring.score_pcnt7_to_4 = - scm_limit_max_per_index_score( - score_cfg->esp_qbss_scoring.score_pcnt7_to_4); - score_cfg->esp_qbss_scoring.score_pcnt11_to_8 = - scm_limit_max_per_index_score( - score_cfg->esp_qbss_scoring.score_pcnt11_to_8); - score_cfg->esp_qbss_scoring.score_pcnt15_to_12 = - scm_limit_max_per_index_score( - score_cfg->esp_qbss_scoring.score_pcnt15_to_12); - - score_cfg->oce_wan_scoring.score_pcnt3_to_0 = - scm_limit_max_per_index_score( - score_cfg->oce_wan_scoring.score_pcnt3_to_0); - score_cfg->oce_wan_scoring.score_pcnt7_to_4 = - scm_limit_max_per_index_score( - score_cfg->oce_wan_scoring.score_pcnt7_to_4); - score_cfg->oce_wan_scoring.score_pcnt11_to_8 = - scm_limit_max_per_index_score( - score_cfg->oce_wan_scoring.score_pcnt11_to_8); - score_cfg->oce_wan_scoring.score_pcnt15_to_12 = - scm_limit_max_per_index_score( - score_cfg->oce_wan_scoring.score_pcnt15_to_12); - -} - /** * scm_get_rssi_pcnt_for_slot () - calculate rssi % score based on the slot * index between the high rssi and low rssi threshold @@ -245,7 +146,7 @@ static int32_t scm_calculate_rssi_score( good_bucket_size = score_param->good_rssi_bucket_size; bad_bucket_size = score_param->bad_rssi_bucket_size; - total_rssi_score = (BEST_CANDIDATE_MAX_WEIGHT * rssi_weightage); + total_rssi_score = (MAX_PCT_SCORE * rssi_weightage); /* * If RSSI is better than the best rssi threshold then it return full @@ -297,7 +198,7 @@ static int32_t scm_calculate_pcl_score(int pcl_chan_weight, if (pcl_score < 0) pcl_score = 0; } - return pcl_score * BEST_CANDIDATE_MAX_WEIGHT; + return pcl_score * MAX_PCT_SCORE; } @@ -350,7 +251,7 @@ static int8_t scm_roam_calculate_prorated_pcnt_by_rssi( /* If RSSI is greater than good rssi return full weight */ if (rssi > good_rssi_threshold) - return BEST_CANDIDATE_MAX_WEIGHT; + return MAX_PCT_SCORE; same_bucket = scm_rssi_is_same_bucket(good_rssi_threshold, rssi, rssi_pref_5g_rssi_thresh, @@ -423,8 +324,7 @@ static int32_t scm_calculate_bandwidth_score( SCM_20MHZ_BW_INDEX); return (prorated_pct * score * - score_config->weight_cfg.chan_width_weightage) / - BEST_CANDIDATE_MAX_WEIGHT; + score_config->weight_cfg.chan_width_weightage) / MAX_PCT_SCORE; } /** @@ -481,7 +381,7 @@ static int32_t scm_get_congestion_pct(struct scan_cache_entry *entry) congestion = SCM_MAX_CHANNEL_UTILIZATION - est_air_time_percentage; } else if (entry->qbss_chan_load) { - ap_load = (entry->qbss_chan_load * BEST_CANDIDATE_MAX_WEIGHT); + ap_load = (entry->qbss_chan_load * MAX_PCT_SCORE); /* * Calculate ap_load in % from qbss channel load from * 0-255 range @@ -536,8 +436,7 @@ static int32_t scm_calculate_congestion_score( score_params->esp_qbss_scoring.score_pcnt3_to_0, SCM_SCORE_INDEX_0); - window_size = BEST_CANDIDATE_MAX_WEIGHT / - score_params->esp_qbss_scoring.num_slot; + window_size = MAX_PCT_SCORE / score_params->esp_qbss_scoring.num_slot; /* Desired values are from 1 to 15, as 0 is for not present. so do +1 */ index = qdf_do_div(*congestion_pct, window_size) + 1; @@ -588,7 +487,7 @@ static int32_t scm_calculate_nss_score(struct wlan_objmgr_psoc *psoc, SCM_NSS_1x1_INDEX); return (score_config->weight_cfg.nss_weightage * score_pct * - prorated_pct) / BEST_CANDIDATE_MAX_WEIGHT; + prorated_pct) / MAX_PCT_SCORE; } /** @@ -685,7 +584,7 @@ scm_calculate_oce_ap_tx_pwr_weightage(struct scan_cache_entry *entry, /* Uplink RSSI is better than best rssi threshold */ if (normalized_ap_tx_pwr > best_rssi_threshold) { - ap_tx_pwr_factor = BEST_CANDIDATE_MAX_WEIGHT; + ap_tx_pwr_factor = MAX_PCT_SCORE; } else if (normalized_ap_tx_pwr <= bad_rssi_threshold) { /* Uplink RSSI is less or equal to bad rssi threshold */ ap_tx_pwr_factor = rssi_score_param->bad_rssi_pcnt; @@ -845,7 +744,7 @@ int scm_calculate_bss_score(struct wlan_objmgr_psoc *psoc, ap_su_beam_former = true; if (is_vht && ap_su_beam_former && (entry->rssi_raw > rssi_pref_5g_rssi_thresh) && !same_bucket) - beamformee_score = BEST_CANDIDATE_MAX_WEIGHT * + beamformee_score = MAX_PCT_SCORE * weight_config->beamforming_cap_weightage; score += beamformee_score; diff --git a/umac/scan/core/src/wlan_scan_cache_db.h b/umac/scan/core/src/wlan_scan_cache_db.h index 3627d2b79dcd..3251cfa5c60b 100644 --- a/umac/scan/core/src/wlan_scan_cache_db.h +++ b/umac/scan/core/src/wlan_scan_cache_db.h @@ -264,15 +264,6 @@ QDF_STATUS scm_channel_list_db_deinit(struct wlan_objmgr_psoc *psoc) } #endif -/** - * scm_validate_scoring_config() - validate score config - * @score_cfg: config to be validated - * - * Return: void - */ -void scm_validate_scoring_config( - struct scoring_config *score_cfg); - /** * scm_scan_update_mlme_by_bssinfo() - updates scan entry with mlme data * @pdev: pdev object diff --git a/umac/scan/dispatcher/inc/wlan_scan_public_structs.h b/umac/scan/dispatcher/inc/wlan_scan_public_structs.h index 84f808724faa..ad5257301226 100644 --- a/umac/scan/dispatcher/inc/wlan_scan_public_structs.h +++ b/umac/scan/dispatcher/inc/wlan_scan_public_structs.h @@ -62,16 +62,16 @@ typedef uint32_t wlan_scan_id; #define HT_CAPABILITY_WEIGHTAGE 2 #define VHT_CAP_WEIGHTAGE 1 #define HE_CAP_WEIGHTAGE 2 -#define CHAN_WIDTH_WEIGHTAGE 17 +#define CHAN_WIDTH_WEIGHTAGE 12 #define CHAN_BAND_WEIGHTAGE 2 #define NSS_WEIGHTAGE 16 #define BEAMFORMING_CAP_WEIGHTAGE 2 #define PCL_WEIGHT 10 #define CHANNEL_CONGESTION_WEIGHTAGE 5 -#define OCE_WAN_WEIGHTAGE 0 +#define OCE_WAN_WEIGHTAGE 2 #define OCE_AP_TX_POWER_WEIGHTAGE 5 -#define BEST_CANDIDATE_MAX_WEIGHT 100 -#define MAX_INDEX_SCORE 100 +#define BEST_CANDIDATE_MAX_WEIGHT 200 +#define MAX_PCT_SCORE 100 #define MAX_INDEX_PER_INI 4 #define WLAN_GET_BITS(_val, _index, _num_bits) \ diff --git a/umac/scan/dispatcher/src/wlan_scan_ucfg_api.c b/umac/scan/dispatcher/src/wlan_scan_ucfg_api.c index 7313a905d786..8c30f6dd9015 100644 --- a/umac/scan/dispatcher/src/wlan_scan_ucfg_api.c +++ b/umac/scan/dispatcher/src/wlan_scan_ucfg_api.c @@ -1505,7 +1505,6 @@ QDF_STATUS ucfg_scan_update_user_config(struct wlan_objmgr_psoc *psoc, qdf_mem_copy(&scan_def->score_config, &scan_cfg->score_config, sizeof(struct scoring_config)); - scm_validate_scoring_config(&scan_def->score_config); return QDF_STATUS_SUCCESS; }