From c2cce632c8014d2cb6c700baf43346a7e916e9dd Mon Sep 17 00:00:00 2001 From: Ganesh Kondabattini Date: Mon, 10 Jul 2017 17:34:36 +0530 Subject: [PATCH] qcacmn: Refactor the code to update the conc_system_pref Refactor the code to dynamically change the conc_system_pref. Whenever user changes conc_system_pref from application, driver is overwriting the conc_system_pref which is getting populated from ini file. Once it is overwritten there is no way to get the configured value for this setting. So add a new variable to hold the value of conc_system_pref without disturbing default value read from ini file. CRs-Fixed: 2082073 Change-Id: Icfb245c7a8872885332ec222780c911d08521d46 --- .../policy_mgr/inc/wlan_policy_mgr_api.h | 20 ++++++++++++ .../src/wlan_policy_mgr_get_set_utils.c | 32 +++++++++++++++++++ .../policy_mgr/src/wlan_policy_mgr_i.h | 1 + .../policy_mgr/src/wlan_policy_mgr_pcl.c | 12 +++---- 4 files changed, 59 insertions(+), 6 deletions(-) diff --git a/umac/cmn_services/policy_mgr/inc/wlan_policy_mgr_api.h b/umac/cmn_services/policy_mgr/inc/wlan_policy_mgr_api.h index 94668d76e366..3865a8674f4c 100644 --- a/umac/cmn_services/policy_mgr/inc/wlan_policy_mgr_api.h +++ b/umac/cmn_services/policy_mgr/inc/wlan_policy_mgr_api.h @@ -2085,4 +2085,24 @@ void policy_mgr_init_sap_mandatory_2g_chan(struct wlan_objmgr_psoc *psoc); */ void policy_mgr_remove_sap_mandatory_chan(struct wlan_objmgr_psoc *psoc, uint8_t chan); +/* + * policy_set_cur_conc_system_pref - set current conc_system_pref + * @psoc: soc pointer + * + * Set the current concurrency system preference. + * + * Return: None + */ +void policy_mgr_set_cur_conc_system_pref(struct wlan_objmgr_psoc *psoc, + uint8_t conc_system_pref); +/** + * policy_mgr_get_cur_conc_system_pref - Get current conc_system_pref + * @psoc: soc pointer + * + * Get the current concurrent system preference. + * + * Return: conc_system_pref + */ +uint8_t policy_mgr_get_cur_conc_system_pref(struct wlan_objmgr_psoc *psoc); + #endif /* __WLAN_POLICY_MGR_API_H */ diff --git a/umac/cmn_services/policy_mgr/src/wlan_policy_mgr_get_set_utils.c b/umac/cmn_services/policy_mgr/src/wlan_policy_mgr_get_set_utils.c index ba337ab71ae1..c156881c7028 100644 --- a/umac/cmn_services/policy_mgr/src/wlan_policy_mgr_get_set_utils.c +++ b/umac/cmn_services/policy_mgr/src/wlan_policy_mgr_get_set_utils.c @@ -1768,6 +1768,8 @@ QDF_STATUS policy_mgr_set_user_cfg(struct wlan_objmgr_psoc *psoc, pm_ctx->user_cfg = *user_cfg; + pm_ctx->cur_conc_system_pref = pm_ctx->user_cfg.conc_system_pref; + return QDF_STATUS_SUCCESS; } @@ -2588,6 +2590,36 @@ bool policy_mgr_is_scan_simultaneous_capable(struct wlan_objmgr_psoc *psoc) return false; } +void policy_mgr_set_cur_conc_system_pref(struct wlan_objmgr_psoc *psoc, + uint8_t conc_system_pref) +{ + struct policy_mgr_psoc_priv_obj *pm_ctx; + + pm_ctx = policy_mgr_get_context(psoc); + + if (!pm_ctx) { + policy_mgr_err("Invalid Context"); + return; + } + + policy_mgr_debug("conc_system_pref %hu", conc_system_pref); + pm_ctx->cur_conc_system_pref = conc_system_pref; +} + +uint8_t policy_mgr_get_cur_conc_system_pref(struct wlan_objmgr_psoc *psoc) +{ + struct policy_mgr_psoc_priv_obj *pm_ctx; + + pm_ctx = policy_mgr_get_context(psoc); + if (!pm_ctx) { + policy_mgr_err("Invalid Context"); + return PM_THROUGHPUT; + } + + policy_mgr_debug("conc_system_pref %hu", pm_ctx->cur_conc_system_pref); + return pm_ctx->cur_conc_system_pref; +} + QDF_STATUS policy_mgr_get_updated_scan_and_fw_mode_config( struct wlan_objmgr_psoc *psoc, uint32_t *scan_config, uint32_t *fw_mode_config, uint32_t dual_mac_disable_ini) diff --git a/umac/cmn_services/policy_mgr/src/wlan_policy_mgr_i.h b/umac/cmn_services/policy_mgr/src/wlan_policy_mgr_i.h index fd5ab69f5846..5610f49f8c09 100644 --- a/umac/cmn_services/policy_mgr/src/wlan_policy_mgr_i.h +++ b/umac/cmn_services/policy_mgr/src/wlan_policy_mgr_i.h @@ -269,6 +269,7 @@ struct policy_mgr_psoc_priv_obj { uint16_t unsafe_channel_list[QDF_MAX_NUM_CHAN]; uint16_t unsafe_channel_count; struct sta_ap_intf_check_work_ctx *sta_ap_intf_check_work_info; + uint8_t cur_conc_system_pref; }; /** diff --git a/umac/cmn_services/policy_mgr/src/wlan_policy_mgr_pcl.c b/umac/cmn_services/policy_mgr/src/wlan_policy_mgr_pcl.c index 79a437ac0342..01f2cc91c000 100644 --- a/umac/cmn_services/policy_mgr/src/wlan_policy_mgr_pcl.c +++ b/umac/cmn_services/policy_mgr/src/wlan_policy_mgr_pcl.c @@ -489,9 +489,9 @@ QDF_STATUS policy_mgr_get_pcl(struct wlan_objmgr_psoc *psoc, /* find the current connection state from pm_conc_connection_list*/ num_connections = policy_mgr_get_connection_count(psoc); policy_mgr_debug("connections:%d pref:%d requested mode:%d", - num_connections, pm_ctx->user_cfg.conc_system_pref, mode); + num_connections, pm_ctx->cur_conc_system_pref, mode); - switch (pm_ctx->user_cfg.conc_system_pref) { + switch (pm_ctx->cur_conc_system_pref) { case 0: conc_system_pref = PM_THROUGHPUT; break; @@ -502,8 +502,8 @@ QDF_STATUS policy_mgr_get_pcl(struct wlan_objmgr_psoc *psoc, conc_system_pref = PM_LATENCY; break; default: - policy_mgr_err("unknown conc_system_pref value %d", - pm_ctx->user_cfg.conc_system_pref); + policy_mgr_err("unknown cur_conc_system_pref value %d", + pm_ctx->cur_conc_system_pref); break; } @@ -596,10 +596,10 @@ enum policy_mgr_conc_priority_mode return PM_THROUGHPUT; } - if (pm_ctx->user_cfg.conc_system_pref >= PM_MAX_CONC_PRIORITY_MODE) + if (pm_ctx->cur_conc_system_pref >= PM_MAX_CONC_PRIORITY_MODE) return PM_THROUGHPUT; - return pm_ctx->user_cfg.conc_system_pref; + return pm_ctx->cur_conc_system_pref; } enum policy_mgr_one_connection_mode