Skip to contentSkip to conversation

power: changed unsigned to unsigned int

PATCH Superseded Marko Kovacevic 4 participants 17 messages Nov 28, 2017 – Jan 11, 2018

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/4 power: changed unsigned to unsigned int

---
 lib/librte_power/guest_channel.c          |  6 +++---
 lib/librte_power/guest_channel.h          |  6 +++---
 lib/librte_power/rte_power.c              |  4 ++--
 lib/librte_power/rte_power.h              | 12 ++++++------
 lib/librte_power/rte_power_acpi_cpufreq.c | 16 ++++++++--------
 lib/librte_power/rte_power_kvm_vm.c       | 20 ++++++++++----------
 lib/librte_power/rte_power_kvm_vm.h       | 18 +++++++++---------
 7 files changed, 41 insertions(+), 41 deletions(-)
lib/librte_power/guest_channel.c +3 -3
index fa5de0f..e7ffc80 100644
@@ -51,7 +51,7 @@
 static int global_fds[RTE_MAX_LCORE];
 
 int
-guest_channel_host_connect(const char *path, unsigned lcore_id)
+guest_channel_host_connect(const char *path, unsigned int lcore_id)
 {
 	int flags, ret;
 	struct channel_packet pkt;
@@ -118,7 +118,7 @@ guest_channel_host_connect(const char *path, unsigned lcore_id)
 }
 
 int
-guest_channel_send_msg(struct channel_packet *pkt, unsigned lcore_id)
+guest_channel_send_msg(struct channel_packet *pkt, unsigned int lcore_id)
 {
 	int ret, buffer_len = sizeof(*pkt);
 	void *buffer = pkt;
@@ -156,7 +156,7 @@ int rte_power_guest_channel_send_msg(struct channel_packet *pkt,
 
 
 void
-guest_channel_host_disconnect(unsigned lcore_id)
+guest_channel_host_disconnect(unsigned int lcore_id)
 {
 	if (lcore_id >= RTE_MAX_LCORE) {
 		RTE_LOG(ERR, GUEST_CHANNEL, "Channel(%u) is out of range 0...%d\n",
lib/librte_power/guest_channel.h +3 -3
index 741339c..12c2587 100644
@@ -53,7 +53,7 @@ extern "C" {
  *  - 0 on success.
  *  - Negative on error.
  */
-int guest_channel_host_connect(const char *path, unsigned lcore_id);
+int guest_channel_host_connect(const char *path, unsigned int lcore_id);
 
 /**
  * Disconnect from an already connected Virtio-Serial Endpoint.
@@ -63,7 +63,7 @@ int guest_channel_host_connect(const char *path, unsigned lcore_id);
  *  lcore_id.
  *
  */
-void guest_channel_host_disconnect(unsigned lcore_id);
+void guest_channel_host_disconnect(unsigned int lcore_id);
 
 /**
  * Send a message contained in pkt over the Virtio-Serial to the host endpoint.
@@ -79,7 +79,7 @@ void guest_channel_host_disconnect(unsigned lcore_id);
  *  - Negative on channel not connected.
  *  - errno on write to channel error.
  */
-int guest_channel_send_msg(struct channel_packet *pkt, unsigned lcore_id);
+int guest_channel_send_msg(struct channel_packet *pkt, unsigned int lcore_id);
 
 /**
  * Send a message contained in pkt over the Virtio-Serial to the host endpoint.
lib/librte_power/rte_power.c +2 -2
index b327a86..e7f35cf 100644
@@ -106,7 +106,7 @@ rte_power_get_env(void) {
 }
 
 int
-rte_power_init(unsigned lcore_id)
+rte_power_init(unsigned int lcore_id)
 {
 	int ret = -1;
 
@@ -138,7 +138,7 @@ rte_power_init(unsigned lcore_id)
 }
 
 int
-rte_power_exit(unsigned lcore_id)
+rte_power_exit(unsigned int lcore_id)
 {
 	if (global_default_env == PM_ENV_ACPI_CPUFREQ)
 		return rte_power_acpi_cpufreq_exit(lcore_id);
lib/librte_power/rte_power.h +6 -6
index b17b7a5..9b54039 100644
@@ -91,7 +91,7 @@ enum power_management_env rte_power_get_env(void);
  *  - 0 on success.
  *  - Negative on error.
  */
-int rte_power_init(unsigned lcore_id);
+int rte_power_init(unsigned int lcore_id);
 
 /**
  * Exit power management on a specific lcore. This will call the environment
@@ -104,7 +104,7 @@ int rte_power_init(unsigned lcore_id);
  *  - 0 on success.
  *  - Negative on error.
  */
-int rte_power_exit(unsigned lcore_id);
+int rte_power_exit(unsigned int lcore_id);
 
 /**
  * Get the available frequencies of a specific lcore.
@@ -121,7 +121,7 @@ int rte_power_exit(unsigned lcore_id);
  * @return
  *  The number of available frequencies.
  */
-typedef uint32_t (*rte_power_freqs_t)(unsigned lcore_id, uint32_t *freqs,
+typedef uint32_t (*rte_power_freqs_t)(unsigned int lcore_id, uint32_t *freqs,
 		uint32_t num);
 
 extern rte_power_freqs_t rte_power_freqs;
@@ -137,7 +137,7 @@ extern rte_power_freqs_t rte_power_freqs;
  * @return
  *  The current index of available frequencies.
  */
-typedef uint32_t (*rte_power_get_freq_t)(unsigned lcore_id);
+typedef uint32_t (*rte_power_get_freq_t)(unsigned int lcore_id);
 
 extern rte_power_get_freq_t rte_power_get_freq;
 
@@ -157,7 +157,7 @@ extern rte_power_get_freq_t rte_power_get_freq;
  *  - 0 on success without frequency changed.
  *  - Negative on error.
  */
-typedef int (*rte_power_set_freq_t)(unsigned lcore_id, uint32_t index);
+typedef int (*rte_power_set_freq_t)(unsigned int lcore_id, uint32_t index);
 
 extern rte_power_set_freq_t rte_power_set_freq;
 
@@ -173,7 +173,7 @@ extern rte_power_set_freq_t rte_power_set_freq;
  *  - 0 on success without frequency changed.
  *  - Negative on error.
  */
-typedef int (*rte_power_freq_change_t)(unsigned lcore_id);
+typedef int (*rte_power_freq_change_t)(unsigned int lcore_id);
 
 /**
  * Scale up the frequency of a specific lcore according to the available
lib/librte_power/rte_power_acpi_cpufreq.c +8 -8
index 6b0cdb2..618bf45 100644
@@ -106,7 +106,7 @@ enum power_state {
  * Power info per lcore.
  */
 struct rte_power_info {
-	unsigned lcore_id;                   /**< Logical core id */
+	unsigned int lcore_id;                   /**< Logical core id */
 	uint32_t freqs[RTE_MAX_LCORE_FREQS]; /**< Frequency array */
 	uint32_t nb_freqs;                   /**< number of available freqs */
 	FILE *f;                             /**< FD of scaling_setspeed */
@@ -311,7 +311,7 @@ power_init_for_setting_freq(struct rte_power_info *pi)
 }
 
 int
-rte_power_acpi_cpufreq_init(unsigned lcore_id)
+rte_power_acpi_cpufreq_init(unsigned int lcore_id)
 {
 	struct rte_power_info *pi;
 
@@ -419,7 +419,7 @@ power_set_governor_original(struct rte_power_info *pi)
 }
 
 int
-rte_power_acpi_cpufreq_exit(unsigned lcore_id)
+rte_power_acpi_cpufreq_exit(unsigned int lcore_id)
 {
 	struct rte_power_info *pi;
 
@@ -481,7 +481,7 @@ rte_power_acpi_cpufreq_freqs(unsigned lcore_id, uint32_t *freqs, uint32_t num)
 }
 
 uint32_t
-rte_power_acpi_cpufreq_get_freq(unsigned lcore_id)
+rte_power_acpi_cpufreq_get_freq(unsigned int lcore_id)
 {
 	if (lcore_id >= RTE_MAX_LCORE) {
 		RTE_LOG(ERR, POWER, "Invalid lcore ID\n");
@@ -503,7 +503,7 @@ rte_power_acpi_cpufreq_set_freq(unsigned lcore_id, uint32_t index)
 }
 
 int
-rte_power_acpi_cpufreq_freq_down(unsigned lcore_id)
+rte_power_acpi_cpufreq_freq_down(unsigned int lcore_id)
 {
 	struct rte_power_info *pi;
 
@@ -521,7 +521,7 @@ rte_power_acpi_cpufreq_freq_down(unsigned lcore_id)
 }
 
 int
-rte_power_acpi_cpufreq_freq_up(unsigned lcore_id)
+rte_power_acpi_cpufreq_freq_up(unsigned int lcore_id)
 {
 	struct rte_power_info *pi;
 
@@ -539,7 +539,7 @@ rte_power_acpi_cpufreq_freq_up(unsigned lcore_id)
 }
 
 int
-rte_power_acpi_cpufreq_freq_max(unsigned lcore_id)
+rte_power_acpi_cpufreq_freq_max(unsigned int lcore_id)
 {
 	if (lcore_id >= RTE_MAX_LCORE) {
 		RTE_LOG(ERR, POWER, "Invalid lcore ID\n");
@@ -561,7 +561,7 @@ rte_power_acpi_cpufreq_freq_max(unsigned lcore_id)
 }
 
 int
-rte_power_acpi_cpufreq_freq_min(unsigned lcore_id)
+rte_power_acpi_cpufreq_freq_min(unsigned int lcore_id)
 {
 	struct rte_power_info *pi;
 
lib/librte_power/rte_power_kvm_vm.c +10 -10
index 9906062..52cac0c 100644
@@ -46,7 +46,7 @@ static struct channel_packet pkt[CHANNEL_CMDS_MAX_VM_CHANNELS];
 
 
 int
-rte_power_kvm_vm_init(unsigned lcore_id)
+rte_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 lcore_id)
 }
 
 int
-rte_power_kvm_vm_exit(unsigned lcore_id)
+rte_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 lcore_id,
+rte_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 lcore_id,
 }
 
 uint32_t
-rte_power_kvm_vm_get_freq(__attribute__((unused)) unsigned lcore_id)
+rte_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 lcore_id)
 }
 
 int
-rte_power_kvm_vm_set_freq(__attribute__((unused)) unsigned lcore_id,
+rte_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 "
@@ -93,7 +93,7 @@ rte_power_kvm_vm_set_freq(__attribute__((unused)) unsigned lcore_id,
 }
 
 static inline int
-send_msg(unsigned lcore_id, uint32_t scale_direction)
+send_msg(unsigned int lcore_id, uint32_t scale_direction)
 {
 	int ret;
 
@@ -112,25 +112,25 @@ send_msg(unsigned lcore_id, uint32_t scale_direction)
 }
 
 int
-rte_power_kvm_vm_freq_up(unsigned lcore_id)
+rte_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 lcore_id)
+rte_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 lcore_id)
+rte_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 lcore_id)
+rte_power_kvm_vm_freq_min(unsigned int lcore_id)
 {
 	return send_msg(lcore_id, CPU_POWER_SCALE_MIN);
 }
lib/librte_power/rte_power_kvm_vm.h +9 -9
index 9af41d6..96349c5 100644
@@ -58,7 +58,7 @@ extern "C" {
  *  - 0 on success.
  *  - Negative on error.
  */
-int rte_power_kvm_vm_init(unsigned lcore_id);
+int rte_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 lcore_id);
  *  - 0 on success.
  *  - Negative on error.
  */
-int rte_power_kvm_vm_exit(unsigned lcore_id);
+int rte_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 lcore_id);
  * @return
  *  -ENOTSUP
  */
-uint32_t rte_power_kvm_vm_freqs(unsigned lcore_id, uint32_t *freqs,
+uint32_t rte_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 lcore_id, uint32_t *freqs,
  * @return
  *  -ENOTSUP
  */
-uint32_t rte_power_kvm_vm_get_freq(unsigned lcore_id);
+uint32_t rte_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 lcore_id);
  * @return
  *  -ENOTSUP
  */
-int rte_power_kvm_vm_set_freq(unsigned lcore_id, uint32_t index);
+int rte_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 lcore_id, uint32_t index);
  *  - 1 on success.
  *  - Negative on error.
  */
-int rte_power_kvm_vm_freq_up(unsigned lcore_id);
+int rte_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 lcore_id);
  *  - 1 on success.
  *  - Negative on error.
  */
