From 9335d81f233da39cfbb3805767c199ea5a633402 Mon Sep 17 00:00:00 2001 From: Ashish Kumar Dhanotiya Date: Fri, 30 Jun 2017 16:57:20 +0530 Subject: [PATCH] qcacld-3.0: Add host support to configure ITO repeat count Add Host support to configure inactivity timeout repeated count from ini. Change-Id: I6b079ab55470838a9bf5488ec18dbd2977c3ee17 CRs-Fixed: 2066004 --- core/cds/inc/cds_config.h | 2 ++ core/hdd/inc/wlan_hdd_cfg.h | 19 ++++++++++++++++ core/hdd/src/wlan_hdd_cfg.c | 11 +++++++++ core/hdd/src/wlan_hdd_main.c | 2 ++ core/wma/inc/wma.h | 2 ++ core/wma/src/wma_main.c | 2 ++ core/wma/src/wma_power.c | 43 ++++++++++++++++++++++++++++++++++++ 7 files changed, 81 insertions(+) diff --git a/core/cds/inc/cds_config.h b/core/cds/inc/cds_config.h index 9e9954ec6b1f..2ced6904a796 100644 --- a/core/cds/inc/cds_config.h +++ b/core/cds/inc/cds_config.h @@ -118,6 +118,7 @@ enum active_bpf_mode { * @active_mc_bc_bpf_mode: Setting that determines how BPF is applied in * active mode for MC/BC packets * @auto_power_save_fail_mode: auto detect power save failure mode + * @ito_repeat_count: Indicates ito repeated count * Structure for holding cds ini parameters. */ @@ -174,5 +175,6 @@ struct cds_config_info { enum active_bpf_mode active_uc_bpf_mode; enum active_bpf_mode active_mc_bc_bpf_mode; bool auto_power_save_fail_mode; + uint8_t ito_repeat_count; }; #endif /* !defined( __CDS_CONFIG_H ) */ diff --git a/core/hdd/inc/wlan_hdd_cfg.h b/core/hdd/inc/wlan_hdd_cfg.h index 49acf1deb15b..fe415d7110d7 100644 --- a/core/hdd/inc/wlan_hdd_cfg.h +++ b/core/hdd/inc/wlan_hdd_cfg.h @@ -10419,10 +10419,28 @@ enum hdd_external_acs_freq_band { #define CFG_TX_ORPHAN_ENABLE_DEFAULT (0) #define CFG_TX_ORPHAN_ENABLE_MIN (0) #define CFG_TX_ORPHAN_ENABLE_MAX (1) +/* + * + * gItoRepeatCount - sets ito repeated count + * @Min: 0 + * @Max: 5 + * @Default: 0 + * + * This ini sets the ito count in FW + * + * Usage: External + * + * + */ +#define CFG_ITO_REPEAT_COUNT_NAME "gItoRepeatCount" +#define CFG_ITO_REPEAT_COUNT_MIN (0) +#define CFG_ITO_REPEAT_COUNT_MAX (5) +#define CFG_ITO_REPEAT_COUNT_DEFAULT (0) /* * Type declarations */ + struct hdd_config { /* Bitmap to track what is explicitly configured */ DECLARE_BITMAP(bExplicitCfg, MAX_CFG_INI_ITEMS); @@ -11162,6 +11180,7 @@ struct hdd_config { uint8_t auto_pwr_save_fail_mode; uint16_t num_11b_tx_chains; uint16_t num_11ag_tx_chains; + uint8_t ito_repeat_count; }; #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 cae2f36319aa..d5fc3a958566 100644 --- a/core/hdd/src/wlan_hdd_cfg.c +++ b/core/hdd/src/wlan_hdd_cfg.c @@ -4455,6 +4455,14 @@ struct reg_table_entry g_registry_table[] = { CFG_11AG_NUM_TX_CHAIN_DEFAULT, CFG_11AG_NUM_TX_CHAIN_MIN, CFG_11AG_NUM_TX_CHAIN_MAX), + + REG_VARIABLE(CFG_ITO_REPEAT_COUNT_NAME, WLAN_PARAM_Integer, + struct hdd_config, ito_repeat_count, + VAR_FLAGS_OPTIONAL | VAR_FLAGS_RANGE_CHECK_ASSUME_DEFAULT, + CFG_ITO_REPEAT_COUNT_DEFAULT, + CFG_ITO_REPEAT_COUNT_MIN, + CFG_ITO_REPEAT_COUNT_MAX), + }; @@ -5993,6 +6001,9 @@ void hdd_cfg_print(hdd_context_t *pHddCtx) hdd_debug("Name = [%s] value = [%u]", CFG_11AG_NUM_TX_CHAIN_NAME, pHddCtx->config->num_11ag_tx_chains); + hdd_debug("Name = [%s] value = [%u]", + CFG_ITO_REPEAT_COUNT_NAME, + pHddCtx->config->ito_repeat_count); } diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index 9a341ff4550a..1c64d3cb9669 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -8044,6 +8044,8 @@ static int hdd_update_cds_config(hdd_context_t *hdd_ctx) cds_cfg->auto_power_save_fail_mode = hdd_ctx->config->auto_pwr_save_fail_mode; + cds_cfg->ito_repeat_count = hdd_ctx->config->ito_repeat_count; + hdd_ra_populate_cds_config(cds_cfg, hdd_ctx); hdd_txrx_populate_cds_config(cds_cfg, hdd_ctx); hdd_nan_populate_cds_config(cds_cfg, hdd_ctx); diff --git a/core/wma/inc/wma.h b/core/wma/inc/wma.h index 58ad28595081..699923b56c95 100644 --- a/core/wma/inc/wma.h +++ b/core/wma/inc/wma.h @@ -1351,6 +1351,7 @@ struct hw_mode_idx_to_mac_cap_idx { * @wmi_cmd_rsp_runtime_lock: wmi command response bus lock * @saved_chan: saved channel list sent as part of WMI_SCAN_CHAN_LIST_CMDID * @dfs_cac_offload: dfs and cac timer offload + * @ito_repeat_count: Indicates ito repeated count */ typedef struct { void *wmi_handle; @@ -1541,6 +1542,7 @@ typedef struct { #endif bool tx_bfee_8ss_enabled; bool in_imps; + uint8_t ito_repeat_count; } t_wma_handle, *tp_wma_handle; /** diff --git a/core/wma/src/wma_main.c b/core/wma/src/wma_main.c index 8661635b890e..2e6233f7b172 100644 --- a/core/wma/src/wma_main.c +++ b/core/wma/src/wma_main.c @@ -2571,6 +2571,8 @@ QDF_STATUS wma_open(struct wlan_objmgr_psoc *psoc, void *cds_context, wma_rx_aggr_failure_event_handler, WMA_RX_SERIALIZER_CTX); + wma_handle->ito_repeat_count = cds_cfg->ito_repeat_count; + /* Register PWR_SAVE_FAIL event only in case of recovery(1) */ if (cds_cfg->auto_power_save_fail_mode) { wmi_unified_register_event_handler(wma_handle->wmi_handle, diff --git a/core/wma/src/wma_power.c b/core/wma/src/wma_power.c index efd7e5b7073d..178b12daa2aa 100644 --- a/core/wma/src/wma_power.c +++ b/core/wma/src/wma_power.c @@ -821,6 +821,22 @@ void wma_enable_sta_ps_mode(tp_wma_handle wma, tpEnablePsParams ps_req) return; } } + + if (wma->ito_repeat_count) { + WMA_LOGI("Set ITO count to %d for vdevId %d", + wma->ito_repeat_count, vdev_id); + + ret = wma_unified_set_sta_ps_param(wma->wmi_handle, + vdev_id, + WMI_STA_PS_PARAM_MAX_RESET_ITO_COUNT_ON_TIM_NO_TXRX, + wma->ito_repeat_count); + if (QDF_IS_STATUS_ERROR(ret)) { + WMA_LOGE("Set ITO count failed vdevId %d Error %d", + vdev_id, ret); + return; + } + } + /* power save request succeeded */ iface->in_bmps = true; } @@ -1755,6 +1771,8 @@ static void wma_configure_vdev_suspend_params(tp_wma_handle wma, struct wma_txrx_node *iface = &wma->interfaces[vdev_id]; struct sAniSirGlobal *mac; QDF_STATUS ret; + uint8_t ito_repeat_count_value = 0; + uint32_t inactivity_time; if (iface->type != WMI_VDEV_TYPE_STA) return; @@ -1781,6 +1799,31 @@ static void wma_configure_vdev_suspend_params(tp_wma_handle wma, WMA_LOGE("%s: Setting InActivity time Failed.", __func__); + if (wlan_cfg_get_int(mac, WNI_CFG_PS_DATA_INACTIVITY_TIMEOUT, + &inactivity_time) != eSIR_SUCCESS) { + QDF_TRACE(QDF_MODULE_ID_WMA, QDF_TRACE_LEVEL_ERROR, + "Failed to get WNI_CFG_PS_DATA_INACTIVITY_TIMEOUT"); + inactivity_time = POWERSAVE_DEFAULT_INACTIVITY_TIME; + } + + /* + * To keep ito repeat count same in wow mode as in non wow mode, + * modulating ito repeat count value. + */ + ito_repeat_count_value = (inactivity_time / cfg_data_val) * + wma->ito_repeat_count; + + if (ito_repeat_count_value) { + ret = wma_unified_set_sta_ps_param(wma->wmi_handle, vdev_id, + WMI_STA_PS_PARAM_MAX_RESET_ITO_COUNT_ON_TIM_NO_TXRX , + ito_repeat_count_value); + WMA_LOGD("%s: Setting ito_repeat_count_value %d.", __func__, + ito_repeat_count_value); + + if (ret) + WMA_LOGE("%s: Setting ITO count failed.", __func__); + } + } /**