From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 87DEF1B6A1 for ; Wed, 4 Oct 2017 17:25:39 +0200 (CEST) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Oct 2017 08:25:39 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,477,1500966000"; d="scan'208";a="319493489" Received: from silpixa00397898.ir.intel.com ([10.237.223.116]) by fmsmga004.fm.intel.com with ESMTP; 04 Oct 2017 08:25:37 -0700 From: David Hunt To: dev@dpdk.org Cc: konstantin.ananyev@intel.com, jingjing.wu@intel.com, David Hunt , Nemanja Marjanovic , Rory Sexton Date: Wed, 4 Oct 2017 16:25:15 +0100 Message-Id: <1507130720-48891-5-git-send-email-david.hunt@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1507130720-48891-1-git-send-email-david.hunt@intel.com> References: <1507108515-186477-1-git-send-email-david.hunt@intel.com> <1507130720-48891-1-git-send-email-david.hunt@intel.com> Subject: [dpdk-dev] [PATCH v5 4/9] examples/vm_power_mgr: add scale to medium freq fn X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 04 Oct 2017 15:25:40 -0000 Signed-off-by: Nemanja Marjanovic Signed-off-by: Rory Sexton Signed-off-by: David Hunt --- examples/vm_power_manager/power_manager.c | 15 +++++++++++++++ examples/vm_power_manager/power_manager.h | 13 +++++++++++++ 2 files changed, 28 insertions(+) diff --git a/examples/vm_power_manager/power_manager.c b/examples/vm_power_manager/power_manager.c index 80705f9..c021c1d 100644 --- a/examples/vm_power_manager/power_manager.c +++ b/examples/vm_power_manager/power_manager.c @@ -286,3 +286,18 @@ power_manager_disable_turbo_core(unsigned int core_num) POWER_SCALE_CORE(disable_turbo, core_num, ret); return ret; } + +int +power_manager_scale_core_med(unsigned int core_num) +{ + int ret = 0; + + if (core_num >= POWER_MGR_MAX_CPUS) + return -1; + if (!(global_enabled_cpus & (1ULL << core_num))) + return -1; + rte_spinlock_lock(&global_core_freq_info[core_num].power_sl); + ret = rte_power_set_freq(core_num, 5); + rte_spinlock_unlock(&global_core_freq_info[core_num].power_sl); + return ret; +} diff --git a/examples/vm_power_manager/power_manager.h b/examples/vm_power_manager/power_manager.h index b74d09b..b52fb4c 100644 --- a/examples/vm_power_manager/power_manager.h +++ b/examples/vm_power_manager/power_manager.h @@ -231,6 +231,19 @@ int power_manager_disable_turbo_core(unsigned int core_num); */ uint32_t power_manager_get_current_frequency(unsigned core_num); +/** + * Scale to medium frequency for the core specified by core_num. + * It is thread-safe. + * + * @param core_num + * The core number to change frequency + * + * @return + * - 1 on success. + * - 0 if frequency not changed. + * - Negative on error. + */ +int power_manager_scale_core_med(unsigned int core_num); #ifdef __cplusplus } -- 2.7.4