diff options
| author | Manjeet Singh <manjee@codeaurora.org> | 2017-02-28 11:58:22 +0530 |
|---|---|---|
| committer | qcabuildsw <qcabuildsw@localhost> | 2017-03-01 00:38:07 -0800 |
| commit | 988cdb16511c93083f8d3f17ec4384a565fcae9d (patch) | |
| tree | 938dfda4a21f17a61ec704f3f248eb5aa0a55aec | |
| parent | 0f80c941e1ba05cc7eda38bc9215428fccb2babf (diff) | |
qcacld-3.0: Add support for band specific preference
Add support for 5Ghz network RSSI boost/penalty preference
based on ini values.
Change-Id: Ia3ae5dcc35b9a85fde5a609f8f27ff8b4bc35cec
CRs-fixed: 1085554
| -rw-r--r-- | core/hdd/inc/wlan_hdd_cfg.h | 166 | ||||
| -rw-r--r-- | core/hdd/src/wlan_hdd_cfg.c | 50 | ||||
| -rw-r--r-- | core/hdd/src/wlan_hdd_main.c | 17 | ||||
| -rw-r--r-- | core/sme/inc/sme_api.h | 21 | ||||
| -rw-r--r-- | core/sme/src/common/sme_api.c | 44 |
5 files changed, 298 insertions, 0 deletions
diff --git a/core/hdd/inc/wlan_hdd_cfg.h b/core/hdd/inc/wlan_hdd_cfg.h index 0c46c03b9add..d71a652390f0 100644 --- a/core/hdd/inc/wlan_hdd_cfg.h +++ b/core/hdd/inc/wlan_hdd_cfg.h @@ -8790,6 +8790,162 @@ enum dot11p_mode { #define CFG_RX_WAKELOCK_TIMEOUT_MIN (0) #define CFG_RX_WAKELOCK_TIMEOUT_MAX (100) +/* + * <ini> + * enable_5g_band_pref - Enable preference for 5G from INI. + * @Min: 0 + * @Max: 1 + * @Default: 0 + * This ini is used to enable 5G preference parameters. + * + * Related: 5g_rssi_boost_threshold, 5g_rssi_boost_factor, 5g_max_rssi_boost + * 5g_rssi_penalize_threshold, 5g_rssi_penalize_factor, 5g_max_rssi_penalize + * + * Supported Feature: 5G band preference + * + * Usage: External + * + * </ini> + */ + +#define CFG_ENABLE_5G_BAND_PREF_NAME "enable_5g_band_pref" +#define CFG_ENABLE_5G_BAND_PREF_MIN (0) +#define CFG_ENABLE_5G_BAND_PREF_MAX (1) +#define CFG_ENABLE_5G_BAND_PREF_DEFAULT (0) + +/* + * <ini> + * 5g_rssi_boost_threshold - A_band_boost_threshold above which 5 GHz is favored. + * @Min: -55 + * @Max: -70 + * @Default: -60 + * This ini is used to set threshold for 5GHz band preference. + * + * Related: 5g_rssi_boost_factor, 5g_max_rssi_boost + * 5g_rssi_penalize_threshold, 5g_rssi_penalize_factor, 5g_max_rssi_penalize + * + * Supported Feature: 5G band preference + * + * Usage: External + * + * </ini> + */ +#define CFG_5G_RSSI_BOOST_THRESHOLD_NAME "5g_rssi_boost_threshold" +#define CFG_5G_RSSI_BOOST_THRESHOLD_MIN (-55) +#define CFG_5G_RSSI_BOOST_THRESHOLD_MAX (-70) +#define CFG_5G_RSSI_BOOST_THRESHOLD_DEFAULT (-60) + +/* + * <ini> + * 5g_rssi_boost_factor - Factor by which 5GHz RSSI is boosted. + * @Min: 0 + * @Max: 2 + * @Default: 1 + * This ini is used to set the 5Ghz boost factor. + * + * Related: 5g_rssi_boost_threshold, 5g_max_rssi_boost + * 5g_rssi_penalize_threshold, 5g_rssi_penalize_factor, 5g_max_rssi_penalize + * + * Supported Feature: 5G band preference + * + * Usage: External + * + * </ini> + */ +#define CFG_5G_RSSI_BOOST_FACTOR_NAME "5g_rssi_boost_factor" +#define CFG_5G_RSSI_BOOST_FACTOR_MIN (0) +#define CFG_5G_RSSI_BOOST_FACTOR_MAX (2) +#define CFG_5G_RSSI_BOOST_FACTOR_DEFAULT (1) + +/* + * <ini> + * 5g_max_rssi_boost - Maximum boost that can be applied to 5GHz RSSI. + * @Min: 0 + * @Max: 20 + * @Default: 10 + * This ini is used to set maximum boost which can be given to a 5Ghz network. + * + * Related: 5g_rssi_boost_threshold, 5g_rssi_boost_factor + * 5g_rssi_penalize_threshold, 5g_rssi_penalize_factor, 5g_max_rssi_penalize + * + * Supported Feature: 5G band preference + * + * Usage: External + * + * </ini> + */ +#define CFG_5G_MAX_RSSI_BOOST_NAME "5g_max_rssi_boost" +#define CFG_5G_MAX_RSSI_BOOST_MIN (0) +#define CFG_5G_MAX_RSSI_BOOST_MAX (20) +#define CFG_5G_MAX_RSSI_BOOST_DEFAULT (10) + +/* + * <ini> + * 5g_rssi_penalize_threshold - A_band_penalize_threshold above which + * 5 GHz is not favored. + * @Min: -65 + * @Max: -80 + * @Default: -70 + * This ini is used to set threshold for 5GHz band preference. + * + * Related: 5g_rssi_penalize_factor, 5g_max_rssi_penalize + * 5g_rssi_boost_threshold, 5g_rssi_boost_factor, 5g_max_rssi_boost + * + * Supported Feature: 5G band preference + * + * Usage: External + * + * </ini> + */ +#define CFG_5G_RSSI_PENALIZE_THRESHOLD_NAME "5g_rssi_penalize_threshold" +#define CFG_5G_RSSI_PENALIZE_THRESHOLD_MIN (-65) +#define CFG_5G_RSSI_PENALIZE_THRESHOLD_MAX (-80) +#define CFG_5G_RSSI_PENALIZE_THRESHOLD_DEFAULT (-70) + +/* + * <ini> + * 5g_rssi_penalize_factor - Factor by which 5GHz RSSI is penalizeed. + * @Min: 0 + * @Max: 2 + * @Default: 1 + * This ini is used to set the 5Ghz penalize factor. + * + * Related: 5g_rssi_penalize_threshold, 5g_max_rssi_penalize + * 5g_rssi_boost_threshold, 5g_rssi_boost_factor, 5g_max_rssi_boost + * + * Supported Feature: 5G band preference + * + * Usage: External + * + * </ini> + */ +#define CFG_5G_RSSI_PENALIZE_FACTOR_NAME "5g_rssi_penalize_factor" +#define CFG_5G_RSSI_PENALIZE_FACTOR_MIN (0) +#define CFG_5G_RSSI_PENALIZE_FACTOR_MAX (2) +#define CFG_5G_RSSI_PENALIZE_FACTOR_DEFAULT (1) + +/* + * <ini> + * 5g_max_rssi_penalize - Maximum penalty that can be applied to 5GHz RSSI. + * @Min: 0 + * @Max: 20 + * @Default: 10 + * This ini is used to set maximum penalty which can be given to a 5Ghz network. + * + * Related: 5g_rssi_penalize_threshold, 5g_rssi_penalize_factor + * 5g_rssi_boost_threshold, 5g_rssi_boost_factor, 5g_max_rssi_boost + * + * Supported Feature: 5G band preference + * + * Usage: External + * + * </ini> + */ +#define CFG_5G_MAX_RSSI_PENALIZE_NAME "5g_max_rssi_penalize" +#define CFG_5G_MAX_RSSI_PENALIZE_MIN (0) +#define CFG_5G_MAX_RSSI_PENALIZE_MAX (20) +#define CFG_5G_MAX_RSSI_PENALIZE_DEFAULT (10) + #ifdef WLAN_FEATURE_UDP_RESPONSE_OFFLOAD /* * Enable/Disable UDP response offload feature @@ -10418,6 +10574,16 @@ struct hdd_config { bool enable_bcast_probe_rsp; bool qcn_ie_support; uint8_t fils_max_chan_guard_time; + /* 5G preference parameters for boosting RSSI */ + bool enable_5g_band_pref; + int8_t rssi_boost_threshold_5g; + uint8_t rssi_boost_factor_5g; + uint8_t max_rssi_boost_5g; + /* 5G preference parameters for dropping RSSI*/ + int8_t rssi_penalize_threshold_5g; + uint8_t rssi_penalize_factor_5g; + uint8_t max_rssi_penalize_5g; + }; #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 6b64466740f4..197ee472beaa 100644 --- a/core/hdd/src/wlan_hdd_cfg.c +++ b/core/hdd/src/wlan_hdd_cfg.c @@ -4319,6 +4319,56 @@ REG_TABLE_ENTRY g_registry_table[] = { CFG_FILS_MAX_CHAN_GUARD_TIME_DEFAULT, CFG_FILS_MAX_CHAN_GUARD_TIME_MIN, CFG_FILS_MAX_CHAN_GUARD_TIME_MAX), + + REG_VARIABLE(CFG_ENABLE_5G_BAND_PREF_NAME, WLAN_PARAM_Integer, + struct hdd_config, enable_5g_band_pref, + VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, + CFG_ENABLE_5G_BAND_PREF_DEFAULT, + CFG_ENABLE_5G_BAND_PREF_MIN, + CFG_ENABLE_5G_BAND_PREF_MAX), + + REG_VARIABLE(CFG_5G_RSSI_BOOST_THRESHOLD_NAME, WLAN_PARAM_Integer, + struct hdd_config, rssi_boost_threshold_5g, + VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, + CFG_5G_RSSI_BOOST_THRESHOLD_DEFAULT, + CFG_5G_RSSI_BOOST_THRESHOLD_MIN, + CFG_5G_RSSI_BOOST_THRESHOLD_MAX), + + REG_VARIABLE(CFG_5G_RSSI_BOOST_FACTOR_NAME, WLAN_PARAM_Integer, + struct hdd_config, rssi_boost_factor_5g, + VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, + CFG_5G_RSSI_BOOST_FACTOR_DEFAULT, + CFG_5G_RSSI_BOOST_FACTOR_MIN, + CFG_5G_RSSI_BOOST_FACTOR_MAX), + + REG_VARIABLE(CFG_5G_MAX_RSSI_BOOST_NAME, WLAN_PARAM_Integer, + struct hdd_config, max_rssi_boost_5g, + VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, + CFG_5G_MAX_RSSI_BOOST_DEFAULT, + CFG_5G_MAX_RSSI_BOOST_MIN, + CFG_5G_MAX_RSSI_BOOST_MAX), + + REG_VARIABLE(CFG_5G_RSSI_PENALIZE_THRESHOLD_NAME, WLAN_PARAM_Integer, + struct hdd_config, rssi_penalize_threshold_5g, + VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, + CFG_5G_RSSI_PENALIZE_THRESHOLD_DEFAULT, + CFG_5G_RSSI_PENALIZE_THRESHOLD_MIN, + CFG_5G_RSSI_PENALIZE_THRESHOLD_MAX), + + REG_VARIABLE(CFG_5G_RSSI_PENALIZE_FACTOR_NAME, WLAN_PARAM_Integer, + struct hdd_config, rssi_penalize_factor_5g, + VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, + CFG_5G_RSSI_PENALIZE_FACTOR_DEFAULT, + CFG_5G_RSSI_PENALIZE_FACTOR_MIN, + CFG_5G_RSSI_PENALIZE_FACTOR_MAX), + + REG_VARIABLE(CFG_5G_MAX_RSSI_PENALIZE_NAME, WLAN_PARAM_Integer, + struct hdd_config, max_rssi_penalize_5g, + VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, + CFG_5G_MAX_RSSI_PENALIZE_DEFAULT, + CFG_5G_MAX_RSSI_PENALIZE_MIN, + CFG_5G_MAX_RSSI_PENALIZE_MAX), + }; /** diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index 5dd8c4d88520..5400bbbb20c2 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -7886,6 +7886,7 @@ static int hdd_features_init(hdd_context_t *hdd_ctx, hdd_adapter_t *adapter) { tSirTxPowerLimit hddtxlimit; QDF_STATUS status; + struct sme_5g_band_pref_params band_pref_params; int ret; ENTER(); @@ -7956,6 +7957,22 @@ static int hdd_features_init(hdd_context_t *hdd_ctx, hdd_adapter_t *adapter) } } + if (hdd_ctx->config->enable_5g_band_pref) { + band_pref_params.rssi_boost_threshold_5g = + hdd_ctx->config->rssi_boost_threshold_5g; + band_pref_params.rssi_boost_factor_5g = + hdd_ctx->config->rssi_boost_factor_5g; + band_pref_params.max_rssi_boost_5g = + hdd_ctx->config->max_rssi_boost_5g; + band_pref_params.rssi_penalize_threshold_5g = + hdd_ctx->config->rssi_penalize_threshold_5g; + band_pref_params.rssi_penalize_factor_5g = + hdd_ctx->config->rssi_penalize_factor_5g; + band_pref_params.max_rssi_penalize_5g = + hdd_ctx->config->max_rssi_penalize_5g; + sme_set_5g_band_pref(hdd_ctx->hHal, &band_pref_params); + } + /* register P2P Listen Offload event callback */ if (wma_is_p2p_lo_capable()) sme_register_p2p_lo_event(hdd_ctx->hHal, hdd_ctx, diff --git a/core/sme/inc/sme_api.h b/core/sme/inc/sme_api.h index 0fa9c7ea6b1b..9799dda80c2f 100644 --- a/core/sme/inc/sme_api.h +++ b/core/sme/inc/sme_api.h @@ -202,6 +202,24 @@ struct sme_oem_capability { uint32_t reserved2; }; +/** + * struct sme_5g_pref_params : 5G preference params to be read from ini + * @rssi_boost_threshold_5g: RSSI threshold above which 5 GHz is favored + * @rssi_boost_factor_5g: Factor by which 5GHz RSSI is boosted + * @max_rssi_boost_5g: Maximum boost that can be applied to 5GHz RSSI + * @rssi_penalize_threshold_5g: RSSI threshold below which 5G is not favored + * @rssi_penalize_factor_5g: Factor by which 5GHz RSSI is penalized + * @max_rssi_penalize_5g: Maximum penalty that can be applied to 5G RSSI + */ +struct sme_5g_band_pref_params { + int8_t rssi_boost_threshold_5g; + uint8_t rssi_boost_factor_5g; + uint8_t max_rssi_boost_5g; + int8_t rssi_penalize_threshold_5g; + uint8_t rssi_penalize_factor_5g; + uint8_t max_rssi_penalize_5g; +}; + /*------------------------------------------------------------------------- Function declarations and documenation ------------------------------------------------------------------------*/ @@ -1477,4 +1495,7 @@ QDF_STATUS sme_get_beacon_frm(tHalHandle hal, tCsrRoamProfile *profile, QDF_STATUS sme_rso_cmd_status_cb(tHalHandle hal, void (*cb)(void *, struct rso_cmd_status *)); +void sme_set_5g_band_pref(tHalHandle hal_handle, + struct sme_5g_band_pref_params *pref_params); + #endif /* #if !defined( __SME_API_H ) */ diff --git a/core/sme/src/common/sme_api.c b/core/sme/src/common/sme_api.c index ab35e40036bc..527090a20da8 100644 --- a/core/sme/src/common/sme_api.c +++ b/core/sme/src/common/sme_api.c @@ -17153,6 +17153,50 @@ bool sme_roam_is_ese_assoc(tCsrRoamInfo *roam_info) { return roam_info->isESEAssoc; } + +/** + * sme_set_band_specific_pref(): If 5G preference is enabled,set boost/drop + * params from ini. + * @hal_handle: Handle returned by mac_open + * @5g_pref_params: pref params from ini. + * + * Returns: None + */ +void sme_set_5g_band_pref(tHalHandle hal_handle, + struct sme_5g_band_pref_params *pref_params) +{ + + tpAniSirGlobal mac_ctx = PMAC_STRUCT(hal_handle); + struct roam_ext_params *roam_params; + QDF_STATUS status = QDF_STATUS_SUCCESS; + + if (!pref_params) { + QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, + "Invalid 5G pref params!"); + return; + } + status = sme_acquire_global_lock(&mac_ctx->sme); + if (QDF_STATUS_SUCCESS == status) { + roam_params = &mac_ctx->roam.configParam.roam_params; + roam_params->raise_rssi_thresh_5g = + pref_params->rssi_boost_threshold_5g; + roam_params->raise_factor_5g = + pref_params->rssi_boost_factor_5g; + roam_params->max_raise_rssi_5g = + pref_params->max_rssi_boost_5g; + roam_params->drop_rssi_thresh_5g = + pref_params->rssi_penalize_threshold_5g; + roam_params->drop_factor_5g = + pref_params->rssi_penalize_factor_5g; + roam_params->max_drop_rssi_5g = + pref_params->max_rssi_penalize_5g; + + sme_release_global_lock(&mac_ctx->sme); + } else + QDF_TRACE(QDF_MODULE_ID_SME, QDF_TRACE_LEVEL_ERROR, + "Unable to acquire global sme lock"); +} + #endif bool sme_neighbor_roam_is11r_assoc(tHalHandle hal_ctx, |
