From 5e1f62fb1a4bbcf7a6294c019adf36286cce5955 Mon Sep 17 00:00:00 2001 From: Marko Kovacevic Date: Tue, 12 Dec 2017 14:03:27 +0000 Subject: [PATCH] power: clean KVM files rename private header file rte_power_kvm_vm.c to power_kvm_vm.c. This prevents the private functions from leaking into the documentation. Change any private functions from rte_ to just . Reserve the rte_ for public functions Signed-off-by: Marko Kovacevic Acked-by: David Hunt --- lib/librte_power/Makefile | 2 +- .../{rte_power_kvm_vm.c => power_kvm_vm.c} | 26 ++++++++--------- .../{rte_power_kvm_vm.h => power_kvm_vm.h} | 28 +++++++++---------- lib/librte_power/rte_power.c | 28 +++++++++---------- 4 files changed, 42 insertions(+), 42 deletions(-) rename lib/librte_power/{rte_power_kvm_vm.c => power_kvm_vm.c} (76%) rename lib/librte_power/{rte_power_kvm_vm.h => power_kvm_vm.h} (79%) diff --git a/lib/librte_power/Makefile b/lib/librte_power/Makefile index 686d540388..6f85e885d9 100644 --- a/lib/librte_power/Makefile +++ b/lib/librte_power/Makefile @@ -15,7 +15,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 76% rename from lib/librte_power/rte_power_kvm_vm.c rename to lib/librte_power/power_kvm_vm.c index caef4d92c7..38e9066f80 100644 --- a/lib/librte_power/rte_power_kvm_vm.c +++ b/lib/librte_power/power_kvm_vm.c @@ -8,7 +8,7 @@ #include "guest_channel.h" #include "channel_commands.h" -#include "rte_power_kvm_vm.h" +#include "power_kvm_vm.h" #include "power_common.h" #define FD_PATH "/dev/virtio-ports/virtio.serial.port.poweragent" @@ -17,7 +17,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", @@ -30,14 +30,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) { @@ -47,7 +47,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"); @@ -55,7 +55,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 " @@ -83,44 +83,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 79% rename from lib/librte_power/rte_power_kvm_vm.h rename to lib/librte_power/power_kvm_vm.h index 3d50c97f08..446d699777 100644 --- a/lib/librte_power/rte_power_kvm_vm.h +++ b/lib/librte_power/power_kvm_vm.h @@ -2,8 +2,8 @@ * Copyright(c) 2010-2014 Intel Corporation */ -#ifndef _RTE_POWER_KVM_VM_H -#define _RTE_POWER_KVM_VM_H +#ifndef _POWER_KVM_VM_H +#define _POWER_KVM_VM_H /** * @file @@ -29,7 +29,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. @@ -41,7 +41,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. @@ -57,7 +57,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); /** @@ -70,7 +70,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 @@ -85,7 +85,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 @@ -99,7 +99,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 @@ -113,7 +113,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 @@ -127,7 +127,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 @@ -141,7 +141,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. @@ -152,7 +152,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. @@ -164,7 +164,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. @@ -176,7 +176,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 f3ded21439..6c8fb4034a 100644 --- a/lib/librte_power/rte_power.c +++ b/lib/librte_power/rte_power.c @@ -6,7 +6,7 @@ #include "rte_power.h" #include "power_acpi_cpufreq.h" -#include "rte_power_kvm_vm.h" +#include "power_kvm_vm.h" #include "power_common.h" enum power_management_env global_default_env = PM_ENV_NOT_SET; @@ -43,16 +43,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); @@ -85,7 +85,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 " @@ -97,7 +97,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; @@ -114,7 +114,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"); -- 2.20.1