-int rte_power_kvm_vm_freq_down(unsigned lcore_id);
+int rte_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 lcore_id);
  *  - 1 on success.
  *  - Negative on error.
  */
-int rte_power_kvm_vm_freq_max(unsigned lcore_id);
+int rte_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 lcore_id);
  *  - 1 on success.
  *  - Negative on error.
  */
-int rte_power_kvm_vm_freq_min(unsigned lcore_id);
+int rte_power_kvm_vm_freq_min(unsigned int lcore_id);
 
 /**
  * It should be protected outside of this function for threadsafe.
Signature · 1 line
2.9.5
#1 lore raw

PATCH v2 2/4 power: clean up of acpi files

---
 lib/librte_power/Makefile                          |  2 +-
 ...e_power_acpi_cpufreq.c => power_acpi_cpufreq.c} | 32 +++++++++++-----------
 ...e_power_acpi_cpufreq.h => power_acpi_cpufreq.h} | 28 +++++++++----------
 lib/librte_power/rte_power.c                       | 28 +++++++++----------
 4 files changed, 45 insertions(+), 45 deletions(-)
 rename lib/librte_power/{rte_power_acpi_cpufreq.c => power_acpi_cpufreq.c} (94%)
 rename lib/librte_power/{rte_power_acpi_cpufreq.h => power_acpi_cpufreq.h} (88%)
lib/librte_power/Makefile +1 -1
index 1b1491d..bf5a55e 100644
@@ -42,7 +42,7 @@ EXPORT_MAP := rte_power_version.map
 LIBABIVER := 1
 
 # all source are stored in SRCS-y
-SRCS-$(CONFIG_RTE_LIBRTE_POWER) := rte_power.c rte_power_acpi_cpufreq.c
+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
 
 # install this header file
lib/librte_power/power_acpi_cpufreq.c renamed from lib/librte_power/rte_power_acpi_cpufreq.c +16 -16
similarity index 94%
rename from lib/librte_power/rte_power_acpi_cpufreq.c
rename to lib/librte_power/power_acpi_cpufreq.c
index 618bf45..165ec97 100644
@@ -44,7 +44,7 @@
 #include <rte_memcpy.h>
 #include <rte_atomic.h>
 
-#include "rte_power_acpi_cpufreq.h"
+#include "power_acpi_cpufreq.h"
 #include "rte_power_common.h"
 
 #ifdef RTE_LIBRTE_POWER_DEBUG
@@ -311,7 +311,7 @@ power_init_for_setting_freq(struct rte_power_info *pi)
 }
 
 int
-rte_power_acpi_cpufreq_init(unsigned int lcore_id)
+power_acpi_cpufreq_init(unsigned int lcore_id)
 {
 	struct rte_power_info *pi;
 
@@ -352,7 +352,7 @@ rte_power_acpi_cpufreq_init(unsigned int lcore_id)
 	}
 
 	/* Set freq to max by default */
