diff --git a/core/hdd/inc/wlan_hdd_cfg.h b/core/hdd/inc/wlan_hdd_cfg.h index 9fc774217036..d90e46a77737 100644 --- a/core/hdd/inc/wlan_hdd_cfg.h +++ b/core/hdd/inc/wlan_hdd_cfg.h @@ -2758,6 +2758,19 @@ enum dot11p_mode { #define CFG_EARLY_STOP_SCAN_MAX_THRESHOLD_MAX (-40) #define CFG_EARLY_STOP_SCAN_MAX_THRESHOLD_DEFAULT (-45) +/* + * This parameter will configure the first scan bucket + * threshold to the mentioned value and all the AP's which + * have RSSI under this threshold will fall under this + * bucket. + * This is a configuration item used to tweak and test the input + * for internal algorithm. It should not be modified externally. + */ +#define CFG_FIRST_SCAN_BUCKET_THRESHOLD_NAME "gFirstScanBucketThreshold" +#define CFG_FIRST_SCAN_BUCKET_THRESHOLD_MIN (-50) +#define CFG_FIRST_SCAN_BUCKET_THRESHOLD_MAX (-30) +#define CFG_FIRST_SCAN_BUCKET_THRESHOLD_DEFAULT (-30) + /*--------------------------------------------------------------------------- Type declarations -------------------------------------------------------------------------*/ @@ -3335,6 +3348,7 @@ struct hdd_config { bool early_stop_scan_enable; int8_t early_stop_scan_min_threshold; int8_t early_stop_scan_max_threshold; + int8_t first_scan_bucket_threshold; }; #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 d3fd27f3f279..434c45916432 100644 --- a/core/hdd/src/wlan_hdd_cfg.c +++ b/core/hdd/src/wlan_hdd_cfg.c @@ -3603,6 +3603,14 @@ REG_TABLE_ENTRY g_registry_table[] = { CFG_EARLY_STOP_SCAN_MAX_THRESHOLD_MIN, CFG_EARLY_STOP_SCAN_MAX_THRESHOLD_MAX), + REG_VARIABLE(CFG_FIRST_SCAN_BUCKET_THRESHOLD_NAME, + WLAN_PARAM_SignedInteger, + struct hdd_config, first_scan_bucket_threshold, + VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, + CFG_FIRST_SCAN_BUCKET_THRESHOLD_DEFAULT, + CFG_FIRST_SCAN_BUCKET_THRESHOLD_MIN, + CFG_FIRST_SCAN_BUCKET_THRESHOLD_MAX), + }; @@ -5146,7 +5154,9 @@ void hdd_cfg_print(hdd_context_t *pHddCtx) hddLog(LOGE, "Name = [%s] Value = [%d]", CFG_EARLY_STOP_SCAN_MAX_THRESHOLD, pHddCtx->config->early_stop_scan_max_threshold); - + hddLog(LOGE, "Name = [%s] Value = [%d]", + CFG_FIRST_SCAN_BUCKET_THRESHOLD_NAME, + pHddCtx->config->first_scan_bucket_threshold); } @@ -6589,6 +6599,8 @@ CDF_STATUS hdd_set_sme_config(hdd_context_t *pHddCtx) pHddCtx->config->early_stop_scan_min_threshold; smeConfig->early_stop_scan_max_threshold = pHddCtx->config->early_stop_scan_max_threshold; + smeConfig->csrConfig.first_scan_bucket_threshold = + pHddCtx->config->first_scan_bucket_threshold; status = sme_update_config(pHddCtx->hHal, smeConfig); if (!CDF_IS_STATUS_SUCCESS(status)) { hddLog(LOGE, "sme_update_config() return failure %d", diff --git a/core/mac/inc/ani_global.h b/core/mac/inc/ani_global.h index 1c98232e7e81..d89063e831b6 100644 --- a/core/mac/inc/ani_global.h +++ b/core/mac/inc/ani_global.h @@ -1043,6 +1043,7 @@ typedef struct sAniSirGlobal { uint32_t dual_mac_feature_disable; bool first_scan_done; + int8_t first_scan_bucket_threshold; } tAniSirGlobal; typedef enum { diff --git a/core/sme/inc/csr_api.h b/core/sme/inc/csr_api.h index 88dead78f1ce..a4194e8c96ef 100644 --- a/core/sme/inc/csr_api.h +++ b/core/sme/inc/csr_api.h @@ -1274,6 +1274,7 @@ typedef struct tagCsrConfigParam { bool early_stop_scan_enable; int8_t early_stop_scan_min_threshold; int8_t early_stop_scan_max_threshold; + int8_t first_scan_bucket_threshold; } tCsrConfigParam; /* Tush */ diff --git a/core/sme/inc/sme_api.h b/core/sme/inc/sme_api.h index 9fb0305989ab..39ae9660884f 100644 --- a/core/sme/inc/sme_api.h +++ b/core/sme/inc/sme_api.h @@ -134,6 +134,7 @@ typedef struct _smeConfigParams { bool early_stop_scan_enable; int8_t early_stop_scan_min_threshold; int8_t early_stop_scan_max_threshold; + int8_t first_scan_bucket_threshold; } tSmeConfigParams, *tpSmeConfigParams; #ifdef FEATURE_WLAN_TDLS diff --git a/core/sme/src/csr/csr_api_roam.c b/core/sme/src/csr/csr_api_roam.c index a0f40ae07185..72711d2cc877 100644 --- a/core/sme/src/csr/csr_api_roam.c +++ b/core/sme/src/csr/csr_api_roam.c @@ -1189,6 +1189,8 @@ void csr_assign_rssi_for_category(tpAniSirGlobal pMac, int8_t bestApRssi, uint8_t catOffset) { int i; + sms_log(pMac, LOG2, FL("best AP RSSI:%d, cat offset:%d"), + bestApRssi, catOffset); if (catOffset) { pMac->roam.configParam.bCatRssiOffset = catOffset; for (i = 0; i < CSR_NUM_RSSI_CAT; i++) { @@ -1238,7 +1240,7 @@ static void init_config_param(tpAniSirGlobal pMac) pMac->roam.configParam.BssPreferValue[i] = i; } csr_assign_rssi_for_category(pMac, CSR_BEST_RSSI_VALUE, - CSR_DEFAULT_RSSI_DB_GAP); + CSR_DEFAULT_RSSI_DB_GAP); pMac->roam.configParam.nRoamingTime = CSR_DEFAULT_ROAMING_TIME; pMac->roam.configParam.fSupplicantCountryCodeHasPriority = false; pMac->roam.configParam.nActiveMaxChnTime = CSR_ACTIVE_MAX_CHANNEL_TIME; @@ -1821,8 +1823,11 @@ CDF_STATUS csr_change_default_config_param(tpAniSirGlobal pMac, pParam->scanAgeTimeCPS; } - csr_assign_rssi_for_category(pMac, CSR_BEST_RSSI_VALUE, - pParam->bCatRssiOffset); + pMac->first_scan_bucket_threshold = + pParam->first_scan_bucket_threshold; + csr_assign_rssi_for_category(pMac, + pMac->first_scan_bucket_threshold, + pParam->bCatRssiOffset); pMac->roam.configParam.nRoamingTime = pParam->nRoamingTime; pMac->roam.configParam.fSupplicantCountryCodeHasPriority = pParam->fSupplicantCountryCodeHasPriority; @@ -2158,6 +2163,8 @@ CDF_STATUS csr_get_config_param(tpAniSirGlobal pMac, tCsrConfigParam *pParam) pParam->sendDeauthBeforeCon = cfg_params->sendDeauthBeforeCon; pParam->max_scan_count = pMac->scan.max_scan_count; + pParam->first_scan_bucket_threshold = + pMac->first_scan_bucket_threshold; return CDF_STATUS_SUCCESS; }