From 9a61eedc9b584cd5a0e450bc044ca05a6c9d478a Mon Sep 17 00:00:00 2001 From: Bapiraju Alla Date: Mon, 22 Jun 2020 17:42:15 +0530 Subject: [PATCH] qcacld-3.0: Override powersave configuration for monitor mode Currently, powersave configuration is being overwritten before INIs are initialized by mlme component. As a result INI configuration is not being overwritten in case of monitor mode. To resolve this issue, overwrite PS configuration during start modules and restore it in stop modules. Change-Id: I2707b431b81881c943104b211d55c6f48f348ba9 CRs-Fixed: 2682164 --- .../mlme/dispatcher/inc/wlan_mlme_api.h | 1 - core/hdd/inc/wlan_hdd_cfg.h | 9 ++++ core/hdd/src/wlan_hdd_cfg.c | 50 ++++++++++++++++++- core/hdd/src/wlan_hdd_main.c | 11 ++-- 4 files changed, 65 insertions(+), 6 deletions(-) diff --git a/components/mlme/dispatcher/inc/wlan_mlme_api.h b/components/mlme/dispatcher/inc/wlan_mlme_api.h index afba7bd03c..3d907bdbe3 100644 --- a/components/mlme/dispatcher/inc/wlan_mlme_api.h +++ b/components/mlme/dispatcher/inc/wlan_mlme_api.h @@ -2240,7 +2240,6 @@ QDF_STATUS wlan_mlme_is_bmps_enabled(struct wlan_objmgr_psoc *psoc, /** * wlan_mlme_override_bmps_imps() - disable imps/bmps * @psoc: pointer to psoc object - * @value: value that is requested by the caller * * Return: QDF_STATUS_SUCCESS - in case of success */ diff --git a/core/hdd/inc/wlan_hdd_cfg.h b/core/hdd/inc/wlan_hdd_cfg.h index 7c5df85db7..e66ea6dfbc 100644 --- a/core/hdd/inc/wlan_hdd_cfg.h +++ b/core/hdd/inc/wlan_hdd_cfg.h @@ -341,6 +341,15 @@ QDF_STATUS hdd_get_nss(struct hdd_adapter *adapter, uint8_t *nss); */ bool hdd_dfs_indicate_radar(struct hdd_context *hdd_ctx); +/** + * hdd_restore_all_ps() - Restore all the powersave configuration overwritten + * by hdd_override_all_ps. + * @hdd_ctx: Pointer to HDD context. + * + * Return: None + */ +void hdd_restore_all_ps(struct hdd_context *hdd_ctx); + /** * hdd_override_all_ps() - overrides to disables all the powersave features. * @hdd_ctx: Pointer to HDD context. diff --git a/core/hdd/src/wlan_hdd_cfg.c b/core/hdd/src/wlan_hdd_cfg.c index df42822949..21290f386c 100644 --- a/core/hdd/src/wlan_hdd_cfg.c +++ b/core/hdd/src/wlan_hdd_cfg.c @@ -339,40 +339,86 @@ config_exit: return qdf_status; } +#ifdef FEATURE_RUNTIME_PM /** * hdd_disable_runtime_pm() - Override to disable runtime_pm. * @cfg_ini: Handle to struct hdd_config * * Return: None */ -#ifdef FEATURE_RUNTIME_PM static void hdd_disable_runtime_pm(struct hdd_config *cfg_ini) { cfg_ini->runtime_pm = 0; } + +/** + * hdd_restore_runtime_pm() - Restore runtime_pm configuration. + * @cfg_ini: Handle to struct hdd_config + * + * Return: None + */ +static void hdd_restore_runtime_pm(struct hdd_context *hdd_ctx) +{ + struct hdd_config *cfg_ini = hdd_ctx->config; + + cfg_ini->runtime_pm = cfg_get(hdd_ctx->psoc, CFG_ENABLE_RUNTIME_PM); +} #else static void hdd_disable_runtime_pm(struct hdd_config *cfg_ini) { } + +static void hdd_restore_runtime_pm(struct hdd_context *hdd_ctx) +{ +} #endif +#ifdef FEATURE_WLAN_AUTO_SHUTDOWN /** * hdd_disable_auto_shutdown() - Override to disable auto_shutdown. * @cfg_ini: Handle to struct hdd_config * * Return: None */ -#ifdef FEATURE_WLAN_AUTO_SHUTDOWN static void hdd_disable_auto_shutdown(struct hdd_config *cfg_ini) { cfg_ini->wlan_auto_shutdown = 0; } + +/** + * hdd_restore_auto_shutdown() - Restore auto_shutdown configuration. + * @cfg_ini: Handle to struct hdd_config + * + * Return: None + */ +static void hdd_restore_auto_shutdown(struct hdd_context *hdd_ctx) +{ + struct hdd_config *cfg_ini = hdd_ctx->config; + + cfg_ini->wlan_auto_shutdown = cfg_get(hdd_ctx->psoc, + CFG_WLAN_AUTO_SHUTDOWN); +} #else static void hdd_disable_auto_shutdown(struct hdd_config *cfg_ini) { } + +static void hdd_restore_auto_shutdown(struct hdd_context *hdd_ctx) +{ +} #endif +void hdd_restore_all_ps(struct hdd_context *hdd_ctx) +{ + /* + * imps/bmps configuration will be restored in driver mode change + * sequence as part of hdd_wlan_start_modules + */ + + hdd_restore_runtime_pm(hdd_ctx); + hdd_restore_auto_shutdown(hdd_ctx); +} + void hdd_override_all_ps(struct hdd_context *hdd_ctx) { struct hdd_config *cfg_ini = hdd_ctx->config; diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index 7c74e68a21..6bb2236fa9 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -3883,6 +3883,10 @@ int hdd_wlan_start_modules(struct hdd_context *hdd_ctx, bool reinit) break; } + /* Override PS params for monitor mode */ + if (hdd_get_conparam() == QDF_GLOBAL_MONITOR_MODE) + hdd_override_all_ps(hdd_ctx); + ret = hdd_configure_cds(hdd_ctx); if (ret) { hdd_err("Failed to Enable cds modules; errno: %d", ret); @@ -10735,9 +10739,6 @@ static void hdd_override_ini_config(struct hdd_context *hdd_ctx) hdd_ctx->config->action_oui_enable = 0; hdd_err("Ignore action oui ini, since no action_oui component"); } - - if (QDF_GLOBAL_MONITOR_MODE == cds_get_conparam()) - hdd_override_all_ps(hdd_ctx); } #ifdef ENABLE_MTRACE_LOG @@ -13201,6 +13202,10 @@ int hdd_wlan_stop_modules(struct hdd_context *hdd_ctx, bool ftm_mode) case DRIVER_MODULES_ENABLED: hdd_debug("Wlan transitioning (CLOSED <- ENABLED)"); + /* Restore PS params for monitor mode */ + if (hdd_get_conparam() == QDF_GLOBAL_MONITOR_MODE) + hdd_restore_all_ps(hdd_ctx); + if (hdd_get_conparam() == QDF_GLOBAL_FTM_MODE) { hdd_disable_power_management(hdd_ctx); break;