From patchwork Tue Nov 28 10:56:53 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Kovacevic, Marko" X-Patchwork-Id: 31708 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id B34C8325C; Tue, 28 Nov 2017 11:58:00 +0100 (CET) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 871342BE9 for ; Tue, 28 Nov 2017 11:57:54 +0100 (CET) Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Nov 2017 02:57:53 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.44,467,1505804400"; d="scan'208";a="181457939" Received: from silpixa00399502.ir.intel.com (HELO silpixa00399502.ger.corp.intel.com) ([10.237.223.218]) by fmsmga006.fm.intel.com with ESMTP; 28 Nov 2017 02:57:52 -0800 From: Marko Kovacevic To: dev@dpdk.org Cc: david.hunt@intel.com, marko.kovacevic@intel.com Date: Tue, 28 Nov 2017 10:56:53 +0000 Message-Id: <20171128105654.7733-3-marko.kovacevic@intel.com> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20171128105654.7733-1-marko.kovacevic@intel.com> References: <20171128105654.7733-1-marko.kovacevic@intel.com> Subject: [dpdk-dev] [PATCH v1 3/4] power: clean up of kvm files 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Signed-off-by: Marko Kovacevic --- V1: Clean of of kvm power files --- lib/librte_power/Makefile | 2 +- .../{rte_power_kvm_vm.c => power_kvm_vm.c} | 28 +++++++++++----------- .../{rte_power_kvm_vm.h => power_kvm_vm.h} | 28 +++++++++++----------- lib/librte_power/rte_power.c | 28 +++++++++++----------- 4 files changed, 43 insertions(+), 43 deletions(-) rename lib/librte_power/{rte_power_kvm_vm.c => power_kvm_vm.c} (83%) rename lib/librte_power/{rte_power_kvm_vm.h => power_kvm_vm.h} (85%) diff --git a/lib/librte_power/Makefile b/lib/librte_power/Makefile index bf5a55e..a35c50a 100644 --- a/lib/librte_power/Makefile +++ b/lib/librte_power/Makefile @@ -43,7 +43,7 @@ LIBABIVER := 1 # all source are stored in SRCS-y SRCS-$(CONFIG_RTE_LIBRTE_POWER) := rte_power.c power_acpi_cpufreq.c -SRCS-$(CONFIG_RTE_LIBRTE_POWER) += rte_power_kvm_vm.c guest_channel.c +SRCS-$(CONFIG_RTE_LIBRTE_POWER) += power_kvm_vm.c guest_channel.c # install this header file SYMLINK-$(CONFIG_RTE_LIBRTE_POWER)-include := rte_power.h diff --git a/lib/librte_power/rte_power_kvm_vm.c b/lib/librte_power/power_kvm_vm.c similarity index 83% rename from lib/librte_power/rte_power_kvm_vm.c rename to lib/librte_power/power_kvm_vm.c index 52cac0c..4b796f9 100644 --- a/lib/librte_power/rte_power_kvm_vm.c +++ b/lib/librte_power/power_kvm_vm.c @@ -37,8 +37,8 @@ #include "guest_channel.h" #include "channel_commands.h" -#include "rte_power_kvm_vm.h" -#include "rte_power_common.h" +#include "power_kvm_vm.h" +#include "power_common.h" #define FD_PATH "/dev/virtio-ports/virtio.serial.port.poweragent" @@ -46,7 +46,7 @@ static struct channel_packet pkt[CHANNEL_CMDS_MAX_VM_CHANNELS]; int -rte_power_kvm_vm_init(unsigned int lcore_id) +power_kvm_vm_init(unsigned int lcore_id) { if (lcore_id >= CHANNEL_CMDS_MAX_VM_CHANNELS) { RTE_LOG(ERR, POWER, "Core(%u) is out of range 0...%d\n", @@ -59,14 +59,14 @@ rte_power_kvm_vm_init(unsigned int lcore_id) } int -rte_power_kvm_vm_exit(unsigned int lcore_id) +power_kvm_vm_exit(unsigned int lcore_id) { guest_channel_host_disconnect(lcore_id); return 0; } uint32_t -rte_power_kvm_vm_freqs(__attribute__((unused)) unsigned int lcore_id, +power_kvm_vm_freqs(__attribute__((unused)) unsigned int lcore_id, __attribute__((unused)) uint32_t *freqs, __attribute__((unused)) uint32_t num) { @@ -76,7 +76,7 @@ rte_power_kvm_vm_freqs(__attribute__((unused)) unsigned int lcore_id, } uint32_t -rte_power_kvm_vm_get_freq(__attribute__((unused)) unsigned int lcore_id) +power_kvm_vm_get_freq(__attribute__((unused)) unsigned int lcore_id) { RTE_LOG(ERR, POWER, "rte_power_get_freq is not implemented " "for Virtual Machine Power Management\n"); @@ -84,7 +84,7 @@ rte_power_kvm_vm_get_freq(__attribute__((unused)) unsigned int lcore_id) } int -rte_power_kvm_vm_set_freq(__attribute__((unused)) unsigned int lcore_id, +power_kvm_vm_set_freq(__attribute__((unused)) unsigned int lcore_id, __attribute__((unused)) uint32_t index) { RTE_LOG(ERR, POWER, "rte_power_set_freq is not implemented " @@ -112,44 +112,44 @@ send_msg(unsigned int lcore_id, uint32_t scale_direction) } int -rte_power_kvm_vm_freq_up(unsigned int lcore_id) +power_kvm_vm_freq_up(unsigned int lcore_id) { return send_msg(lcore_id, CPU_POWER_SCALE_UP); } int -rte_power_kvm_vm_freq_down(unsigned int lcore_id) +power_kvm_vm_freq_down(unsigned int lcore_id) { return send_msg(lcore_id, CPU_POWER_SCALE_DOWN); } int -rte_power_kvm_vm_freq_max(unsigned int lcore_id) +power_kvm_vm_freq_max(unsigned int lcore_id) { return send_msg(lcore_id, CPU_POWER_SCALE_MAX); } int -rte_power_kvm_vm_freq_min(unsigned int lcore_id) +power_kvm_vm_freq_min(unsigned int lcore_id) { return send_msg(lcore_id, CPU_POWER_SCALE_MIN); } int -rte_power_kvm_vm_turbo_status(__attribute__((unused)) unsigned int lcore_id) +power_kvm_vm_turbo_status(__attribute__((unused)) unsigned int lcore_id) { RTE_LOG(ERR, POWER, "rte_power_turbo_status is not implemented for Virtual Machine Power Management\n"); return -ENOTSUP; } int -rte_power_kvm_vm_enable_turbo(unsigned int lcore_id) +power_kvm_vm_enable_turbo(unsigned int lcore_id) { return send_msg(lcore_id, CPU_POWER_ENABLE_TURBO); } int -rte_power_kvm_vm_disable_turbo(unsigned int lcore_id) +power_kvm_vm_disable_turbo(unsigned int lcore_id) { return send_msg(lcore_id, CPU_POWER_DISABLE_TURBO); } diff --git a/lib/librte_power/rte_power_kvm_vm.h b/lib/librte_power/power_kvm_vm.h similarity index 85% rename from lib/librte_power/rte_power_kvm_vm.h rename to lib/librte_power/power_kvm_vm.h index 96349c5..8cd5e09 100644 --- a/lib/librte_power/rte_power_kvm_vm.h +++ b/lib/librte_power/power_kvm_vm.h @@ -31,8 +31,8 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef _RTE_POWER_KVM_VM_H -#define _RTE_POWER_KVM_VM_H +#ifndef _POWER_KVM_VM_H +#define _POWER_KVM_VM_H /** * @file @@ -58,7 +58,7 @@ extern "C" { * - 0 on success. * - Negative on error. */ -int rte_power_kvm_vm_init(unsigned int lcore_id); +int power_kvm_vm_init(unsigned int lcore_id); /** * Exit power management on a specific lcore. @@ -70,7 +70,7 @@ int rte_power_kvm_vm_init(unsigned int lcore_id); * - 0 on success. * - Negative on error. */ -int rte_power_kvm_vm_exit(unsigned int lcore_id); +int power_kvm_vm_exit(unsigned int lcore_id); /** * Get the available frequencies of a specific lcore. @@ -86,7 +86,7 @@ int rte_power_kvm_vm_exit(unsigned int lcore_id); * @return * -ENOTSUP */ -uint32_t rte_power_kvm_vm_freqs(unsigned int lcore_id, uint32_t *freqs, +uint32_t power_kvm_vm_freqs(unsigned int lcore_id, uint32_t *freqs, uint32_t num); /** @@ -99,7 +99,7 @@ uint32_t rte_power_kvm_vm_freqs(unsigned int lcore_id, uint32_t *freqs, * @return * -ENOTSUP */ -uint32_t rte_power_kvm_vm_get_freq(unsigned int lcore_id); +uint32_t power_kvm_vm_get_freq(unsigned int lcore_id); /** * Set the new frequency for a specific lcore by indicating the index of @@ -114,7 +114,7 @@ uint32_t rte_power_kvm_vm_get_freq(unsigned int lcore_id); * @return * -ENOTSUP */ -int rte_power_kvm_vm_set_freq(unsigned int lcore_id, uint32_t index); +int power_kvm_vm_set_freq(unsigned int lcore_id, uint32_t index); /** * Scale up the frequency of a specific lcore. This request is forwarded to the @@ -128,7 +128,7 @@ int rte_power_kvm_vm_set_freq(unsigned int lcore_id, uint32_t index); * - 1 on success. * - Negative on error. */ -int rte_power_kvm_vm_freq_up(unsigned int lcore_id); +int power_kvm_vm_freq_up(unsigned int lcore_id); /** * Scale down the frequency of a specific lcore according to the available @@ -142,7 +142,7 @@ int rte_power_kvm_vm_freq_up(unsigned int lcore_id); * - 1 on success. * - Negative on error. */ -int rte_power_kvm_vm_freq_down(unsigned int lcore_id); +int power_kvm_vm_freq_down(unsigned int lcore_id); /** * Scale up the frequency of a specific lcore to the highest according to the @@ -156,7 +156,7 @@ int rte_power_kvm_vm_freq_down(unsigned int lcore_id); * - 1 on success. * - Negative on error. */ -int rte_power_kvm_vm_freq_max(unsigned int lcore_id); +int power_kvm_vm_freq_max(unsigned int lcore_id); /** * Scale down the frequency of a specific lcore to the lowest according to the @@ -170,7 +170,7 @@ int rte_power_kvm_vm_freq_max(unsigned int lcore_id); * - 1 on success. * - Negative on error. */ -int rte_power_kvm_vm_freq_min(unsigned int lcore_id); +int power_kvm_vm_freq_min(unsigned int lcore_id); /** * It should be protected outside of this function for threadsafe. @@ -181,7 +181,7 @@ int rte_power_kvm_vm_freq_min(unsigned int lcore_id); * @return * -ENOTSUP */ -int rte_power_kvm_vm_turbo_status(unsigned int lcore_id); +int power_kvm_vm_turbo_status(unsigned int lcore_id); /** * It should be protected outside of this function for threadsafe. @@ -193,7 +193,7 @@ int rte_power_kvm_vm_turbo_status(unsigned int lcore_id); * - 1 on success. * - Negative on error. */ -int rte_power_kvm_vm_enable_turbo(unsigned int lcore_id); +int power_kvm_vm_enable_turbo(unsigned int lcore_id); /** * It should be protected outside of this function for threadsafe. @@ -205,7 +205,7 @@ int rte_power_kvm_vm_enable_turbo(unsigned int lcore_id); * - 1 on success. * - Negative on error. */ -int rte_power_kvm_vm_disable_turbo(unsigned int lcore_id); +int power_kvm_vm_disable_turbo(unsigned int lcore_id); #ifdef __cplusplus } #endif diff --git a/lib/librte_power/rte_power.c b/lib/librte_power/rte_power.c index db6f4a9..af9b504 100644 --- a/lib/librte_power/rte_power.c +++ b/lib/librte_power/rte_power.c @@ -35,7 +35,7 @@ #include "rte_power.h" #include "power_acpi_cpufreq.h" -#include "rte_power_kvm_vm.h" +#include "power_kvm_vm.h" #include "rte_power_common.h" enum power_management_env global_default_env = PM_ENV_NOT_SET; @@ -72,16 +72,16 @@ rte_power_set_env(enum power_management_env env) rte_power_freq_enable_turbo = power_acpi_enable_turbo; rte_power_freq_disable_turbo = power_acpi_disable_turbo; } else if (env == PM_ENV_KVM_VM) { - rte_power_freqs = rte_power_kvm_vm_freqs; - rte_power_get_freq = rte_power_kvm_vm_get_freq; - rte_power_set_freq = rte_power_kvm_vm_set_freq; - rte_power_freq_up = rte_power_kvm_vm_freq_up; - rte_power_freq_down = rte_power_kvm_vm_freq_down; - rte_power_freq_min = rte_power_kvm_vm_freq_min; - rte_power_freq_max = rte_power_kvm_vm_freq_max; - rte_power_turbo_status = rte_power_kvm_vm_turbo_status; - rte_power_freq_enable_turbo = rte_power_kvm_vm_enable_turbo; - rte_power_freq_disable_turbo = rte_power_kvm_vm_disable_turbo; + rte_power_freqs = power_kvm_vm_freqs; + rte_power_get_freq = power_kvm_vm_get_freq; + rte_power_set_freq = power_kvm_vm_set_freq; + rte_power_freq_up = power_kvm_vm_freq_up; + rte_power_freq_down = power_kvm_vm_freq_down; + rte_power_freq_min = power_kvm_vm_freq_min; + rte_power_freq_max = power_kvm_vm_freq_max; + rte_power_turbo_status = power_kvm_vm_turbo_status; + rte_power_freq_enable_turbo = power_kvm_vm_enable_turbo; + rte_power_freq_disable_turbo = power_kvm_vm_disable_turbo; } else { RTE_LOG(ERR, POWER, "Invalid Power Management Environment(%d) set\n", env); @@ -114,7 +114,7 @@ rte_power_init(unsigned int lcore_id) return power_acpi_cpufreq_init(lcore_id); } if (global_default_env == PM_ENV_KVM_VM) { - return rte_power_kvm_vm_init(lcore_id); + return power_kvm_vm_init(lcore_id); } /* Auto detect Environment */ RTE_LOG(INFO, POWER, "Attempting to initialise ACPI cpufreq power " @@ -126,7 +126,7 @@ rte_power_init(unsigned int lcore_id) } RTE_LOG(INFO, POWER, "Attempting to initialise VM power management...\n"); - ret = rte_power_kvm_vm_init(lcore_id); + ret = power_kvm_vm_init(lcore_id); if (ret == 0) { rte_power_set_env(PM_ENV_KVM_VM); goto out; @@ -143,7 +143,7 @@ rte_power_exit(unsigned int lcore_id) if (global_default_env == PM_ENV_ACPI_CPUFREQ) return power_acpi_cpufreq_exit(lcore_id); if (global_default_env == PM_ENV_KVM_VM) - return rte_power_kvm_vm_exit(lcore_id); + return power_kvm_vm_exit(lcore_id); RTE_LOG(ERR, POWER, "Environment has not been set, unable to exit " "gracefully\n");