diff --git a/core/hdd/inc/wlan_hdd_cfg.h b/core/hdd/inc/wlan_hdd_cfg.h index d90e46a77737..56522889e4c4 100644 --- a/core/hdd/inc/wlan_hdd_cfg.h +++ b/core/hdd/inc/wlan_hdd_cfg.h @@ -1783,9 +1783,14 @@ typedef enum { #define CFG_PNO_SCAN_SUPPORT_DEFAULT (1) #define CFG_PNO_SCAN_TIMER_REPEAT_VALUE "gPNOScanTimerRepeatValue" -#define CFG_PNO_SCAN_TIMER_REPEAT_VALUE_DEFAULT (6) +#define CFG_PNO_SCAN_TIMER_REPEAT_VALUE_DEFAULT (30) #define CFG_PNO_SCAN_TIMER_REPEAT_VALUE_MIN (0) #define CFG_PNO_SCAN_TIMER_REPEAT_VALUE_MAX (0xffffffff) + +#define CFG_PNO_SLOW_SCAN_MULTIPLIER "gPNOSlowScanMultiplier" +#define CFG_PNO_SLOW_SCAN_MULTIPLIER_DEFAULT (6) +#define CFG_PNO_SLOW_SCAN_MULTIPLIER_MIN (0) +#define CFG_PNO_SLOW_SCAN_MULTIPLIER_MAX (30) #endif #define CFG_AMSDU_SUPPORT_IN_AMPDU_NAME "gAmsduSupportInAMPDU" @@ -3127,6 +3132,7 @@ struct hdd_config { #ifdef FEATURE_WLAN_SCAN_PNO bool configPNOScanSupport; uint32_t configPNOScanTimerRepeatValue; + uint32_t pno_slow_scan_multiplier; #endif uint8_t isAmsduSupportInAMPDU; uint8_t nSelect5GHzMargin; diff --git a/core/hdd/inc/wlan_hdd_main.h b/core/hdd/inc/wlan_hdd_main.h index 45079ecc7d9b..48a27c97e7ea 100644 --- a/core/hdd/inc/wlan_hdd_main.h +++ b/core/hdd/inc/wlan_hdd_main.h @@ -224,12 +224,6 @@ #define GTK_OFFLOAD_DISABLE 1 #endif -#ifdef FEATURE_WLAN_SCAN_PNO -#define HDD_PNO_SCAN_TIMERS_SET_ONE 1 -/* value should not be greater than PNO_MAX_SCAN_TIMERS */ -#define HDD_PNO_SCAN_TIMERS_SET_MULTIPLE 6 -#endif - #define MAX_USER_COMMAND_SIZE 4096 #define HDD_MIN_TX_POWER (-100) /* minimum tx power */ diff --git a/core/hdd/src/wlan_hdd_cfg.c b/core/hdd/src/wlan_hdd_cfg.c index 434c45916432..b0d7e88e7ae3 100644 --- a/core/hdd/src/wlan_hdd_cfg.c +++ b/core/hdd/src/wlan_hdd_cfg.c @@ -2541,6 +2541,13 @@ REG_TABLE_ENTRY g_registry_table[] = { CFG_PNO_SCAN_TIMER_REPEAT_VALUE_DEFAULT, CFG_PNO_SCAN_TIMER_REPEAT_VALUE_MIN, CFG_PNO_SCAN_TIMER_REPEAT_VALUE_MAX), + + REG_VARIABLE(CFG_PNO_SLOW_SCAN_MULTIPLIER, WLAN_PARAM_Integer, + struct hdd_config, pno_slow_scan_multiplier, + VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, + CFG_PNO_SLOW_SCAN_MULTIPLIER_DEFAULT, + CFG_PNO_SLOW_SCAN_MULTIPLIER_MIN, + CFG_PNO_SLOW_SCAN_MULTIPLIER_MAX), #endif REG_VARIABLE(CFG_AMSDU_SUPPORT_IN_AMPDU_NAME, WLAN_PARAM_Integer, struct hdd_config, isAmsduSupportInAMPDU, @@ -4602,6 +4609,9 @@ void hdd_cfg_print(hdd_context_t *pHddCtx) CDF_TRACE(CDF_MODULE_ID_HDD, CDF_TRACE_LEVEL_INFO_HIGH, "Name = [configPNOScanTimerRepeatValue] Value = [%u] ", pHddCtx->config->configPNOScanTimerRepeatValue); + CDF_TRACE(CDF_MODULE_ID_HDD, CDF_TRACE_LEVEL_INFO_HIGH, + "Name = [gPNOSlowScanMultiplier] Value = [%u] ", + pHddCtx->config->pno_slow_scan_multiplier); #endif #ifdef FEATURE_WLAN_TDLS CDF_TRACE(CDF_MODULE_ID_HDD, CDF_TRACE_LEVEL_INFO_HIGH, diff --git a/core/hdd/src/wlan_hdd_scan.c b/core/hdd/src/wlan_hdd_scan.c index 4e155d0d2121..99b6db2b1411 100644 --- a/core/hdd/src/wlan_hdd_scan.c +++ b/core/hdd/src/wlan_hdd_scan.c @@ -2029,7 +2029,7 @@ static int __wlan_hdd_cfg80211_sched_scan_start(struct wiphy *wiphy, tpSirPNOScanReq pPnoRequest = NULL; hdd_context_t *pHddCtx; tHalHandle hHal; - uint32_t i, indx, num_ch, tempInterval, j; + uint32_t i, indx, num_ch, j; u8 valid_ch[WNI_CFG_VALID_CHANNEL_LIST_LEN] = { 0 }; u8 channels_allowed[WNI_CFG_VALID_CHANNEL_LIST_LEN] = { 0 }; uint32_t num_channels_allowed = WNI_CFG_VALID_CHANNEL_LIST_LEN; @@ -2237,43 +2237,28 @@ static int __wlan_hdd_cfg80211_sched_scan_start(struct wiphy *wiphy, pPnoRequest->us5GProbeTemplateLen); } - /* Driver gets only one time interval which is hardcoded in - * supplicant for 10000ms. Taking power consumption into account 6 timers - * will be used, Timervalue is increased exponentially i.e 10,20,40, - * 80,160,320 secs. And number of scan cycle for each timer - * is configurable through INI param gPNOScanTimerRepeatValue. - * If it is set to 0 only one timer will be used and PNO scan cycle - * will be repeated after each interval specified by supplicant - * till PNO is disabled. + /* + * Driver gets only one time interval which is hard coded in + * supplicant for 10000ms. Taking power consumption into account + * firmware after gPNOScanTimerRepeatValue times fast_scan_period + * switches slow_scan_period. This is less frequent scans and firmware + * shall be in slow_scan_period mode until next PNO Start. */ - if (0 == pHddCtx->config->configPNOScanTimerRepeatValue) - pPnoRequest->scanTimers.ucScanTimersCount = - HDD_PNO_SCAN_TIMERS_SET_ONE; - else - pPnoRequest->scanTimers.ucScanTimersCount = - HDD_PNO_SCAN_TIMERS_SET_MULTIPLE; + pPnoRequest->fast_scan_period = request->interval; + pPnoRequest->fast_scan_max_cycles = + config->configPNOScanTimerRepeatValue; + pPnoRequest->slow_scan_period = + config->pno_slow_scan_multiplier * + pPnoRequest->fast_scan_period; - tempInterval = (request->interval) / 1000; - hddLog(LOG1, - FL("Base scan interval = %d PNOScanTimerRepeatValue = %d"), - tempInterval, pHddCtx->config->configPNOScanTimerRepeatValue); - for (i = 0; i < pPnoRequest->scanTimers.ucScanTimersCount; i++) { - pPnoRequest->scanTimers.aTimerValues[i].uTimerRepeat = - pHddCtx->config->configPNOScanTimerRepeatValue; - pPnoRequest->scanTimers.aTimerValues[i].uTimerValue = - tempInterval; - tempInterval *= 2; - } - /* Repeat last timer until pno disabled. */ - pPnoRequest->scanTimers.aTimerValues[i - 1].uTimerRepeat = 0; + hdd_info("Base scan interval: %d sec PNOScanTimerRepeatValue: %d", + (request->interval / 1000), + config->configPNOScanTimerRepeatValue); pPnoRequest->modePNO = SIR_PNO_MODE_IMMEDIATE; - hddLog(LOG1, - FL("SessionId %d, enable %d, modePNO %d, ucScanTimersCount %d"), - pAdapter->sessionId, pPnoRequest->enable, - pPnoRequest->modePNO, - pPnoRequest->scanTimers.ucScanTimersCount); + hdd_info("SessionId %d, enable %d, modePNO %d", + pAdapter->sessionId, pPnoRequest->enable, pPnoRequest->modePNO); status = sme_set_preferred_network_list(WLAN_HDD_GET_HAL_CTX(pAdapter), pPnoRequest, diff --git a/core/hdd/src/wlan_hdd_wext.c b/core/hdd/src/wlan_hdd_wext.c index e1983bd8a1ff..153663ee8b0c 100644 --- a/core/hdd/src/wlan_hdd_wext.c +++ b/core/hdd/src/wlan_hdd_wext.c @@ -9256,55 +9256,6 @@ static int __iw_set_pno(struct net_device *dev, ptr += offset; } /* For ucNetworkCount */ - params = sscanf(ptr, "%hhu %n", - &(request.scanTimers.ucScanTimersCount), &offset); - - /* Read the scan timers */ - if ((1 == params) && (request.scanTimers.ucScanTimersCount > 0)) { - ptr += offset; - - hdd_notice("Scan timer count %d offset %d", - request.scanTimers.ucScanTimersCount, offset); - - if (SIR_PNO_MAX_SCAN_TIMERS < - request.scanTimers.ucScanTimersCount) { - hdd_err("Incorrect cmd - too many scan timers"); - return -EINVAL; - } - - for (i = 0; i < request.scanTimers.ucScanTimersCount; i++) { - params = sscanf(ptr, "%u %u %n", - &(request.scanTimers. - aTimerValues[i].uTimerValue), - &(request.scanTimers. - aTimerValues[i].uTimerRepeat), - &offset); - - if (2 != params) { - hdd_err("Incorrect cmd - diff params then expected %d", - params); - return -EINVAL; - } - - hdd_notice("PNO Timer value %d Timer repeat %d offset %d", - request.scanTimers.aTimerValues[i]. - uTimerValue, - request.scanTimers.aTimerValues[i]. - uTimerRepeat, offset); - - ptr += offset; - } - - } else { - hdd_notice("No scan timers provided param count %d scan timers %d", - params, request.scanTimers.ucScanTimersCount); - - /* Scan timers defaults to 5 minutes */ - request.scanTimers.ucScanTimersCount = 1; - request.scanTimers.aTimerValues[0].uTimerValue = 60; - request.scanTimers.aTimerValues[0].uTimerRepeat = 0; - } - params = sscanf(ptr, "%hhu %n", &(mode), &offset); request.modePNO = mode; diff --git a/core/mac/inc/sir_api.h b/core/mac/inc/sir_api.h index f4a48b6320d7..6753bf860b9e 100644 --- a/core/mac/inc/sir_api.h +++ b/core/mac/inc/sir_api.h @@ -2715,7 +2715,6 @@ typedef struct sAniIbssRouteTable { #define SIR_PNO_MAX_NETW_CHANNELS 26 #define SIR_PNO_MAX_NETW_CHANNELS_EX 60 #define SIR_PNO_MAX_SUPP_NETWORKS 16 -#define SIR_PNO_MAX_SCAN_TIMERS 10 /* * size based of dot11 declaration without extra IEs as we will not carry those @@ -2743,23 +2742,30 @@ typedef struct { int32_t rssiThreshold; } tSirNetworkType; -typedef struct { - uint32_t uTimerValue; - uint32_t uTimerRepeat; -} tSirScanTimer; - -typedef struct { - uint8_t ucScanTimersCount; - tSirScanTimer aTimerValues[SIR_PNO_MAX_SCAN_TIMERS]; -} tSirScanTimersType; - +/** + * struct sSirPNOScanReq - PNO Scan request structure + * @enable: flag to enable or disable + * @modePNO: PNO Mode + * @ucNetworksCount: Number of networks + * @aNetworks: Preferred network list + * @sessionId: Session identifier + * @fast_scan_period: Fast Scan period + * @slow_scan_period: Slow scan period + * @fast_scan_max_cycles: Fast scan max cycles + * @us24GProbeTemplateLen: 2.4G probe template length + * @p24GProbeTemplate: 2.4G probe template + * @us5GProbeTemplateLen: 5G probe template length + * @p5GProbeTemplate: 5G probe template + */ typedef struct sSirPNOScanReq { uint8_t enable; eSirPNOMode modePNO; uint8_t ucNetworksCount; tSirNetworkType aNetworks[SIR_PNO_MAX_SUPP_NETWORKS]; - tSirScanTimersType scanTimers; uint8_t sessionId; + uint32_t fast_scan_period; + uint32_t slow_scan_period; + uint8_t fast_scan_max_cycles; uint32_t active_min_time; uint32_t active_max_time; diff --git a/core/wma/src/wma_scan_roam.c b/core/wma/src/wma_scan_roam.c index 699e49c65074..0156f9ac7f31 100644 --- a/core/wma/src/wma_scan_roam.c +++ b/core/wma/src/wma_scan_roam.c @@ -3536,13 +3536,12 @@ CDF_STATUS wma_pno_start(tp_wma_handle wma, tpSirPNOScanReq pno) cmd->passive_dwell_time = pno->passive_max_time; /* Copy scan interval */ - if (pno->scanTimers.ucScanTimersCount) { - cmd->fast_scan_period = - WMA_SEC_TO_MSEC(pno->scanTimers.aTimerValues[0]. - uTimerValue); - cmd->slow_scan_period = cmd->fast_scan_period; - WMA_LOGD("Scan period : %d msec", cmd->slow_scan_period); - } + cmd->fast_scan_period = pno->fast_scan_period; + cmd->slow_scan_period = pno->slow_scan_period; + cmd->fast_scan_max_cycles = pno->fast_scan_max_cycles; + WMA_LOGD("fast_scan_period: %d msec slow_scan_period: %d msec", + cmd->fast_scan_period, cmd->slow_scan_period); + WMA_LOGD("fast_scan_max_cycles: %d", cmd->fast_scan_max_cycles); buf_ptr += sizeof(wmi_nlo_config_cmd_fixed_param);