summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAgrawal Ashish <ashishka@codeaurora.org>2017-08-23 17:01:07 +0530
committersnandini <snandini@codeaurora.org>2017-08-29 18:32:28 -0700
commit64b783435322b247134ea78ebd5e75eb7c97ff4a (patch)
treec753fcd602ae3e8ad1ebcd9ea43933794caa46c8
parent0e74631f2ed49a0e83cda64af8c482cd996a1d8b (diff)
qcacld-3.0: Add INI support for best candidate select algo
Currently all the parameter to decide best candidate are chosen as by default. Add INI support for those parameters to change values on basis of performance. Change-Id: I4c6f43f88b0356a15abdac51f37f7784470ac413 CRs-Fixed: 2097870
-rw-r--r--core/hdd/inc/wlan_hdd_cfg.h193
-rw-r--r--core/hdd/src/wlan_hdd_cfg.c112
-rw-r--r--core/sme/inc/csr_api.h26
-rw-r--r--core/sme/inc/csr_internal.h27
-rw-r--r--core/sme/src/csr/csr_api_roam.c27
-rw-r--r--core/sme/src/csr/csr_api_scan.c142
6 files changed, 502 insertions, 25 deletions
diff --git a/core/hdd/inc/wlan_hdd_cfg.h b/core/hdd/inc/wlan_hdd_cfg.h
index 63e428509792..df33d59f9b23 100644
--- a/core/hdd/inc/wlan_hdd_cfg.h
+++ b/core/hdd/inc/wlan_hdd_cfg.h
@@ -11906,6 +11906,190 @@ enum hw_filter_mode {
#define CFG_ENABLE_11D_IN_WORLD_MODE_MAX (1)
#define CFG_ENABLE_11D_IN_WORLD_MODE_DEFAULT (0)
+/*
+ * <ini>
+ * rssi_weightage - Rssi Weightage to calculate best candidate
+ * @Min: 0
+ * @Max: 100
+ * @Default: 25
+ *
+ * This ini is used to increase/decrease rssi weightage in best candidate
+ * selection. AP with better RSSI will get more weightage.
+ *
+ * Usage: External
+ *
+ * </ini>
+ */
+
+#define CFG_RSSI_WEIGHTAGE_NAME "rssi_weightage"
+#define CFG_RSSI_WEIGHTAGE_DEFAULT (25)
+#define CFG_RSSI_WEIGHTAGE_MIN (0)
+#define CFG_RSSI_WEIGHTAGE_MAX (100)
+/*
+ * <ini>
+ * ht_caps_weightage - HT caps weightage to calculate best candidate
+ * @Min: 0
+ * @Max: 100
+ * @Default: 7
+ *
+ * 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.
+ *
+ * Usage: External
+ *
+ * </ini>
+ */
+
+#define CFG_HT_CAPABILITY_WEIGHTAGE_NAME "ht_caps_weightage"
+#define CFG_HT_CAPABILITY_WEIGHTAGE_DEFAULT (7)
+#define CFG_HT_CAPABILITY_WEIGHTAGE_MIN (0)
+#define CFG_HT_CAPABILITY_WEIGHTAGE_MAX (100)
+/*
+ * <ini>
+ * vht_caps_weightage - VHT caps Weightage to calculate best candidate
+ * @Min: 0
+ * @Max: 100
+ * @Default: 5
+ *
+ * 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.
+ *
+ * Usage: External
+ *
+ * </ini>
+ */
+
+#define CFG_VHT_CAPABILITY_WEIGHTAGE_NAME "vht_caps_weightage"
+#define CFG_VHT_CAPABILITY_WEIGHTAGE_DEFAULT (5)
+#define CFG_VHT_CAPABILITY_WEIGHTAGE_MIN (0)
+#define CFG_VHT_CAPABILITY_WEIGHTAGE_MAX (100)
+/*
+ * <ini>
+ * chan_width_weightage - Channel Width Weightage to calculate best candidate
+ * @Min: 0
+ * @Max: 100
+ * @Default: 10
+ *
+ * This ini is used to increase/decrease Channel Width weightage in best
+ * candidate selection. AP with Higher channel width will get higher weightage.
+ *
+ * Usage: External
+ *
+ * </ini>
+ */
+
+#define CFG_CHAN_WIDTH_WEIGHTAGE_NAME "chan_width_weightage"
+#define CFG_CHAN_WIDTH_WEIGHTAGE_DEFAULT (10)
+#define CFG_CHAN_WIDTH_WEIGHTAGE_MIN (0)
+#define CFG_CHAN_WIDTH_WEIGHTAGE_MAX (100)
+/*
+ * <ini>
+ * chan_band_weightage - Channel Band perferance to 5GHZ to
+ * calculate best candidate
+ * @Min: 0
+ * @Max: 100
+ * @Default: 5
+ *
+ * This ini is used to increase/decrease Channel Band Perferance weightage
+ * in best candidate selection. 5GHZ AP get this additional boost compare
+ * to 2GHZ AP.
+ *
+ * Usage: External
+ *
+ * </ini>
+ */
+
+#define CFG_CHAN_BAND_WEIGHTAGE_NAME "chan_band_weightage"
+#define CFG_CHAN_BAND_WEIGHTAGE_DEFAULT (5)
+#define CFG_CHAN_BAND_WEIGHTAGE_MIN (0)
+#define CFG_CHAN_BAND_WEIGHTAGE_MAX (100)
+/*
+ * <ini>
+ * nss_weightage - NSS Weightage to calculate best candidate
+ * @Min: 0
+ * @Max: 100
+ * @Default: 5
+ *
+ * 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.
+ *
+ * Usage: External
+ *
+ * </ini>
+ */
+
+#define CFG_NSS_WEIGHTAGE_NAME "nss_weightage"
+#define CFG_NSS_WEIGHTAGE_DEFAULT (5)
+#define CFG_NSS_WEIGHTAGE_MIN (0)
+#define CFG_NSS_WEIGHTAGE_MAX (100)
+/*
+ * <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 suppoets Beam forming,
+ * that AP will get additional boost of this weightage
+ *
+ * Usage: External
+ *
+ * </ini>
+ */
+
+#define CFG_BEAMFORMING_CAP_WEIGHTAGE_NAME "beamforming_cap_weightage"
+#define CFG_BEAMFORMING_CAP_WEIGHTAGE_DEFAULT (2)
+#define CFG_BEAMFORMING_CAP_WEIGHTAGE_MIN (0)
+#define CFG_BEAMFORMING_CAP_WEIGHTAGE_MAX (100)
+/*
+ * <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.
+ *
+ * Usage: External
+ *
+ * </ini>
+ */
+
+#define CFG_PCL_WEIGHT_WEIGHTAGE_NAME "pcl_weightage"
+#define CFG_PCL_WEIGHT_DEFAULT (10)
+#define CFG_PCL_WEIGHT_MIN (0)
+#define CFG_PCL_WEIGHT_MAX (100)
+/*
+ * <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 mesaured with the help of ESP/QBSS.
+ * selection.
+ *
+ * Usage: External
+ *
+ * </ini>
+ */
+
+#define CFG_CHANNEL_CONGESTION_WEIGHTAGE_NAME "channel_congestion_weightage"
+#define CFG_CHANNEL_CONGESTION_WEIGHTAGE_DEFAULT (5)
+#define CFG_CHANNEL_CONGESTION_WEIGHTAGE_MIN (0)
+#define CFG_CHANNEL_CONGESTION_WEIGHTAGE_MAX (100)
+
+
/*---------------------------------------------------------------------------
Type declarations
-------------------------------------------------------------------------*/
@@ -12719,6 +12903,15 @@ struct hdd_config {
bool enable_11d_in_world_mode;
int8_t rssi_thresh_offset_5g;
bool is_fils_roaming_supported;
+ uint8_t rssi_weightage;
+ uint8_t ht_caps_weightage;
+ uint8_t vht_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;
};
#define VAR_OFFSET(_Struct, _Var) (offsetof(_Struct, _Var))
diff --git a/core/hdd/src/wlan_hdd_cfg.c b/core/hdd/src/wlan_hdd_cfg.c
index 144a72ec0303..2c972e3c3d7b 100644
--- a/core/hdd/src/wlan_hdd_cfg.c
+++ b/core/hdd/src/wlan_hdd_cfg.c
@@ -4940,6 +4940,70 @@ struct reg_table_entry g_registry_table[] = {
CFG_ENABLE_11D_IN_WORLD_MODE_DEFAULT,
CFG_ENABLE_11D_IN_WORLD_MODE_MIN,
CFG_ENABLE_11D_IN_WORLD_MODE_MAX),
+
+ REG_VARIABLE(CFG_RSSI_WEIGHTAGE_NAME, WLAN_PARAM_Integer,
+ struct hdd_config, rssi_weightage,
+ VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
+ CFG_RSSI_WEIGHTAGE_DEFAULT,
+ CFG_RSSI_WEIGHTAGE_MIN,
+ CFG_RSSI_WEIGHTAGE_MAX),
+
+ REG_VARIABLE(CFG_HT_CAPABILITY_WEIGHTAGE_NAME, WLAN_PARAM_Integer,
+ struct hdd_config, ht_caps_weightage,
+ VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
+ CFG_HT_CAPABILITY_WEIGHTAGE_DEFAULT,
+ CFG_HT_CAPABILITY_WEIGHTAGE_MIN,
+ CFG_HT_CAPABILITY_WEIGHTAGE_MAX),
+
+ REG_VARIABLE(CFG_VHT_CAPABILITY_WEIGHTAGE_NAME, WLAN_PARAM_Integer,
+ struct hdd_config, vht_caps_weightage,
+ VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
+ CFG_VHT_CAPABILITY_WEIGHTAGE_DEFAULT,
+ CFG_VHT_CAPABILITY_WEIGHTAGE_MIN,
+ CFG_VHT_CAPABILITY_WEIGHTAGE_MAX),
+
+ REG_VARIABLE(CFG_CHAN_WIDTH_WEIGHTAGE_NAME, WLAN_PARAM_Integer,
+ struct hdd_config, chan_width_weightage,
+ VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
+ CFG_CHAN_WIDTH_WEIGHTAGE_DEFAULT,
+ CFG_CHAN_WIDTH_WEIGHTAGE_MIN,
+ CFG_CHAN_WIDTH_WEIGHTAGE_MAX),
+
+ REG_VARIABLE(CFG_CHAN_BAND_WEIGHTAGE_NAME, WLAN_PARAM_Integer,
+ struct hdd_config, chan_band_weightage,
+ VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
+ CFG_CHAN_BAND_WEIGHTAGE_DEFAULT,
+ CFG_CHAN_BAND_WEIGHTAGE_MIN,
+ CFG_CHAN_BAND_WEIGHTAGE_MAX),
+
+ REG_VARIABLE(CFG_NSS_WEIGHTAGE_NAME, WLAN_PARAM_Integer,
+ struct hdd_config, nss_weightage,
+ VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
+ CFG_NSS_WEIGHTAGE_DEFAULT,
+ CFG_NSS_WEIGHTAGE_MIN,
+ CFG_NSS_WEIGHTAGE_MAX),
+
+ REG_VARIABLE(CFG_BEAMFORMING_CAP_WEIGHTAGE_NAME, WLAN_PARAM_Integer,
+ struct hdd_config, beamforming_cap_weightage,
+ VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
+ CFG_BEAMFORMING_CAP_WEIGHTAGE_DEFAULT,
+ CFG_BEAMFORMING_CAP_WEIGHTAGE_MIN,
+ CFG_BEAMFORMING_CAP_WEIGHTAGE_MAX),
+
+ REG_VARIABLE(CFG_PCL_WEIGHT_WEIGHTAGE_NAME, WLAN_PARAM_Integer,
+ struct hdd_config, pcl_weightage,
+ VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
+ CFG_PCL_WEIGHT_DEFAULT,
+ CFG_PCL_WEIGHT_MIN,
+ CFG_PCL_WEIGHT_MAX),
+
+ REG_VARIABLE(CFG_CHANNEL_CONGESTION_WEIGHTAGE_NAME, WLAN_PARAM_Integer,
+ struct hdd_config, channel_congestion_weightage,
+ VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT,
+ CFG_CHANNEL_CONGESTION_WEIGHTAGE_DEFAULT,
+ CFG_CHANNEL_CONGESTION_WEIGHTAGE_MIN,
+ CFG_CHANNEL_CONGESTION_WEIGHTAGE_MAX),
+
};
/**
@@ -6602,6 +6666,33 @@ void hdd_cfg_print(hdd_context_t *pHddCtx)
hdd_debug("Name = [%s] value = [%u]",
CFG_DTIM_1CHRX_ENABLE_NAME,
pHddCtx->config->enable_dtim_1chrx);
+ hdd_debug("Name = [%s] value = [%u]",
+ CFG_RSSI_WEIGHTAGE_NAME,
+ pHddCtx->config->rssi_weightage);
+ hdd_debug("Name = [%s] value = [%u]",
+ CFG_HT_CAPABILITY_WEIGHTAGE_NAME,
+ pHddCtx->config->ht_caps_weightage);
+ hdd_debug("Name = [%s] value = [%u]",
+ CFG_VHT_CAPABILITY_WEIGHTAGE_NAME,
+ pHddCtx->config->vht_caps_weightage);
+ hdd_debug("Name = [%s] value = [%u]",
+ CFG_CHAN_WIDTH_WEIGHTAGE_NAME,
+ pHddCtx->config->chan_width_weightage);
+ hdd_debug("Name = [%s] value = [%u]",
+ CFG_CHAN_BAND_WEIGHTAGE_NAME,
+ pHddCtx->config->chan_band_weightage);
+ hdd_debug("Name = [%s] value = [%u]",
+ CFG_NSS_WEIGHTAGE_NAME,
+ pHddCtx->config->nss_weightage);
+ hdd_debug("Name = [%s] value = [%u]",
+ CFG_BEAMFORMING_CAP_WEIGHTAGE_NAME,
+ pHddCtx->config->beamforming_cap_weightage);
+ hdd_debug("Name = [%s] value = [%u]",
+ CFG_PCL_WEIGHT_WEIGHTAGE_NAME,
+ pHddCtx->config->pcl_weightage);
+ hdd_debug("Name = [%s] value = [%u]",
+ CFG_CHANNEL_CONGESTION_WEIGHTAGE_NAME,
+ pHddCtx->config->channel_congestion_weightage);
}
/**
@@ -8279,6 +8370,27 @@ QDF_STATUS hdd_set_sme_config(hdd_context_t *pHddCtx)
smeConfig->csrConfig.num_11ag_tx_chains =
pHddCtx->config->num_11ag_tx_chains;
+ smeConfig->csrConfig.best_candidate_weight_config.rssi_weightage =
+ pHddCtx->config->rssi_weightage;
+ smeConfig->csrConfig.best_candidate_weight_config.ht_caps_weightage =
+ pHddCtx->config->ht_caps_weightage;
+ smeConfig->csrConfig.best_candidate_weight_config.vht_caps_weightage =
+ pHddCtx->config->vht_caps_weightage;
+ smeConfig->csrConfig.best_candidate_weight_config.chan_width_weightage =
+ pHddCtx->config->chan_width_weightage;
+ smeConfig->csrConfig.best_candidate_weight_config.chan_band_weightage =
+ pHddCtx->config->chan_band_weightage;
+ smeConfig->csrConfig.best_candidate_weight_config.nss_weightage =
+ pHddCtx->config->nss_weightage;
+ smeConfig->csrConfig.best_candidate_weight_config.
+ beamforming_cap_weightage =
+ pHddCtx->config->beamforming_cap_weightage;
+ smeConfig->csrConfig.best_candidate_weight_config.pcl_weightage =
+ pHddCtx->config->pcl_weightage;
+ smeConfig->csrConfig.best_candidate_weight_config.
+ channel_congestion_weightage =
+ pHddCtx->config->channel_congestion_weightage;
+
status = sme_update_config(pHddCtx->hHal, smeConfig);
if (!QDF_IS_STATUS_SUCCESS(status))
hdd_err("sme_update_config() failure: %d", status);
diff --git a/core/sme/inc/csr_api.h b/core/sme/inc/csr_api.h
index 26637c24e5dd..7344786e53d7 100644
--- a/core/sme/inc/csr_api.h
+++ b/core/sme/inc/csr_api.h
@@ -1129,6 +1129,31 @@ struct csr_sta_roam_policy_params {
uint8_t sap_operating_band;
};
+/**
+ * struct best_candidate_wt_cfg_param - weight params to
+ * calculate best candidate
+ * @rssi_weightage: RSSI weightage
+ * @ht_caps_weightage: HT caps weightage
+ * @vht_caps_weightage: VHT 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
+ */
+struct best_candidate_wt_cfg_param {
+ uint8_t rssi_weightage;
+ uint8_t ht_caps_weightage;
+ uint8_t vht_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;
+};
+
typedef struct tagCsrConfigParam {
uint32_t FragmentationThreshold;
/* keep this uint32_t. This gets converted to ePhyChannelBondState */
@@ -1360,6 +1385,7 @@ typedef struct tagCsrConfigParam {
uint32_t num_disallowed_aps;
uint32_t scan_probe_repeat_time;
uint32_t scan_num_probes;
+ struct best_candidate_wt_cfg_param best_candidate_weight_config;
} tCsrConfigParam;
/* Tush */
diff --git a/core/sme/inc/csr_internal.h b/core/sme/inc/csr_internal.h
index d335b24d022f..29ab4839e791 100644
--- a/core/sme/inc/csr_internal.h
+++ b/core/sme/inc/csr_internal.h
@@ -473,6 +473,32 @@ typedef struct tagCsrNeighborRoamConfig {
int32_t nhi_rssi_scan_rssi_ub;
} tCsrNeighborRoamConfig;
+/**
+ * struct csr_best_candidate_weight_config - weight params to
+ * calculate best candidate
+ * @rssi_weightage: RSSI weightage
+ * @ht_caps_weightage: HT caps weightage
+ * @vht_caps_weightage: VHT 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
+ */
+
+struct csr_best_candidate_weight_config {
+ uint8_t rssi_weightage;
+ uint8_t ht_caps_weightage;
+ uint8_t vht_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;
+};
+
typedef struct tagCsrConfig {
uint32_t agingCount;
uint32_t FragmentationThreshold;
@@ -661,6 +687,7 @@ typedef struct tagCsrConfig {
uint32_t num_disallowed_aps;
uint32_t scan_probe_repeat_time;
uint32_t scan_num_probes;
+ struct csr_best_candidate_weight_config best_candidate_weight_config;
} tCsrConfig;
typedef struct tagCsrChannelPowerInfo {
diff --git a/core/sme/src/csr/csr_api_roam.c b/core/sme/src/csr/csr_api_roam.c
index 240ca05a05ca..b360ab0b70af 100644
--- a/core/sme/src/csr/csr_api_roam.c
+++ b/core/sme/src/csr/csr_api_roam.c
@@ -1662,6 +1662,26 @@ static void init_config_param(tpAniSirGlobal pMac)
MAWC_ROAM_RSSI_HIGH_ADJUST_DEFAULT;
pMac->roam.configParam.csr_mawc_config.mawc_roam_rssi_low_adjust =
MAWC_ROAM_RSSI_LOW_ADJUST_DEFAULT;
+
+ pMac->roam.configParam.best_candidate_weight_config.
+ rssi_weightage = RSSI_WEIGHTAGE;
+ pMac->roam.configParam.best_candidate_weight_config.
+ ht_caps_weightage = HT_CAPABILITY_WEIGHTAGE;
+ pMac->roam.configParam.best_candidate_weight_config.
+ vht_caps_weightage = VHT_CAP_WEIGHTAGE;
+ pMac->roam.configParam.best_candidate_weight_config.
+ chan_width_weightage = CHAN_WIDTH_WEIGHTAGE;
+ pMac->roam.configParam.best_candidate_weight_config.
+ chan_band_weightage = CHAN_BAND_WEIGHTAGE;
+ pMac->roam.configParam.best_candidate_weight_config.
+ nss_weightage = NSS_WEIGHTAGE;
+ pMac->roam.configParam.best_candidate_weight_config.
+ beamforming_cap_weightage = BEAMFORMING_CAP_WEIGHTAGE;
+ pMac->roam.configParam.best_candidate_weight_config.
+ pcl_weightage = PCL_WEIGHT;
+ pMac->roam.configParam.best_candidate_weight_config.
+ channel_congestion_weightage = CHANNEL_CONGESTION_WEIGHTAGE;
+
}
eCsrBand csr_get_current_band(tHalHandle hHal)
@@ -2811,6 +2831,10 @@ QDF_STATUS csr_change_default_config_param(tpAniSirGlobal pMac,
pMac->roam.configParam.num_disallowed_aps =
pParam->num_disallowed_aps;
+ qdf_mem_copy(&pMac->roam.configParam.
+ best_candidate_weight_config,
+ &pParam->best_candidate_weight_config,
+ sizeof(struct csr_best_candidate_weight_config));
}
return status;
}
@@ -3072,6 +3096,9 @@ QDF_STATUS csr_get_config_param(tpAniSirGlobal pMac, tCsrConfigParam *pParam)
qdf_mem_copy(&pParam->csr_mawc_config,
&pMac->roam.configParam.csr_mawc_config,
sizeof(pParam->csr_mawc_config));
+ qdf_mem_copy(&pParam->best_candidate_weight_config,
+ &pMac->roam.configParam.best_candidate_weight_config,
+ sizeof(struct best_candidate_wt_cfg_param));
return QDF_STATUS_SUCCESS;
}
diff --git a/core/sme/src/csr/csr_api_scan.c b/core/sme/src/csr/csr_api_scan.c
index 7a4fa5e9a11e..6e0d9caa8e0f 100644
--- a/core/sme/src/csr/csr_api_scan.c
+++ b/core/sme/src/csr/csr_api_scan.c
@@ -1537,6 +1537,7 @@ static uint32_t csr_get_bss_cap_value(tpAniSirGlobal pMac,
* This function helps in determining the preference value
* of a particular BSS in the scan result which is further
* used in the sorting logic of the final candidate AP's.
+ * If score is same for both the APs, AP with good rssi is selected.
*
* Return: true, if bss1 is better than bss2
* false, if bss2 is better than bss1.
@@ -1545,9 +1546,18 @@ static bool csr_is_better_bss(tpAniSirGlobal mac_ctx,
struct tag_csrscan_result *bss1, struct tag_csrscan_result *bss2)
{
bool ret;
+ int rssi1, rssi2;
+
+ rssi1 = bss1->Result.BssDescriptor.rssi;
+ rssi2 = bss2->Result.BssDescriptor.rssi;
+
if (CSR_IS_BETTER_PREFER_VALUE(bss1->bss_score,
bss2->bss_score))
ret = true;
+ else if (CSR_IS_EQUAL_PREFER_VALUE(bss1->bss_score,
+ bss2->bss_score) &&
+ CSR_IS_BETTER_RSSI(rssi1, rssi2))
+ ret = true;
else
ret = false;
return ret;
@@ -1682,13 +1692,15 @@ csr_save_ies(tpAniSirGlobal pMac,
* _csr_calculate_bss_score () - Calculate BSS score based on AP capabilty
* and channel condition for best candidate
* selection
+ * @mac_ctx: Pointer to mac context
* @bss_info: bss information
* @pcl_chan_weight: pcl weight of BSS channel
* @nss: NSS supported by station
*
* Return : int32_t
*/
-static int32_t _csr_calculate_bss_score(tSirBssDescription *bss_info,
+static int32_t _csr_calculate_bss_score(tpAniSirGlobal mac_ctx,
+ tSirBssDescription *bss_info,
int pcl_chan_weight, int nss)
{
int32_t score = 0;
@@ -1696,15 +1708,30 @@ static int32_t _csr_calculate_bss_score(tSirBssDescription *bss_info,
int32_t normalised_width = BEST_CANDIDATE_20MHZ;
int32_t pcl_score = 0;
int32_t temp_pcl_chan_weight = 0;
- int8_t ap_nss = 0;
int32_t est_air_time_percentage = 0;
int32_t congestion = 0;
int32_t rssi_diff = 0;
int32_t rssi_weight = 0;
+ int32_t low_channel_congestion_weight = 0;
+ int32_t moderate_channel_congestion_weight = 0;
+ int32_t considerable_channel_congestion_weight = 0;
+ int32_t high_channel_congestion_weight = 0;
+ int32_t nss_1x1 = 0;
+ int8_t ap_nss = 0;
+ uint8_t rssi_weightage;
+ uint8_t ht_caps_weightage;
+ uint8_t vht_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;
+ struct csr_best_candidate_weight_config *weight_config;
/*
* Total weight of a BSSID is calculated on basis of 100 in which
- * contribution of every factor is considered like this.
+ * contribution of every factor is considered like this(default).
* RSSI: RSSI_WEIGHTAGE : 25
* HT_CAPABILITY_WEIGHTAGE: 7
* VHT_CAP_WEIGHTAGE: 5
@@ -1716,6 +1743,36 @@ static int32_t _csr_calculate_bss_score(tSirBssDescription *bss_info,
* CHANNEL_CONGESTION: 5
* Reserved : 31
*/
+ weight_config = &mac_ctx->roam.configParam.best_candidate_weight_config;
+ rssi_weightage = weight_config->rssi_weightage;
+ ht_caps_weightage = weight_config->ht_caps_weightage;
+ vht_caps_weightage = weight_config->vht_caps_weightage;
+ chan_width_weightage = weight_config->chan_width_weightage;
+ chan_band_weightage = weight_config->chan_band_weightage;
+ nss_weightage = weight_config->nss_weightage;
+ beamforming_cap_weightage = weight_config->beamforming_cap_weightage;
+ pcl_weightage = weight_config->pcl_weightage;
+ channel_congestion_weightage =
+ weight_config->channel_congestion_weightage;
+
+ if ((rssi_weightage + ht_caps_weightage + vht_caps_weightage +
+ chan_width_weightage + chan_band_weightage +
+ nss_weightage + beamforming_cap_weightage +
+ pcl_weightage +
+ channel_congestion_weightage) > BEST_CANDIDATE_MAX_WEIGHT) {
+ QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR,
+ "Total weight to calcualte best candidate should be 100, Fallback to default values");
+ rssi_weightage = RSSI_WEIGHTAGE;
+ ht_caps_weightage = HT_CAPABILITY_WEIGHTAGE;
+ vht_caps_weightage = VHT_CAP_WEIGHTAGE;
+ chan_width_weightage = CHAN_WIDTH_WEIGHTAGE;
+ chan_band_weightage = CHAN_BAND_WEIGHTAGE;
+ nss_weightage = NSS_WEIGHTAGE;
+ beamforming_cap_weightage = BEAMFORMING_CAP_WEIGHTAGE;
+ pcl_weightage = PCL_WEIGHT;
+ channel_congestion_weightage = CHANNEL_CONGESTION_WEIGHTAGE;
+
+ }
/*
* Further bucketization of rssi is also done out of 25 score.
* RSSI > -55=> weight = 2500
@@ -1725,6 +1782,7 @@ static int32_t _csr_calculate_bss_score(tSirBssDescription *bss_info,
* RSSI > -75=> weight = 1500
* RSSI > -80=> weight = 1250
*/
+
if (bss_info->rssi) {
/*
* if RSSI of AP is less then -80, driver should ignore that
@@ -1739,14 +1797,15 @@ static int32_t _csr_calculate_bss_score(tSirBssDescription *bss_info,
}
if (bss_info->rssi >= EXCELLENT_RSSI) {
rssi_weight = EXCELLENT_RSSI_WEIGHT *
- RSSI_WEIGHTAGE;
+ rssi_weightage;
} else {
rssi_diff = EXCELLENT_RSSI -
bss_info->rssi;
do_div(rssi_diff, 5);
rssi_weight = (rssi_diff + 1) * RSSI_WEIGHT_BUCKET;
rssi_weight = (EXCELLENT_RSSI_WEIGHT *
- RSSI_WEIGHTAGE) - rssi_weight;
+ rssi_weightage) -
+ rssi_weight;
}
score += rssi_weight;
@@ -1758,7 +1817,8 @@ static int32_t _csr_calculate_bss_score(tSirBssDescription *bss_info,
(MAX_WEIGHT_OF_PCL_CHANNELS - pcl_chan_weight);
do_div(temp_pcl_chan_weight,
PCL_GROUPS_WEIGHT_DIFFERENCE);
- pcl_score = PCL_WEIGHT - temp_pcl_chan_weight;
+ pcl_score = pcl_weightage -
+ temp_pcl_chan_weight;
if (pcl_score < 0)
pcl_score = 0;
@@ -1767,15 +1827,18 @@ static int32_t _csr_calculate_bss_score(tSirBssDescription *bss_info,
}
/* If AP supports HT caps, extra 10% score will be added */
if (bss_info->ht_caps_present)
- score += BEST_CANDIDATE_MAX_WEIGHT * HT_CAPABILITY_WEIGHTAGE;
+ score += BEST_CANDIDATE_MAX_WEIGHT *
+ ht_caps_weightage;
/* If AP supports VHT caps, Extra 6% score will be added to score */
if (bss_info->vht_caps_present)
- score += BEST_CANDIDATE_MAX_WEIGHT * VHT_CAP_WEIGHTAGE;
+ score += BEST_CANDIDATE_MAX_WEIGHT *
+ vht_caps_weightage;
/* If AP supports beam forming, extra 2% score will be added to score.*/
if (bss_info->beacomforming_capable)
- score += BEST_CANDIDATE_MAX_WEIGHT * BEAMFORMING_CAP_WEIGHTAGE;
+ score += BEST_CANDIDATE_MAX_WEIGHT *
+ beamforming_cap_weightage;
/*
* Channel width is again calculated on basis of 100.
@@ -1791,19 +1854,40 @@ static int32_t _csr_calculate_bss_score(tSirBssDescription *bss_info,
normalised_width = BEST_CANDIDATE_40MHZ;
else
normalised_width = BEST_CANDIDATE_20MHZ;
- score += normalised_width * CHAN_WIDTH_WEIGHTAGE;
+ score += normalised_width *
+ chan_width_weightage;
/* If AP is on 5Ghz channel , extra score of 5% is added to BSS score.*/
if (get_rf_band(bss_info->channelId) == SIR_BAND_5_GHZ &&
bss_info->rssi > RSSI_THRESHOLD_5GHZ)
- score += BEST_CANDIDATE_MAX_WEIGHT * CHAN_BAND_WEIGHTAGE;
+ score += BEST_CANDIDATE_MAX_WEIGHT *
+ chan_band_weightage;
/*
* If ESP is being transmitted by the AP, use the estimated airtime for
- * AC_BE from that, Estimated airtime 0-25% = 120, 25-50% = 250, 50-75%
- * = 370, 75-100% = 500.
- * Else if QBSSLoad is being transmitted and QBSSLoad < 25% = 500
- * else assing default weight of 370
+ * AC_BE from that, Estimated airtime 0-25% = 25%, 25-50% = 50%, 50-75%
+ * = 75%, 75-100% = 100%.
+ * Else if QBSSLoad is being transmitted and QBSSLoad < 25% = 100%
+ * else assing default weight of 75%
*/
+ low_channel_congestion_weight =
+ channel_congestion_weightage *
+ BEST_CANDIDATE_MAX_WEIGHT;
+
+ moderate_channel_congestion_weight = low_channel_congestion_weight *
+ (EXTREME_CHANNEL_CONGESTION - MODERATE_CHANNEL_CONGESTION);
+
+ do_div(moderate_channel_congestion_weight, BEST_CANDIDATE_MAX_WEIGHT);
+
+ considerable_channel_congestion_weight = low_channel_congestion_weight *
+ (EXTREME_CHANNEL_CONGESTION - CONSIDERABLE_CHANNEL_CONGESTION);
+
+ do_div(considerable_channel_congestion_weight,
+ BEST_CANDIDATE_MAX_WEIGHT);
+
+ high_channel_congestion_weight = low_channel_congestion_weight *
+ (EXTREME_CHANNEL_CONGESTION - HIGH_CHANNEL_CONGESTION);
+
+ do_div(high_channel_congestion_weight, BEST_CANDIDATE_MAX_WEIGHT);
if (bss_info->air_time_fraction) {
/* Convert 0-255 range to percentage */
@@ -1819,15 +1903,15 @@ static int32_t _csr_calculate_bss_score(tSirBssDescription *bss_info,
if (congestion >= LOW_CHANNEL_CONGESTION &&
congestion < MODERATE_CHANNEL_CONGESTION)
- score += LOW_CHANNEL_CONGESTION_WEIGHT;
+ score += low_channel_congestion_weight;
else if (congestion >= MODERATE_CHANNEL_CONGESTION &&
congestion < CONSIDERABLE_CHANNEL_CONGESTION)
- score += MODERATE_CHANNEL_CONGESTION_WEIGHT;
+ score += moderate_channel_congestion_weight;
else if (congestion >= CONSIDERABLE_CHANNEL_CONGESTION &&
congestion < HIGH_CHANNEL_CONGESTION)
- score += CONSIDERABLE_CHANNEL_CONGESTION_WEIGHT;
+ score += considerable_channel_congestion_weight;
else
- score += HIGH_CHANNEL_CONGESTION_WEIGHT;
+ score += high_channel_congestion_weight;
} else if (bss_info->QBSSLoad_present) {
ap_load = (bss_info->qbss_chan_load *
BEST_CANDIDATE_MAX_WEIGHT);
@@ -1838,19 +1922,27 @@ static int32_t _csr_calculate_bss_score(tSirBssDescription *bss_info,
do_div(ap_load, MAX_AP_LOAD);
congestion = ap_load;
if (congestion < MODERATE_CHANNEL_CONGESTION)
- score += LOW_CHANNEL_CONGESTION_WEIGHT;
+ score += low_channel_congestion_weight;
else
- score += HIGH_CHANNEL_CONGESTION_WEIGHT;
+ score += high_channel_congestion_weight;
} else {
- score += MODERATE_CHANNEL_CONGESTION_WEIGHT;
+ score += moderate_channel_congestion_weight;
}
+ /*
+ * If station support nss as 2*2 but AP support NSS as 1*1,
+ * this AP will be given half weight compare to AP which are having
+ * NSS as 2*2
+ */
+ nss_1x1 = nss_weightage;
+ do_div(nss_1x1, 2);
ap_nss = bss_info->nss;
if (wma_is_current_hwmode_dbs())
nss--;
if (nss == 2 && ap_nss == 1)
- score += BEST_CANDIDATE_MAX_WEIGHT * NSS_1X1_WEIGHTAGE;
+ score += BEST_CANDIDATE_MAX_WEIGHT * nss_1x1;
else
- score += BEST_CANDIDATE_MAX_WEIGHT * NSS_WEIGHTAGE;
+ score += BEST_CANDIDATE_MAX_WEIGHT *
+ nss_weightage;
QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_DEBUG,
FL("BSSID:"MAC_ADDRESS_STR" rssi=%d htcaps=%d vht=%d bw=%d channel=%d beamforming=%d ap_load=%d est_air_time_percentage=%d pcl_score %d Final Score %d ap_NSS %d nss %d"),
@@ -1890,7 +1982,7 @@ static void csr_calculate_bss_score(tpAniSirGlobal pMac,
nss = 2;
if (channel_id < NUM_CHANNELS)
- score = _csr_calculate_bss_score(bss_info,
+ score = _csr_calculate_bss_score(pMac, bss_info,
pcl_chan_weight, nss);
pBss->bss_score = score;