-	if (rte_power_acpi_cpufreq_freq_max(lcore_id) < 0) {
+	if (power_acpi_cpufreq_freq_max(lcore_id) < 0) {
 		RTE_LOG(ERR, POWER, "Cannot set frequency of lcore %u "
 				"to max\n", lcore_id);
 		goto fail;
@@ -419,7 +419,7 @@ power_set_governor_original(struct rte_power_info *pi)
 }
 
 int
-rte_power_acpi_cpufreq_exit(unsigned int lcore_id)
+power_acpi_cpufreq_exit(unsigned int lcore_id)
 {
 	struct rte_power_info *pi;
 
@@ -461,7 +461,7 @@ rte_power_acpi_cpufreq_exit(unsigned int lcore_id)
 }
 
 uint32_t
-rte_power_acpi_cpufreq_freqs(unsigned lcore_id, uint32_t *freqs, uint32_t num)
+power_acpi_cpufreq_freqs(unsigned int lcore_id, uint32_t *freqs, uint32_t num)
 {
 	struct rte_power_info *pi;
 
@@ -481,7 +481,7 @@ rte_power_acpi_cpufreq_freqs(unsigned lcore_id, uint32_t *freqs, uint32_t num)
 }
 
 uint32_t
-rte_power_acpi_cpufreq_get_freq(unsigned int lcore_id)
+power_acpi_cpufreq_get_freq(unsigned int lcore_id)
 {
 	if (lcore_id >= RTE_MAX_LCORE) {
 		RTE_LOG(ERR, POWER, "Invalid lcore ID\n");
@@ -492,7 +492,7 @@ rte_power_acpi_cpufreq_get_freq(unsigned int lcore_id)
 }
 
 int
-rte_power_acpi_cpufreq_set_freq(unsigned lcore_id, uint32_t index)
+power_acpi_cpufreq_set_freq(unsigned int lcore_id, uint32_t index)
 {
 	if (lcore_id >= RTE_MAX_LCORE) {
 		RTE_LOG(ERR, POWER, "Invalid lcore ID\n");
@@ -503,7 +503,7 @@ rte_power_acpi_cpufreq_set_freq(unsigned lcore_id, uint32_t index)
 }
 
 int
-rte_power_acpi_cpufreq_freq_down(unsigned int lcore_id)
+power_acpi_cpufreq_freq_down(unsigned int lcore_id)
 {
 	struct rte_power_info *pi;
 
@@ -521,7 +521,7 @@ rte_power_acpi_cpufreq_freq_down(unsigned int lcore_id)
 }
 
 int
-rte_power_acpi_cpufreq_freq_up(unsigned int lcore_id)
+power_acpi_cpufreq_freq_up(unsigned int lcore_id)
 {
 	struct rte_power_info *pi;
 
@@ -539,7 +539,7 @@ rte_power_acpi_cpufreq_freq_up(unsigned int lcore_id)
 }
 
 int
-rte_power_acpi_cpufreq_freq_max(unsigned int lcore_id)
+power_acpi_cpufreq_freq_max(unsigned int lcore_id)
 {
 	if (lcore_id >= RTE_MAX_LCORE) {
 		RTE_LOG(ERR, POWER, "Invalid lcore ID\n");
@@ -561,7 +561,7 @@ rte_power_acpi_cpufreq_freq_max(unsigned int lcore_id)
 }
 
 int
-rte_power_acpi_cpufreq_freq_min(unsigned int lcore_id)
+power_acpi_cpufreq_freq_min(unsigned int lcore_id)
 {
 	struct rte_power_info *pi;
 
@@ -578,7 +578,7 @@ rte_power_acpi_cpufreq_freq_min(unsigned int lcore_id)
 
 
 int
-rte_power_acpi_turbo_status(unsigned int lcore_id)
+power_acpi_turbo_status(unsigned int lcore_id)
 {
 	struct rte_power_info *pi;
 
@@ -594,7 +594,7 @@ rte_power_acpi_turbo_status(unsigned int lcore_id)
 
 
 int
-rte_power_acpi_enable_turbo(unsigned int lcore_id)
+power_acpi_enable_turbo(unsigned int lcore_id)
 {
 	struct rte_power_info *pi;
 
@@ -616,7 +616,7 @@ rte_power_acpi_enable_turbo(unsigned int lcore_id)
 	}
 
 	/* Max may have changed, so call to max function */
-	if (rte_power_acpi_cpufreq_freq_max(lcore_id) < 0) {
+	if (power_acpi_cpufreq_freq_max(lcore_id) < 0) {
 		RTE_LOG(ERR, POWER,
 			"Failed to set frequency of lcore %u to max\n",
 			lcore_id);
@@ -627,7 +627,7 @@ rte_power_acpi_enable_turbo(unsigned int lcore_id)
 }
 
 int
-rte_power_acpi_disable_turbo(unsigned int lcore_id)
+power_acpi_disable_turbo(unsigned int lcore_id)
 {
 	struct rte_power_info *pi;
 
@@ -642,7 +642,7 @@ rte_power_acpi_disable_turbo(unsigned int lcore_id)
 
 	if ((pi->turbo_available) && (pi->curr_idx <= 1)) {
 		/* Try to set freq to max by default coming out of turbo */
-		if (rte_power_acpi_cpufreq_freq_max(lcore_id) < 0) {
+		if (power_acpi_cpufreq_freq_max(lcore_id) < 0) {
 			RTE_LOG(ERR, POWER,
 				"Failed to set frequency of lcore %u to max\n",
 				lcore_id);
lib/librte_power/power_acpi_cpufreq.h renamed from lib/librte_power/rte_power_acpi_cpufreq.h +14 -14
similarity index 88%
rename from lib/librte_power/rte_power_acpi_cpufreq.h
rename to lib/librte_power/power_acpi_cpufreq.h
index bc20dfd..3933fc4 100644
@@ -31,8 +31,8 @@
  *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef _RTE_POWER_ACPI_CPUFREQ_H
-#define _RTE_POWER_ACPI_CPUFREQ_H
+#ifndef _POWER_ACPI_CPUFREQ_H
+#define _POWER_ACPI_CPUFREQ_H
 
 /**
  * @file
@@ -60,7 +60,7 @@ extern "C" {
  *  - 0 on success.
  *  - Negative on error.
  */
-int rte_power_acpi_cpufreq_init(unsigned lcore_id);
+int power_acpi_cpufreq_init(unsigned int lcore_id);
 
 /**
  * Exit power management on a specific lcore. It will set the governor to which
@@ -73,7 +73,7 @@ int rte_power_acpi_cpufreq_init(unsigned lcore_id);
  *  - 0 on success.
  *  - Negative on error.
  */
-int rte_power_acpi_cpufreq_exit(unsigned lcore_id);
+int power_acpi_cpufreq_exit(unsigned int lcore_id);
 
 /**
  * Get the available frequencies of a specific lcore. The return value will be
@@ -92,7 +92,7 @@ int rte_power_acpi_cpufreq_exit(unsigned lcore_id);
  * @return
  *  The number of available frequencies.
  */
-uint32_t rte_power_acpi_cpufreq_freqs(unsigned lcore_id, uint32_t *freqs,
+uint32_t power_acpi_cpufreq_freqs(unsigned int lcore_id, uint32_t *freqs,
 		uint32_t num);
 
 /**
@@ -106,7 +106,7 @@ uint32_t rte_power_acpi_cpufreq_freqs(unsigned lcore_id, uint32_t *freqs,
  * @return
  *  The current index of available frequencies.
  */
-uint32_t rte_power_acpi_cpufreq_get_freq(unsigned lcore_id);
+uint32_t power_acpi_cpufreq_get_freq(unsigned int lcore_id);
 
 /**
  * Set the new frequency for a specific lcore by indicating the index of
@@ -123,7 +123,7 @@ uint32_t rte_power_acpi_cpufreq_get_freq(unsigned lcore_id);
  *  - 0 on success without frequency changed.
  *  - Negative on error.
  */
-int rte_power_acpi_cpufreq_set_freq(unsigned lcore_id, uint32_t index);
+int power_acpi_cpufreq_set_freq(unsigned int lcore_id, uint32_t index);
 
 /**
  * Scale up the frequency of a specific lcore according to the available
@@ -138,7 +138,7 @@ int rte_power_acpi_cpufreq_set_freq(unsigned lcore_id, uint32_t index);
  *  - 0 on success without frequency changed.
  *  - Negative on error.
  */
-int rte_power_acpi_cpufreq_freq_up(unsigned lcore_id);
+int power_acpi_cpufreq_freq_up(unsigned int lcore_id);
 
 /**
  * Scale down the frequency of a specific lcore according to the available
@@ -153,7 +153,7 @@ int rte_power_acpi_cpufreq_freq_up(unsigned lcore_id);
  *  - 0 on success without frequency changed.
  *  - Negative on error.
  */
-int rte_power_acpi_cpufreq_freq_down(unsigned lcore_id);
+int power_acpi_cpufreq_freq_down(unsigned int lcore_id);
 
 /**
  * Scale up the frequency of a specific lcore to the highest according to the
@@ -168,7 +168,7 @@ int rte_power_acpi_cpufreq_freq_down(unsigned lcore_id);
  *  - 0 on success without frequency changed.
  *  - Negative on error.
  */
-int rte_power_acpi_cpufreq_freq_max(unsigned lcore_id);
+int power_acpi_cpufreq_freq_max(unsigned int lcore_id);
 
 /**
  * Scale down the frequency of a specific lcore to the lowest according to the
@@ -183,7 +183,7 @@ int rte_power_acpi_cpufreq_freq_max(unsigned lcore_id);
  *  - 0 on success without frequency changed.
  *  - Negative on error.
  */
-int rte_power_acpi_cpufreq_freq_min(unsigned lcore_id);
+int power_acpi_cpufreq_freq_min(unsigned int lcore_id);
 
 /**
  * Get the turbo status of a specific lcore.
@@ -197,7 +197,7 @@ int rte_power_acpi_cpufreq_freq_min(unsigned lcore_id);
  *  - 0 Turbo Boost is disabled on this lcore.
  *  - Negative on error.
  */
-int rte_power_acpi_turbo_status(unsigned int lcore_id);
+int power_acpi_turbo_status(unsigned int lcore_id);
 
 /**
  * Enable Turbo Boost on a specific lcore.
@@ -210,7 +210,7 @@ int rte_power_acpi_turbo_status(unsigned int lcore_id);
  *  - 0 Turbo Boost is enabled successfully on this lcore.
  *  - Negative on error.
  */
-int rte_power_acpi_enable_turbo(unsigned int lcore_id);
+int power_acpi_enable_turbo(unsigned int lcore_id);
 
 /**
  * Disable Turbo Boost on a specific lcore.
@@ -223,7 +223,7 @@ int rte_power_acpi_enable_turbo(unsigned int lcore_id);
  *  - 0 Turbo Boost disabled successfully on this lcore.
  *  - Negative on error.
  */
-int rte_power_acpi_disable_turbo(unsigned int lcore_id);
+int power_acpi_disable_turbo(unsigned int lcore_id);
 
 #ifdef __cplusplus
 }
lib/librte_power/rte_power.c +14 -14
index e7f35cf..db6f4a9 100644
@@ -34,7 +34,7 @@
 #include <rte_atomic.h>
 
 #include "rte_power.h"
-#include "rte_power_acpi_cpufreq.h"
+#include "power_acpi_cpufreq.h"
 #include "rte_power_kvm_vm.h"
 #include "rte_power_common.h"
 
@@ -61,16 +61,16 @@ rte_power_set_env(enum power_management_env env)
 		return 0;
 	}
 	if (env == PM_ENV_ACPI_CPUFREQ) {
-		rte_power_freqs = rte_power_acpi_cpufreq_freqs;
-		rte_power_get_freq = rte_power_acpi_cpufreq_get_freq;
-		rte_power_set_freq = rte_power_acpi_cpufreq_set_freq;
-		rte_power_freq_up = rte_power_acpi_cpufreq_freq_up;
-		rte_power_freq_down = rte_power_acpi_cpufreq_freq_down;
-		rte_power_freq_min = rte_power_acpi_cpufreq_freq_min;
-		rte_power_freq_max = rte_power_acpi_cpufreq_freq_max;
-		rte_power_turbo_status = rte_power_acpi_turbo_status;
-		rte_power_freq_enable_turbo = rte_power_acpi_enable_turbo;
-		rte_power_freq_disable_turbo = rte_power_acpi_disable_turbo;
+		rte_power_freqs = power_acpi_cpufreq_freqs;
+		rte_power_get_freq = power_acpi_cpufreq_get_freq;
+		rte_power_set_freq = power_acpi_cpufreq_set_freq;
+		rte_power_freq_up = power_acpi_cpufreq_freq_up;
+		rte_power_freq_down = power_acpi_cpufreq_freq_down;
+		rte_power_freq_min = power_acpi_cpufreq_freq_min;
+		rte_power_freq_max = power_acpi_cpufreq_freq_max;
+		rte_power_turbo_status = power_acpi_turbo_status;
+		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;
@@ -111,7 +111,7 @@ rte_power_init(unsigned int lcore_id)
 	int ret = -1;
 
 	if (global_default_env == PM_ENV_ACPI_CPUFREQ) {
-		return rte_power_acpi_cpufreq_init(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);
@@ -119,7 +119,7 @@ rte_power_init(unsigned int lcore_id)
 	/* Auto detect Environment */
 	RTE_LOG(INFO, POWER, "Attempting to initialise ACPI cpufreq power "
 			"management...\n");
-	ret = rte_power_acpi_cpufreq_init(lcore_id);
+	ret = power_acpi_cpufreq_init(lcore_id);
 	if (ret == 0) {
 		rte_power_set_env(PM_ENV_ACPI_CPUFREQ);
 		goto out;
@@ -141,7 +141,7 @@ int
 rte_power_exit(unsigned int lcore_id)
 {
 	if (global_default_env == PM_ENV_ACPI_CPUFREQ)
-		return rte_power_acpi_cpufreq_exit(lcore_id);
+		return power_acpi_cpufreq_exit(lcore_id);
 	if (global_default_env == PM_ENV_KVM_VM)
 		return rte_power_kvm_vm_exit(lcore_id);
 
Signature · 1 line
2.9.5
#2 lore raw

Re: [PATCH v2 2/4] power: clean up of acpi files

Quoted 2 lines · Marko Kovacevic

---

Please include a description of the work involved in the "cleanup". Makes life easier for reviewers to know what to expect and check that nothing was missed.

Thanks,
/Bruce

#3 lore raw

Re: [PATCH v2 2/4] power: clean up of acpi files

Apologies for not clearing up what was in the clean up. In the cleanups i have removed "rte_" from the file names and also variable names as the issue was that many APIs were exposed in the documentation. In doing so it leaves rte_power.h as the only header file that's installed.

Quoted 9 lines · Bruce Richardson
Quoted 2 lines · Marko Kovacevic

---

Please include a description of the work involved in the "cleanup". Makes life easier for reviewers to know what to expect and check that nothing was missed.

Thanks,
/Bruce

#4 lore raw

Re: [PATCH v2 2/4] power: clean up of acpi files

In reply to Marko Kovacevic

Hi Marko,

lib/librte_power/power_acpi_cpufreq.c

Quoted 27 lines · Marko Kovacevic
---
  lib/librte_power/Makefile                          |  2 +-
  ...e_power_acpi_cpufreq.c => power_acpi_cpufreq.c} | 32 +++++++++++-----------
  ...e_power_acpi_cpufreq.h => power_acpi_cpufreq.h} | 28 +++++++++----------
  lib/librte_power/rte_power.c                       | 28 +++++++++----------
  4 files changed, 45 insertions(+), 45 deletions(-)

rename lib/librte_power/{rte_power_acpi_cpufreq.c => power_acpi_cpufreq.c} (94%) rename lib/librte_power/{rte_power_acpi_cpufreq.h => power_acpi_cpufreq.h} (88%)

lib/librte_power/Makefile +1 -1
index 1b1491d..bf5a55e 100644
@@ -42,7 +42,7 @@ EXPORT_MAP := rte_power_version.map
  LIBABIVER := 1
 
  # all source are stored in SRCS-y
-SRCS-$(CONFIG_RTE_LIBRTE_POWER) := rte_power.c rte_power_acpi_cpufreq.c
+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
 
  # install this header file
lib/librte_power/power_acpi_cpufreq.c renamed from lib/librte_power/rte_power_acpi_cpufreq.c +0 -0
similarity index 94%
rename from lib/librte_power/rte_power_acpi_cpufreq.c
rename to lib/librte_power/power_acpi_cpufreq.c

--snip--

Could I suggest adding the following to the commit message?

"Rename private header file rte_power_acpi_cpufreq.c to power_acpi_cpufreq.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. "

Regards,
Dave.

#5 lore raw

PATCH v2 3/4 power: clean up of kvm files

In reply to Marko Kovacevic
---
 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%)
lib/librte_power/Makefile +1 -1
index bf5a55e..a35c50a 100644
@@ -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
lib/librte_power/power_kvm_vm.c renamed from lib/librte_power/rte_power_kvm_vm.c +14 -14
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
@@ -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);
 }
lib/librte_power/power_kvm_vm.h renamed from lib/librte_power/rte_power_kvm_vm.h +14 -14
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
@@ -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
lib/librte_power/rte_power.c +14 -14
index db6f4a9..af9b504 100644
@@ -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");
Signature · 1 line
2.9.5
#6 lore raw

Re: [PATCH v2 3/4] power: clean up of kvm files

Hi Marko,

lib/librte_power/power_kvm_vm.c

Quoted 28 lines · Marko Kovacevic
---
  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%)

lib/librte_power/Makefile +1 -1
index bf5a55e..a35c50a 100644
@@ -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
lib/librte_power/power_kvm_vm.c renamed from lib/librte_power/rte_power_kvm_vm.c +0 -0
similarity index 83%
rename from lib/librte_power/rte_power_kvm_vm.c
rename to lib/librte_power/power_kvm_vm.c

--snip--

Could I suggest you add the following into the commit message?

"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. "

Regards,
Dave.

#7 lore raw

PATCH v2 4/4 power: clean up of power common header

In reply to Marko Kovacevic
---
 lib/librte_power/power_acpi_cpufreq.c                   | 2 +-
 lib/librte_power/{rte_power_common.h => power_common.h} | 6 +++---
 lib/librte_power/rte_power.c                            | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)
 rename lib/librte_power/{rte_power_common.h => power_common.h} (95%)
lib/librte_power/power_acpi_cpufreq.c +1 -1
index 165ec97..fd1931f 100644
@@ -45,7 +45,7 @@
 #include <rte_atomic.h>
 
 #include "power_acpi_cpufreq.h"
-#include "rte_power_common.h"
+#include "power_common.h"
 
 #ifdef RTE_LIBRTE_POWER_DEBUG
 #define POWER_DEBUG_TRACE(fmt, args...) do { \
lib/librte_power/power_common.h renamed from lib/librte_power/rte_power_common.h +3 -3
similarity index 95%
rename from lib/librte_power/rte_power_common.h
rename to lib/librte_power/power_common.h
index 64bd168..cbf3b7f 100644
@@ -31,9 +31,9 @@
  *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef RTE_POWER_COMMON_H_
-#define RTE_POWER_COMMON_H_
+#ifndef _POWER_COMMON_H_
+#define _POWER_COMMON_H_
 
 #define RTE_POWER_INVALID_FREQ_INDEX (~0)
 
-#endif /* RTE_POWER_COMMON_H_ */
+#endif /* POWER_COMMON_H_ */
lib/librte_power/rte_power.c +1 -1
index af9b504..e76f3fd 100644
@@ -36,7 +36,7 @@
 #include "rte_power.h"
 #include "power_acpi_cpufreq.h"
 #include "power_kvm_vm.h"
-#include "rte_power_common.h"
+#include "power_common.h"
 
 enum power_management_env global_default_env = PM_ENV_NOT_SET;
 
Signature · 1 line
2.9.5
#8 lore raw

Re: [PATCH v2 4/4] power: clean up of power common header

Hi Marko,

lib/librte_power/power_common.h

Quoted 26 lines · Marko Kovacevic
---
  lib/librte_power/power_acpi_cpufreq.c                   | 2 +-
  lib/librte_power/{rte_power_common.h => power_common.h} | 6 +++---
  lib/librte_power/rte_power.c                            | 2 +-
  3 files changed, 5 insertions(+), 5 deletions(-)

rename lib/librte_power/{rte_power_common.h => power_common.h} (95%)

lib/librte_power/power_acpi_cpufreq.c +1 -1
index 165ec97..fd1931f 100644
@@ -45,7 +45,7 @@
  #include <rte_atomic.h>
 
  #include "power_acpi_cpufreq.h"
-#include "rte_power_common.h"
+#include "power_common.h"
 
  #ifdef RTE_LIBRTE_POWER_DEBUG
  #define POWER_DEBUG_TRACE(fmt, args...) do { \
lib/librte_power/power_common.h renamed from lib/librte_power/rte_power_common.h +0 -0
similarity index 95%
rename from lib/librte_power/rte_power_common.h
rename to lib/librte_power/power_common.h

--snip--

Could I suggest adding the following into the commit message?

"Rename private header file rte_power_common.h to power_common.h to prevent private functions from leaking into the documentation."

Apart from that, if you make those changes, you can include my Ack in the next revision.

#10 lore raw

As i saw that many other variables were changed from unsigned to unsigned int and since i was cleaning up the code i thought it would be beneficial to change it now not to cause checkpatch problems or other problems down the line.

Marko

Quoted 1 line · Bruce Richardson

On Tue, Nov 28, 2017 at 01:22:00PM +0000, Marko Kovacevic wrote: >> Signed-off-by: Marko Kovacevic <[email protected]> --- >

While I know that checkpatch complains about unsigned vs unsigned > int, is there some other reason for making this change wholesale in > the code? > > /Bruce

#11 lore raw
In reply to Marko Kovacevic

Hi Marko,

On 28/11/2017 1:22 PM, Marko Kovacevic wrote:

--snip--

lib/librte_power/guest_channel.c line 54

Quoted 4 lines

int

lib/librte_power/guest_channel.c +1 -1
-guest_channel_host_connect(const char *path, unsigned lcore_id)
+guest_channel_host_connect(const char *path, unsigned int lcore_id)

--snip--

I'd suggest adding the following into the commit message. It would help explain why you're doing all the "unsigned" to "unsigned int" changes up front rather than including them in the other patches.

"Since this patch-set attempts to clean up the power library, and there are many instances of "unsigned" caught by checkpatch, it was decided to clean these up first rather than have them included in the later patches in the patch set. And would also minimise this type of error being caught by checkpatch in the future."

Regards,
Dave.

#12 lore raw

PATCH v3 1/4 power: changed unsigned to unsigned int

In reply to Marko Kovacevic

Since this patch-set attempts to clean up the power library, and there are many instances of "unsigned" caught by checkpatch, it was decided to clean these up first rather than have them included in the later patches in the patch set. And would also minimise this type of error being caught by checkpatch in the future

---
 lib/librte_power/guest_channel.c          |  6 +++---
 lib/librte_power/guest_channel.h          |  6 +++---
 lib/librte_power/rte_power.c              |  4 ++--
 lib/librte_power/rte_power.h              | 12 ++++++------
 lib/librte_power/rte_power_acpi_cpufreq.c | 16 ++++++++--------
 lib/librte_power/rte_power_kvm_vm.c       | 20 ++++++++++----------
 lib/librte_power/rte_power_kvm_vm.h       | 18 +++++++++---------
 7 files changed, 41 insertions(+), 41 deletions(-)
lib/librte_power/guest_channel.c +3 -3
index fa5de0f..e7ffc80 100644
@@ -51,7 +51,7 @@
 static int global_fds[RTE_MAX_LCORE];
 
 int
-guest_channel_host_connect(const char *path, unsigned lcore_id)
+guest_channel_host_connect(const char *path, unsigned int lcore_id)
 {
 	int flags, ret;
 	struct channel_packet pkt;
@@ -118,7 +118,7 @@ guest_channel_host_connect(const char *path, unsigned lcore_id)
 }
 
 int
-guest_channel_send_msg(struct channel_packet *pkt, unsigned lcore_id)
+guest_channel_send_msg(struct channel_packet *pkt, unsigned int lcore_id)
 {
 	int ret, buffer_len = sizeof(*pkt);
 	void *buffer = pkt;
@@ -156,7 +156,7 @@ int rte_power_guest_channel_send_msg(struct channel_packet *pkt,
 
 
 void
-guest_channel_host_disconnect(unsigned lcore_id)
+guest_channel_host_disconnect(unsigned int lcore_id)
 {
 	if (lcore_id >= RTE_MAX_LCORE) {
 		RTE_LOG(ERR, GUEST_CHANNEL, "Channel(%u) is out of range 0...%d\n",
lib/librte_power/guest_channel.h +3 -3
index 741339c..12c2587 100644
@@ -53,7 +53,7 @@ extern "C" {
  *  - 0 on success.
  *  - Negative on error.
  */
-int guest_channel_host_connect(const char *path, unsigned lcore_id);
+int guest_channel_host_connect(const char *path, unsigned int lcore_id);
 
 /**
  * Disconnect from an already connected Virtio-Serial Endpoint.
@@ -63,7 +63,7 @@ int guest_channel_host_connect(const char *path, unsigned lcore_id);
  *  lcore_id.
  *
  */
-void guest_channel_host_disconnect(unsigned lcore_id);
+void guest_channel_host_disconnect(unsigned int lcore_id);
 
 /**
  * Send a message contained in pkt over the Virtio-Serial to the host endpoint.
@@ -79,7 +79,7 @@ void guest_channel_host_disconnect(unsigned lcore_id);
  *  - Negative on channel not connected.
  *  - errno on write to channel error.
  */
-int guest_channel_send_msg(struct channel_packet *pkt, unsigned lcore_id);
+int guest_channel_send_msg(struct channel_packet *pkt, unsigned int lcore_id);
 
 /**
  * Send a message contained in pkt over the Virtio-Serial to the host endpoint.
lib/librte_power/rte_power.c +2 -2
index b327a86..e7f35cf 100644
@@ -106,7 +106,7 @@ rte_power_get_env(void) {
 }
 
 int
-rte_power_init(unsigned lcore_id)
+rte_power_init(unsigned int lcore_id)
 {
 	int ret = -1;
 
@@ -138,7 +138,7 @@ rte_power_init(unsigned lcore_id)
 }
 
 int
-rte_power_exit(unsigned lcore_id)
+rte_power_exit(unsigned int lcore_id)
 {
 	if (global_default_env == PM_ENV_ACPI_CPUFREQ)
 		return rte_power_acpi_cpufreq_exit(lcore_id);
lib/librte_power/rte_power.h +6 -6
index b17b7a5..9b54039 100644
@@ -91,7 +91,7 @@ enum power_management_env rte_power_get_env(void);
  *  - 0 on success.
  *  - Negative on error.
  */
-int rte_power_init(unsigned lcore_id);
+int rte_power_init(unsigned int lcore_id);
 
 /**
  * Exit power management on a specific lcore. This will call the environment
@@ -104,7 +104,7 @@ int rte_power_init(unsigned lcore_id);
  *  - 0 on success.
  *  - Negative on error.
  */
-int rte_power_exit(unsigned lcore_id);
+int rte_power_exit(unsigned int lcore_id);
 
 /**
  * Get the available frequencies of a specific lcore.
@@ -121,7 +121,7 @@ int rte_power_exit(unsigned lcore_id);
  * @return
  *  The number of available frequencies.
  */
-typedef uint32_t (*rte_power_freqs_t)(unsigned lcore_id, uint32_t *freqs,
+typedef uint32_t (*rte_power_freqs_t)(unsigned int lcore_id, uint32_t *freqs,
 		uint32_t num);
 
 extern rte_power_freqs_t rte_power_freqs;
@@ -137,7 +137,7 @@ extern rte_power_freqs_t rte_power_freqs;
  * @return
  *  The current index of available frequencies.
  */
-typedef uint32_t (*rte_power_get_freq_t)(unsigned lcore_id);
+typedef uint32_t (*rte_power_get_freq_t)(unsigned int lcore_id);
 
 extern rte_power_get_freq_t rte_power_get_freq;
 
@@ -157,7 +157,7 @@ extern rte_power_get_freq_t rte_power_get_freq;
  *  - 0 on success without frequency changed.
  *  - Negative on error.
  */
-typedef int (*rte_power_set_freq_t)(unsigned lcore_id, uint32_t index);
+typedef int (*rte_power_set_freq_t)(unsigned int lcore_id, uint32_t index);
 
 extern rte_power_set_freq_t rte_power_set_freq;
 
@@ -173,7 +173,7 @@ extern rte_power_set_freq_t rte_power_set_freq;
  *  - 0 on success without frequency changed.
  *  - Negative on error.
  */
-typedef int (*rte_power_freq_change_t)(unsigned lcore_id);
+typedef int (*rte_power_freq_change_t)(unsigned int lcore_id);
 
 /**
  * Scale up the frequency of a specific lcore according to the available
lib/librte_power/rte_power_acpi_cpufreq.c +8 -8
index 6b0cdb2..618bf45 100644
@@ -106,7 +106,7 @@ enum power_state {
  * Power info per lcore.
  */
 struct rte_power_info {
-	unsigned lcore_id;                   /**< Logical core id */
+	unsigned int lcore_id;                   /**< Logical core id */
 	uint32_t freqs[RTE_MAX_LCORE_FREQS]; /**< Frequency array */
 	uint32_t nb_freqs;                   /**< number of available freqs */
 	FILE *f;                             /**< FD of scaling_setspeed */
@@ -311,7 +311,7 @@ power_init_for_setting_freq(struct rte_power_info *pi)
 }
 
 int
-rte_power_acpi_cpufreq_init(unsigned lcore_id)
+rte_power_acpi_cpufreq_init(unsigned int lcore_id)
 {
 	struct rte_power_info *pi;
 
@@ -419,7 +419,7 @@ power_set_governor_original(struct rte_power_info *pi)
 }
 
 int
-rte_power_acpi_cpufreq_exit(unsigned lcore_id)
+rte_power_acpi_cpufreq_exit(unsigned int lcore_id)
 {
 	struct rte_power_info *pi;
 
@@ -481,7 +481,7 @@ rte_power_acpi_cpufreq_freqs(unsigned lcore_id, uint32_t *freqs, uint32_t num)
 }
 
 uint32_t
-rte_power_acpi_cpufreq_get_freq(unsigned lcore_id)
+rte_power_acpi_cpufreq_get_freq(unsigned int lcore_id)
 {
 	if (lcore_id >= RTE_MAX_LCORE) {
 		RTE_LOG(ERR, POWER, "Invalid lcore ID\n");
@@ -503,7 +503,7 @@ rte_power_acpi_cpufreq_set_freq(unsigned lcore_id, uint32_t index)
 }
 
 int
-rte_power_acpi_cpufreq_freq_down(unsigned lcore_id)
+rte_power_acpi_cpufreq_freq_down(unsigned int lcore_id)
 {
 	struct rte_power_info *pi;
 
@@ -521,7 +521,7 @@ rte_power_acpi_cpufreq_freq_down(unsigned lcore_id)
 }
 
 int
-rte_power_acpi_cpufreq_freq_up(unsigned lcore_id)
+rte_power_acpi_cpufreq_freq_up(unsigned int lcore_id)
 {
 	struct rte_power_info *pi;
 
@@ -539,7 +539,7 @@ rte_power_acpi_cpufreq_freq_up(unsigned lcore_id)
 }
 
 int
-rte_power_acpi_cpufreq_freq_max(unsigned lcore_id)
+rte_power_acpi_cpufreq_freq_max(unsigned int lcore_id)
 {
 	if (lcore_id >= RTE_MAX_LCORE) {
 		RTE_LOG(ERR, POWER, "Invalid lcore ID\n");
@@ -561,7 +561,7 @@ rte_power_acpi_cpufreq_freq_max(unsigned lcore_id)
 }
 
 int
-rte_power_acpi_cpufreq_freq_min(unsigned lcore_id)
+rte_power_acpi_cpufreq_freq_min(unsigned int lcore_id)
 {
 	struct rte_power_info *pi;
 
lib/librte_power/rte_power_kvm_vm.c +10 -10
index 9906062..52cac0c 100644
@@ -46,7 +46,7 @@ static struct channel_packet pkt[CHANNEL_CMDS_MAX_VM_CHANNELS];
 
 
 int
-rte_power_kvm_vm_init(unsigned lcore_id)
+rte_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 lcore_id)
 }
 
 int
-rte_power_kvm_vm_exit(unsigned lcore_id)
+rte_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 lcore_id,
+rte_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 lcore_id,
 }
 
 uint32_t
-rte_power_kvm_vm_get_freq(__attribute__((unused)) unsigned lcore_id)
+rte_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 lcore_id)
 }
 
 int
-rte_power_kvm_vm_set_freq(__attribute__((unused)) unsigned lcore_id,
+rte_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 "
@@ -93,7 +93,7 @@ rte_power_kvm_vm_set_freq(__attribute__((unused)) unsigned lcore_id,
 }
 
 static inline int
-send_msg(unsigned lcore_id, uint32_t scale_direction)
+send_msg(unsigned int lcore_id, uint32_t scale_direction)
 {
 	int ret;
 
@@ -112,25 +112,25 @@ send_msg(unsigned lcore_id, uint32_t scale_direction)
 }
 
 int
-rte_power_kvm_vm_freq_up(unsigned lcore_id)
+rte_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 lcore_id)
+rte_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 lcore_id)
+rte_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 lcore_id)
+rte_power_kvm_vm_freq_min(unsigned int lcore_id)
 {
 	return send_msg(lcore_id, CPU_POWER_SCALE_MIN);
 }
lib/librte_power/rte_power_kvm_vm.h +9 -9
index 9af41d6..96349c5 100644
@@ -58,7 +58,7 @@ extern "C" {
  *  - 0 on success.
  *  - Negative on error.
  */
-int rte_power_kvm_vm_init(unsigned lcore_id);
+int rte_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 lcore_id);
  *  - 0 on success.
  *  - Negative on error.
  */
-int rte_power_kvm_vm_exit(unsigned lcore_id);
+int rte_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 lcore_id);
  * @return
  *  -ENOTSUP
  */
-uint32_t rte_power_kvm_vm_freqs(unsigned lcore_id, uint32_t *freqs,
+uint32_t rte_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 lcore_id, uint32_t *freqs,
  * @return
  *  -ENOTSUP
  */
-uint32_t rte_power_kvm_vm_get_freq(unsigned lcore_id);
+uint32_t rte_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 lcore_id);
  * @return
  *  -ENOTSUP
  */
-int rte_power_kvm_vm_set_freq(unsigned lcore_id, uint32_t index);
+int rte_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 lcore_id, uint32_t index);
  *  - 1 on success.
  *  - Negative on error.
  */
-int rte_power_kvm_vm_freq_up(unsigned lcore_id);
+int rte_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 lcore_id);
  *  - 1 on success.
  *  - Negative on error.
  */
-int rte_power_kvm_vm_freq_down(unsigned lcore_id);
+int rte_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 lcore_id);
  *  - 1 on success.
  *  - Negative on error.
  */
-int rte_power_kvm_vm_freq_max(unsigned lcore_id);
+int rte_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 lcore_id);
  *  - 1 on success.
  *  - Negative on error.
  */
-int rte_power_kvm_vm_freq_min(unsigned lcore_id);
+int rte_power_kvm_vm_freq_min(unsigned int lcore_id);
 
 /**
  * It should be protected outside of this function for threadsafe.
Signature · 1 line
2.9.5
#13 lore raw

PATCH v3 2/4 power: clean up of power common header

Rename private header file rte_power_common.h
to power_common.h to prevent private functions
from leaking into the documentation.

---
 lib/librte_power/{rte_power_common.h => power_common.h} | 6 +++---
 lib/librte_power/rte_power.c                            | 2 +-
 lib/librte_power/rte_power_acpi_cpufreq.c               | 2 +-
 lib/librte_power/rte_power_kvm_vm.c                     | 2 +-
 4 files changed, 6 insertions(+), 6 deletions(-)
 rename lib/librte_power/{rte_power_common.h => power_common.h} (95%)
lib/librte_power/power_common.h renamed from lib/librte_power/rte_power_common.h +3 -3
similarity index 95%
rename from lib/librte_power/rte_power_common.h
rename to lib/librte_power/power_common.h
index 64bd168..43e6564 100644
@@ -31,9 +31,9 @@
  *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef RTE_POWER_COMMON_H_
-#define RTE_POWER_COMMON_H_
+#ifndef _POWER_COMMON_H_
+#define _POWER_COMMON_H_
 
 #define RTE_POWER_INVALID_FREQ_INDEX (~0)
 
-#endif /* RTE_POWER_COMMON_H_ */
+#endif /* _POWER_COMMON_H_ */
lib/librte_power/rte_power.c +1 -1
index e7f35cf..c363667 100644
@@ -36,7 +36,7 @@
 #include "rte_power.h"
 #include "rte_power_acpi_cpufreq.h"
 #include "rte_power_kvm_vm.h"
-#include "rte_power_common.h"
+#include "power_common.h"
 
 enum power_management_env global_default_env = PM_ENV_NOT_SET;
 
lib/librte_power/rte_power_acpi_cpufreq.c +1 -1
index 618bf45..755dfff 100644
@@ -45,7 +45,7 @@
 #include <rte_atomic.h>
 
 #include "rte_power_acpi_cpufreq.h"
-#include "rte_power_common.h"
+#include "power_common.h"
 
 #ifdef RTE_LIBRTE_POWER_DEBUG
 #define POWER_DEBUG_TRACE(fmt, args...) do { \
lib/librte_power/rte_power_kvm_vm.c +1 -1
index 52cac0c..2acfa60 100644
@@ -38,7 +38,7 @@
 #include "guest_channel.h"
 #include "channel_commands.h"
 #include "rte_power_kvm_vm.h"
-#include "rte_power_common.h"
+#include "power_common.h"
 
 #define FD_PATH "/dev/virtio-ports/virtio.serial.port.poweragent"
 
Signature · 1 line
2.9.5
#14 lore raw

PATCH v3 3/4 power: clean up of acpi files

In reply to Marko Kovacevic

Rename private header file rte_power_acpi_cpufreq.c to power_acpi_cpufreq.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.

---
 lib/librte_power/Makefile                          |  2 +-
 ...e_power_acpi_cpufreq.c => power_acpi_cpufreq.c} | 32 +++++++++++-----------
 ...e_power_acpi_cpufreq.h => power_acpi_cpufreq.h} | 28 +++++++++----------
 lib/librte_power/rte_power.c                       | 28 +++++++++----------
 4 files changed, 45 insertions(+), 45 deletions(-)
 rename lib/librte_power/{rte_power_acpi_cpufreq.c => power_acpi_cpufreq.c} (94%)
 rename lib/librte_power/{rte_power_acpi_cpufreq.h => power_acpi_cpufreq.h} (88%)
lib/librte_power/Makefile +1 -1
index 1b1491d..bf5a55e 100644
@@ -42,7 +42,7 @@ EXPORT_MAP := rte_power_version.map
 LIBABIVER := 1
 
 # all source are stored in SRCS-y
-SRCS-$(CONFIG_RTE_LIBRTE_POWER) := rte_power.c rte_power_acpi_cpufreq.c
+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
 
 # install this header file
lib/librte_power/power_acpi_cpufreq.c renamed from lib/librte_power/rte_power_acpi_cpufreq.c +16 -16
similarity index 94%
rename from lib/librte_power/rte_power_acpi_cpufreq.c
rename to lib/librte_power/power_acpi_cpufreq.c
index 755dfff..fd1931f 100644
@@ -44,7 +44,7 @@
 #include <rte_memcpy.h>
 #include <rte_atomic.h>
 
-#include "rte_power_acpi_cpufreq.h"
+#include "power_acpi_cpufreq.h"
 #include "power_common.h"
 
 #ifdef RTE_LIBRTE_POWER_DEBUG
@@ -311,7 +311,7 @@ power_init_for_setting_freq(struct rte_power_info *pi)
 }
 
 int
-rte_power_acpi_cpufreq_init(unsigned int lcore_id)
+power_acpi_cpufreq_init(unsigned int lcore_id)
 {
 	struct rte_power_info *pi;
 
@@ -352,7 +352,7 @@ rte_power_acpi_cpufreq_init(unsigned int lcore_id)
 	}
 
 	/* Set freq to max by default */
-	if (rte_power_acpi_cpufreq_freq_max(lcore_id) < 0) {
+	if (power_acpi_cpufreq_freq_max(lcore_id) < 0) {
 		RTE_LOG(ERR, POWER, "Cannot set frequency of lcore %u "
 				"to max\n", lcore_id);
 		goto fail;
@@ -419,7 +419,7 @@ power_set_governor_original(struct rte_power_info *pi)
 }
 
 int
-rte_power_acpi_cpufreq_exit(unsigned int lcore_id)
+power_acpi_cpufreq_exit(unsigned int lcore_id)
 {
 	struct rte_power_info *pi;
 
@@ -461,7 +461,7 @@ rte_power_acpi_cpufreq_exit(unsigned int lcore_id)
 }
 
 uint32_t
-rte_power_acpi_cpufreq_freqs(unsigned lcore_id, uint32_t *freqs, uint32_t num)
+power_acpi_cpufreq_freqs(unsigned int lcore_id, uint32_t *freqs, uint32_t num)
 {
 	struct rte_power_info *pi;
 
@@ -481,7 +481,7 @@ rte_power_acpi_cpufreq_freqs(unsigned lcore_id, uint32_t *freqs, uint32_t num)
 }
 
 uint32_t
-rte_power_acpi_cpufreq_get_freq(unsigned int lcore_id)
+power_acpi_cpufreq_get_freq(unsigned int lcore_id)
 {
 	if (lcore_id >= RTE_MAX_LCORE) {
 		RTE_LOG(ERR, POWER, "Invalid lcore ID\n");
@@ -492,7 +492,7 @@ rte_power_acpi_cpufreq_get_freq(unsigned int lcore_id)
 }
 
 int
-rte_power_acpi_cpufreq_set_freq(unsigned lcore_id, uint32_t index)
+power_acpi_cpufreq_set_freq(unsigned int lcore_id, uint32_t index)
 {
 	if (lcore_id >= RTE_MAX_LCORE) {
 		RTE_LOG(ERR, POWER, "Invalid lcore ID\n");
@@ -503,7 +503,7 @@ rte_power_acpi_cpufreq_set_freq(unsigned lcore_id, uint32_t index)
 }
 
 int
-rte_power_acpi_cpufreq_freq_down(unsigned int lcore_id)
+power_acpi_cpufreq_freq_down(unsigned int lcore_id)
 {
 	struct rte_power_info *pi;
 
@@ -521,7 +521,7 @@ rte_power_acpi_cpufreq_freq_down(unsigned int lcore_id)
 }
 
 int
-rte_power_acpi_cpufreq_freq_up(unsigned int lcore_id)
+power_acpi_cpufreq_freq_up(unsigned int lcore_id)
 {
 	struct rte_power_info *pi;
 
@@ -539,7 +539,7 @@ rte_power_acpi_cpufreq_freq_up(unsigned int lcore_id)
 }
 
 int
-rte_power_acpi_cpufreq_freq_max(unsigned int lcore_id)
+power_acpi_cpufreq_freq_max(unsigned int lcore_id)
 {
 	if (lcore_id >= RTE_MAX_LCORE) {
 		RTE_LOG(ERR, POWER, "Invalid lcore ID\n");
@@ -561,7 +561,7 @@ rte_power_acpi_cpufreq_freq_max(unsigned int lcore_id)
 }
 
 int
-rte_power_acpi_cpufreq_freq_min(unsigned int lcore_id)
+power_acpi_cpufreq_freq_min(unsigned int lcore_id)
 {
 	struct rte_power_info *pi;
 
@@ -578,7 +578,7 @@ rte_power_acpi_cpufreq_freq_min(unsigned int lcore_id)
 
 
 int
-rte_power_acpi_turbo_status(unsigned int lcore_id)
+power_acpi_turbo_status(unsigned int lcore_id)
 {
 	struct rte_power_info *pi;
 
@@ -594,7 +594,7 @@ rte_power_acpi_turbo_status(unsigned int lcore_id)
 
 
 int
-rte_power_acpi_enable_turbo(unsigned int lcore_id)
+power_acpi_enable_turbo(unsigned int lcore_id)
 {
 	struct rte_power_info *pi;
 
@@ -616,7 +616,7 @@ rte_power_acpi_enable_turbo(unsigned int lcore_id)
 	}
 
 	/* Max may have changed, so call to max function */
-	if (rte_power_acpi_cpufreq_freq_max(lcore_id) < 0) {
+	if (power_acpi_cpufreq_freq_max(lcore_id) < 0) {
 		RTE_LOG(ERR, POWER,
 			"Failed to set frequency of lcore %u to max\n",
 			lcore_id);
@@ -627,7 +627,7 @@ rte_power_acpi_enable_turbo(unsigned int lcore_id)
 }
 
 int
-rte_power_acpi_disable_turbo(unsigned int lcore_id)
+power_acpi_disable_turbo(unsigned int lcore_id)
 {
 	struct rte_power_info *pi;
 
@@ -642,7 +642,7 @@ rte_power_acpi_disable_turbo(unsigned int lcore_id)
 
 	if ((pi->turbo_available) && (pi->curr_idx <= 1)) {
 		/* Try to set freq to max by default coming out of turbo */
-		if (rte_power_acpi_cpufreq_freq_max(lcore_id) < 0) {
+		if (power_acpi_cpufreq_freq_max(lcore_id) < 0) {
 			RTE_LOG(ERR, POWER,
 				"Failed to set frequency of lcore %u to max\n",
 				lcore_id);
lib/librte_power/power_acpi_cpufreq.h renamed from lib/librte_power/rte_power_acpi_cpufreq.h +14 -14
similarity index 88%
rename from lib/librte_power/rte_power_acpi_cpufreq.h
rename to lib/librte_power/power_acpi_cpufreq.h
index bc20dfd..3933fc4 100644
@@ -31,8 +31,8 @@
  *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef _RTE_POWER_ACPI_CPUFREQ_H
-#define _RTE_POWER_ACPI_CPUFREQ_H
+#ifndef _POWER_ACPI_CPUFREQ_H
+#define _POWER_ACPI_CPUFREQ_H
 
 /**
  * @file
@@ -60,7 +60,7 @@ extern "C" {
  *  - 0 on success.
  *  - Negative on error.
  */
-int rte_power_acpi_cpufreq_init(unsigned lcore_id);
+int power_acpi_cpufreq_init(unsigned int lcore_id);
 
 /**
  * Exit power management on a specific lcore. It will set the governor to which
@@ -73,7 +73,7 @@ int rte_power_acpi_cpufreq_init(unsigned lcore_id);
  *  - 0 on success.
  *  - Negative on error.
  */
-int rte_power_acpi_cpufreq_exit(unsigned lcore_id);
+int power_acpi_cpufreq_exit(unsigned int lcore_id);
 
 /**
  * Get the available frequencies of a specific lcore. The return value will be
@@ -92,7 +92,7 @@ int rte_power_acpi_cpufreq_exit(unsigned lcore_id);
  * @return
  *  The number of available frequencies.
  */
-uint32_t rte_power_acpi_cpufreq_freqs(unsigned lcore_id, uint32_t *freqs,
+uint32_t power_acpi_cpufreq_freqs(unsigned int lcore_id, uint32_t *freqs,
 		uint32_t num);
 
 /**
@@ -106,7 +106,7 @@ uint32_t rte_power_acpi_cpufreq_freqs(unsigned lcore_id, uint32_t *freqs,
  * @return
  *  The current index of available frequencies.
  */
-uint32_t rte_power_acpi_cpufreq_get_freq(unsigned lcore_id);
+uint32_t power_acpi_cpufreq_get_freq(unsigned int lcore_id);
 
 /**
  * Set the new frequency for a specific lcore by indicating the index of
@@ -123,7 +123,7 @@ uint32_t rte_power_acpi_cpufreq_get_freq(unsigned lcore_id);
  *  - 0 on success without frequency changed.
  *  - Negative on error.
  */
-int rte_power_acpi_cpufreq_set_freq(unsigned lcore_id, uint32_t index);
+int power_acpi_cpufreq_set_freq(unsigned int lcore_id, uint32_t index);
 
 /**
  * Scale up the frequency of a specific lcore according to the available
@@ -138,7 +138,7 @@ int rte_power_acpi_cpufreq_set_freq(unsigned lcore_id, uint32_t index);
  *  - 0 on success without frequency changed.
  *  - Negative on error.
  */
-int rte_power_acpi_cpufreq_freq_up(unsigned lcore_id);
+int power_acpi_cpufreq_freq_up(unsigned int lcore_id);
 
 /**
  * Scale down the frequency of a specific lcore according to the available
@@ -153,7 +153,7 @@ int rte_power_acpi_cpufreq_freq_up(unsigned lcore_id);
  *  - 0 on success without frequency changed.
  *  - Negative on error.
  */
-int rte_power_acpi_cpufreq_freq_down(unsigned lcore_id);
+int power_acpi_cpufreq_freq_down(unsigned int lcore_id);
 
 /**
  * Scale up the frequency of a specific lcore to the highest according to the
@@ -168,7 +168,7 @@ int rte_power_acpi_cpufreq_freq_down(unsigned lcore_id);
  *  - 0 on success without frequency changed.
  *  - Negative on error.
  */
-int rte_power_acpi_cpufreq_freq_max(unsigned lcore_id);
+int power_acpi_cpufreq_freq_max(unsigned int lcore_id);
 
 /**
  * Scale down the frequency of a specific lcore to the lowest according to the
@@ -183,7 +183,7 @@ int rte_power_acpi_cpufreq_freq_max(unsigned lcore_id);
  *  - 0 on success without frequency changed.
  *  - Negative on error.
  */
-int rte_power_acpi_cpufreq_freq_min(unsigned lcore_id);
+int power_acpi_cpufreq_freq_min(unsigned int lcore_id);
 
 /**
  * Get the turbo status of a specific lcore.
@@ -197,7 +197,7 @@ int rte_power_acpi_cpufreq_freq_min(unsigned lcore_id);
  *  - 0 Turbo Boost is disabled on this lcore.
  *  - Negative on error.
  */
-int rte_power_acpi_turbo_status(unsigned int lcore_id);
+int power_acpi_turbo_status(unsigned int lcore_id);
 
 /**
  * Enable Turbo Boost on a specific lcore.
@@ -210,7 +210,7 @@ int rte_power_acpi_turbo_status(unsigned int lcore_id);
  *  - 0 Turbo Boost is enabled successfully on this lcore.
  *  - Negative on error.
  */
-int rte_power_acpi_enable_turbo(unsigned int lcore_id);
+int power_acpi_enable_turbo(unsigned int lcore_id);
 
 /**
  * Disable Turbo Boost on a specific lcore.
@@ -223,7 +223,7 @@ int rte_power_acpi_enable_turbo(unsigned int lcore_id);
  *  - 0 Turbo Boost disabled successfully on this lcore.
  *  - Negative on error.
  */
-int rte_power_acpi_disable_turbo(unsigned int lcore_id);
+int power_acpi_disable_turbo(unsigned int lcore_id);
 
 #ifdef __cplusplus
 }
lib/librte_power/rte_power.c +14 -14
index c363667..71c1959 100644
@@ -34,7 +34,7 @@
 #include <rte_atomic.h>
 
 #include "rte_power.h"
-#include "rte_power_acpi_cpufreq.h"
+#include "power_acpi_cpufreq.h"
 #include "rte_power_kvm_vm.h"
 #include "power_common.h"
 
@@ -61,16 +61,16 @@ rte_power_set_env(enum power_management_env env)
 		return 0;
 	}
 	if (env == PM_ENV_ACPI_CPUFREQ) {
-		rte_power_freqs = rte_power_acpi_cpufreq_freqs;
-		rte_power_get_freq = rte_power_acpi_cpufreq_get_freq;
-		rte_power_set_freq = rte_power_acpi_cpufreq_set_freq;
-		rte_power_freq_up = rte_power_acpi_cpufreq_freq_up;
-		rte_power_freq_down = rte_power_acpi_cpufreq_freq_down;
-		rte_power_freq_min = rte_power_acpi_cpufreq_freq_min;
-		rte_power_freq_max = rte_power_acpi_cpufreq_freq_max;
-		rte_power_turbo_status = rte_power_acpi_turbo_status;
-		rte_power_freq_enable_turbo = rte_power_acpi_enable_turbo;
-		rte_power_freq_disable_turbo = rte_power_acpi_disable_turbo;
+		rte_power_freqs = power_acpi_cpufreq_freqs;
+		rte_power_get_freq = power_acpi_cpufreq_get_freq;
+		rte_power_set_freq = power_acpi_cpufreq_set_freq;
+		rte_power_freq_up = power_acpi_cpufreq_freq_up;
+		rte_power_freq_down = power_acpi_cpufreq_freq_down;
+		rte_power_freq_min = power_acpi_cpufreq_freq_min;
+		rte_power_freq_max = power_acpi_cpufreq_freq_max;
+		rte_power_turbo_status = power_acpi_turbo_status;
+		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;
@@ -111,7 +111,7 @@ rte_power_init(unsigned int lcore_id)
 	int ret = -1;
 
 	if (global_default_env == PM_ENV_ACPI_CPUFREQ) {
-		return rte_power_acpi_cpufreq_init(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);
@@ -119,7 +119,7 @@ rte_power_init(unsigned int lcore_id)
 	/* Auto detect Environment */
 	RTE_LOG(INFO, POWER, "Attempting to initialise ACPI cpufreq power "
 			"management...\n");
-	ret = rte_power_acpi_cpufreq_init(lcore_id);
+	ret = power_acpi_cpufreq_init(lcore_id);
 	if (ret == 0) {
 		rte_power_set_env(PM_ENV_ACPI_CPUFREQ);
 		goto out;
@@ -141,7 +141,7 @@ int
 rte_power_exit(unsigned int lcore_id)
 {
 	if (global_default_env == PM_ENV_ACPI_CPUFREQ)
-		return rte_power_acpi_cpufreq_exit(lcore_id);
+		return power_acpi_cpufreq_exit(lcore_id);
 	if (global_default_env == PM_ENV_KVM_VM)
 		return rte_power_kvm_vm_exit(lcore_id);
 
Signature · 1 line
2.9.5
#15 lore raw

PATCH v3 4/4 power: clean up of kvm files

In reply to Marko Kovacevic

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

---
 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%)
lib/librte_power/Makefile +1 -1
index bf5a55e..a35c50a 100644
@@ -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
lib/librte_power/power_kvm_vm.c renamed from lib/librte_power/rte_power_kvm_vm.c +13 -13
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
@@ -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);
 }
lib/librte_power/power_kvm_vm.h renamed from lib/librte_power/rte_power_kvm_vm.h +14 -14
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
@@ -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
lib/librte_power/rte_power.c +14 -14
index 71c1959..e76f3fd 100644
@@ -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");
Signature · 1 line
2.9.5
#16 lore raw
In reply to Marko Kovacevic

12/12/2017 15:03, Marko Kovacevic:

Quoted 9 lines

Since this patch-set attempts to clean up the power library, and there are many instances of "unsigned" caught by checkpatch, it was decided to clean these up first rather than have them included in the later patches in the patch set. And would also minimise this type of error being caught by checkpatch in the future

Series applied, thanks