[dpdk-dev] [PATCH v3 4/4] power: clean up of kvm files

Marko Kovacevic marko.kovacevic at intel.com
Tue Dec 12 15:03:27 CET 2017


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_<function_name> to just <function_name>.
Reserve the rte_ for public functions

Signed-off-by: Marko Kovacevic <marko.kovacevic at intel.com>

Acked-By: David Hunt <david.hunt at intel.com>

---
 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} (84%)
 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 84%
rename from lib/librte_power/rte_power_kvm_vm.c
rename to lib/librte_power/power_kvm_vm.c
index 2acfa60..4b796f9 100644
--- a/lib/librte_power/rte_power_kvm_vm.c
+++ b/lib/librte_power/power_kvm_vm.c
@@ -37,7 +37,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"
@@ -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 71c1959..e76f3fd 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 "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");
-- 
2.9.5



More information about the dev mailing list