DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH v1] power: fix make build for power apps
@ 2020-12-17 11:36 David Hunt
  2021-01-08 14:30 ` [dpdk-dev] [PATCH 0/6] " David Hunt
  0 siblings, 1 reply; 69+ messages in thread
From: David Hunt @ 2020-12-17 11:36 UTC (permalink / raw)
  To: dev; +Cc: david.hunt, stable, Bruce Richardson

From: Bruce Richardson <bruce.richardson@intel.com>

The guest channel message definitions and commands in guest_channel.h file
are needed by applications and need to be made public.

This patch is needed because make is broken for the power_mgmt apps, as
the channel commands API is private. This previously built within DPDK,
but now with all the meson/ninja changes, making these apps externally
no longer works. To fix, we need to move the header file with the API
definitions for the channel commands public, and rename the functionss
accordingly.

The main change is to rename channel_commands.h to
rte_power_guest_channel.h so that it gets picked up by the installer and
copied to /usr/local/include. Other changes include renaming #defines to
have RTE_ at the beginning instead of CPU_. Finally we refactor the code
to work with those changes.

Fixes: 210c383e247b ("power: packet format for vm power management")
Fixes: cd0d5547e873 ("power: vm communication channels in guest")
Cc: stable@dpdk.org

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: David Hunt <david.hunt@intel.com>
---
 examples/vm_power_manager/channel_manager.c   |   1 -
 examples/vm_power_manager/channel_monitor.c   | 148 ++++++++--------
 examples/vm_power_manager/channel_monitor.h   |  10 +-
 examples/vm_power_manager/guest_cli/main.c    |  31 ++--
 .../guest_cli/vm_power_cli_guest.c            |  70 ++++----
 .../guest_cli/vm_power_cli_guest.h            |   6 +-
 examples/vm_power_manager/main.c              |   2 +-
 examples/vm_power_manager/vm_power_cli.c      |   1 -
 lib/librte_power/channel_commands.h           | 125 --------------
 lib/librte_power/guest_channel.c              |  11 +-
 lib/librte_power/guest_channel.h              |  45 +----
 lib/librte_power/meson.build                  |   3 +-
 lib/librte_power/power_kvm_vm.c               |  17 +-
 lib/librte_power/rte_power.h                  |   1 +
 lib/librte_power/rte_power_guest_channel.h    | 160 ++++++++++++++++++
 15 files changed, 320 insertions(+), 311 deletions(-)
 delete mode 100644 lib/librte_power/channel_commands.h
 create mode 100644 lib/librte_power/rte_power_guest_channel.h

diff --git a/examples/vm_power_manager/channel_manager.c b/examples/vm_power_manager/channel_manager.c
index a26315051..0a28cb643 100644
--- a/examples/vm_power_manager/channel_manager.c
+++ b/examples/vm_power_manager/channel_manager.c
@@ -27,7 +27,6 @@
 #include <libvirt/libvirt.h>
 
 #include "channel_manager.h"
-#include "channel_commands.h"
 #include "channel_monitor.h"
 #include "power_manager.h"
 
diff --git a/examples/vm_power_manager/channel_monitor.c b/examples/vm_power_manager/channel_monitor.c
index 228f06803..46c0a8208 100644
--- a/examples/vm_power_manager/channel_monitor.c
+++ b/examples/vm_power_manager/channel_monitor.c
@@ -35,7 +35,6 @@
 
 #include <libvirt/libvirt.h>
 #include "channel_monitor.h"
-#include "channel_commands.h"
 #include "channel_manager.h"
 #include "power_manager.h"
 #include "oob_monitor.h"
@@ -108,7 +107,7 @@ str_to_ether_addr(const char *a, struct rte_ether_addr *ether_addr)
 }
 
 static int
-set_policy_mac(struct channel_packet *pkt, int idx, char *mac)
+set_policy_mac(struct rte_power_channel_packet *pkt, int idx, char *mac)
 {
 	union PFID pfid;
 	int ret;
@@ -165,7 +164,7 @@ get_resource_id_from_vmname(const char *vm_name)
 }
 
 static int
-parse_json_to_pkt(json_t *element, struct channel_packet *pkt,
+parse_json_to_pkt(json_t *element, struct rte_power_channel_packet *pkt,
 					const char *vm_name)
 {
 	const char *key;
@@ -173,14 +172,14 @@ parse_json_to_pkt(json_t *element, struct channel_packet *pkt,
 	int ret;
 	int resource_id;
 
-	memset(pkt, 0, sizeof(struct channel_packet));
+	memset(pkt, 0, sizeof(struct rte_power_channel_packet));
 
 	pkt->nb_mac_to_monitor = 0;
 	pkt->t_boost_status.tbEnabled = false;
-	pkt->workload = LOW;
-	pkt->policy_to_use = TIME;
-	pkt->command = PKT_POLICY;
-	pkt->core_type = CORE_TYPE_PHYSICAL;
+	pkt->workload = RTE_POWER_WL_LOW;
+	pkt->policy_to_use = RTE_POWER_POLICY_TIME;
+	pkt->command = RTE_POWER_PKT_POLICY;
+	pkt->core_type = RTE_POWER_CORE_TYPE_PHYSICAL;
 
 	if (vm_name == NULL) {
 		RTE_LOG(ERR, CHANNEL_MONITOR,
@@ -203,11 +202,11 @@ parse_json_to_pkt(json_t *element, struct channel_packet *pkt,
 			char command[32];
 			strlcpy(command, json_string_value(value), 32);
 			if (!strcmp(command, "power")) {
-				pkt->command = CPU_POWER;
+				pkt->command = RTE_POWER_CPU_POWER;
 			} else if (!strcmp(command, "create")) {
-				pkt->command = PKT_POLICY;
+				pkt->command = RTE_POWER_PKT_POLICY;
 			} else if (!strcmp(command, "destroy")) {
-				pkt->command = PKT_POLICY_REMOVE;
+				pkt->command = RTE_POWER_PKT_POLICY_REMOVE;
 			} else {
 				RTE_LOG(ERR, CHANNEL_MONITOR,
 					"Invalid command received in JSON\n");
@@ -217,13 +216,17 @@ parse_json_to_pkt(json_t *element, struct channel_packet *pkt,
 			char command[32];
 			strlcpy(command, json_string_value(value), 32);
 			if (!strcmp(command, "TIME")) {
-				pkt->policy_to_use = TIME;
+				pkt->policy_to_use =
+						RTE_POWER_POLICY_TIME;
 			} else if (!strcmp(command, "TRAFFIC")) {
-				pkt->policy_to_use = TRAFFIC;
+				pkt->policy_to_use =
+						RTE_POWER_POLICY_TRAFFIC;
 			} else if (!strcmp(command, "WORKLOAD")) {
-				pkt->policy_to_use = WORKLOAD;
+				pkt->policy_to_use =
+						RTE_POWER_POLICY_WORKLOAD;
 			} else if (!strcmp(command, "BRANCH_RATIO")) {
-				pkt->policy_to_use = BRANCH_RATIO;
+				pkt->policy_to_use =
+						RTE_POWER_POLICY_BRANCH_RATIO;
 			} else {
 				RTE_LOG(ERR, CHANNEL_MONITOR,
 					"Wrong policy_type received in JSON\n");
@@ -233,11 +236,11 @@ parse_json_to_pkt(json_t *element, struct channel_packet *pkt,
 			char command[32];
 			strlcpy(command, json_string_value(value), 32);
 			if (!strcmp(command, "HIGH")) {
-				pkt->workload = HIGH;
+				pkt->workload = RTE_POWER_WL_HIGH;
 			} else if (!strcmp(command, "MEDIUM")) {
-				pkt->workload = MEDIUM;
+				pkt->workload = RTE_POWER_WL_MEDIUM;
 			} else if (!strcmp(command, "LOW")) {
-				pkt->workload = LOW;
+				pkt->workload = RTE_POWER_WL_LOW;
 			} else {
 				RTE_LOG(ERR, CHANNEL_MONITOR,
 					"Wrong workload received in JSON\n");
@@ -283,17 +286,17 @@ parse_json_to_pkt(json_t *element, struct channel_packet *pkt,
 			char unit[32];
 			strlcpy(unit, json_string_value(value), 32);
 			if (!strcmp(unit, "SCALE_UP")) {
-				pkt->unit = CPU_POWER_SCALE_UP;
+				pkt->unit = RTE_POWER_SCALE_UP;
 			} else if (!strcmp(unit, "SCALE_DOWN")) {
-				pkt->unit = CPU_POWER_SCALE_DOWN;
+				pkt->unit = RTE_POWER_SCALE_DOWN;
 			} else if (!strcmp(unit, "SCALE_MAX")) {
-				pkt->unit = CPU_POWER_SCALE_MAX;
+				pkt->unit = RTE_POWER_SCALE_MAX;
 			} else if (!strcmp(unit, "SCALE_MIN")) {
-				pkt->unit = CPU_POWER_SCALE_MIN;
+				pkt->unit = RTE_POWER_SCALE_MIN;
 			} else if (!strcmp(unit, "ENABLE_TURBO")) {
-				pkt->unit = CPU_POWER_ENABLE_TURBO;
+				pkt->unit = RTE_POWER_ENABLE_TURBO;
 			} else if (!strcmp(unit, "DISABLE_TURBO")) {
-				pkt->unit = CPU_POWER_DISABLE_TURBO;
+				pkt->unit = RTE_POWER_DISABLE_TURBO;
 			} else {
 				RTE_LOG(ERR, CHANNEL_MONITOR,
 					"Invalid command received in JSON\n");
@@ -312,7 +315,7 @@ parse_json_to_pkt(json_t *element, struct channel_packet *pkt,
 				vm_name);
 			return -1;
 		}
-		strlcpy(pkt->vm_name, vm_name, VM_MAX_NAME_SZ);
+		strlcpy(pkt->vm_name, vm_name, RTE_POWER_VM_MAX_NAME_SZ);
 		pkt->resource_id = resource_id;
 	}
 	return 0;
@@ -367,7 +370,7 @@ pcpu_monitor(struct policy *pol, struct core_info *ci, int pcpu, int count)
 {
 	int ret = 0;
 
-	if (pol->pkt.policy_to_use == BRANCH_RATIO) {
+	if (pol->pkt.policy_to_use == RTE_POWER_POLICY_BRANCH_RATIO) {
 		ci->cd[pcpu].oob_enabled = 1;
 		ret = add_core_to_monitor(pcpu);
 		if (ret == 0)
@@ -407,7 +410,7 @@ get_pcpu_to_control(struct policy *pol)
 	 * differenciate between them when adding them to the branch monitor.
 	 * Virtual cores need to be converted to physical cores.
 	 */
-	if (pol->pkt.core_type == CORE_TYPE_VIRTUAL) {
+	if (pol->pkt.core_type == RTE_POWER_CORE_TYPE_VIRTUAL) {
 		/*
 		 * If the cores in the policy are virtual, we need to map them
 		 * to physical core. We look up the vm info and use that for
@@ -463,7 +466,7 @@ get_pfid(struct policy *pol)
 }
 
 static int
-update_policy(struct channel_packet *pkt)
+update_policy(struct rte_power_channel_packet *pkt)
 {
 
 	unsigned int updated = 0;
@@ -479,7 +482,8 @@ update_policy(struct channel_packet *pkt)
 			policies[i].pkt = *pkt;
 			get_pcpu_to_control(&policies[i]);
 			/* Check Eth dev only for Traffic policy */
-			if (policies[i].pkt.policy_to_use == TRAFFIC) {
+			if (policies[i].pkt.policy_to_use ==
+					RTE_POWER_POLICY_TRAFFIC) {
 				if (get_pfid(&policies[i]) < 0) {
 					updated = 1;
 					break;
@@ -496,7 +500,8 @@ update_policy(struct channel_packet *pkt)
 				policies[i].pkt = *pkt;
 				get_pcpu_to_control(&policies[i]);
 				/* Check Eth dev only for Traffic policy */
-				if (policies[i].pkt.policy_to_use == TRAFFIC) {
+				if (policies[i].pkt.policy_to_use ==
+						RTE_POWER_POLICY_TRAFFIC) {
 					if (get_pfid(&policies[i]) < 0) {
 						updated = 1;
 						break;
@@ -512,7 +517,7 @@ update_policy(struct channel_packet *pkt)
 }
 
 static int
-remove_policy(struct channel_packet *pkt __rte_unused)
+remove_policy(struct rte_power_channel_packet *pkt __rte_unused)
 {
 	unsigned int i;
 
@@ -615,7 +620,7 @@ apply_time_profile(struct policy *pol)
 	/* Format the date and time, down to a single second. */
 	strftime(time_string, sizeof(time_string), "%Y-%m-%d %H:%M:%S", ptm);
 
-	for (x = 0; x < HOURS; x++) {
+	for (x = 0; x < RTE_POWER_HOURS_PER_DAY; x++) {
 
 		if (ptm->tm_hour == pol->pkt.timer_policy.busy_hours[x]) {
 			for (count = 0; count < pol->pkt.num_vcpu; count++) {
@@ -648,19 +653,19 @@ apply_workload_profile(struct policy *pol)
 
 	int count;
 
-	if (pol->pkt.workload == HIGH) {
+	if (pol->pkt.workload == RTE_POWER_WL_HIGH) {
 		for (count = 0; count < pol->pkt.num_vcpu; count++) {
 			if (pol->core_share[count].status != 1)
 				power_manager_scale_core_max(
 						pol->core_share[count].pcpu);
 		}
-	} else if (pol->pkt.workload == MEDIUM) {
+	} else if (pol->pkt.workload == RTE_POWER_WL_MEDIUM) {
 		for (count = 0; count < pol->pkt.num_vcpu; count++) {
 			if (pol->core_share[count].status != 1)
 				power_manager_scale_core_med(
 						pol->core_share[count].pcpu);
 		}
-	} else if (pol->pkt.workload == LOW) {
+	} else if (pol->pkt.workload == RTE_POWER_WL_LOW) {
 		for (count = 0; count < pol->pkt.num_vcpu; count++) {
 			if (pol->core_share[count].status != 1)
 				power_manager_scale_core_min(
@@ -673,14 +678,14 @@ static void
 apply_policy(struct policy *pol)
 {
 
-	struct channel_packet *pkt = &pol->pkt;
+	struct rte_power_channel_packet *pkt = &pol->pkt;
 
 	/*Check policy to use*/
-	if (pkt->policy_to_use == TRAFFIC)
+	if (pkt->policy_to_use == RTE_POWER_POLICY_TRAFFIC)
 		apply_traffic_profile(pol);
-	else if (pkt->policy_to_use == TIME)
+	else if (pkt->policy_to_use == RTE_POWER_POLICY_TIME)
 		apply_time_profile(pol);
-	else if (pkt->policy_to_use == WORKLOAD)
+	else if (pkt->policy_to_use == RTE_POWER_POLICY_WORKLOAD)
 		apply_workload_profile(pol);
 }
 
@@ -715,24 +720,24 @@ write_binary_packet(void *buffer,
 }
 
 static int
-send_freq(struct channel_packet *pkt,
+send_freq(struct rte_power_channel_packet *pkt,
 		struct channel_info *chan_info,
 		bool freq_list)
 {
 	unsigned int vcore_id = pkt->resource_id;
-	struct channel_packet_freq_list channel_pkt_freq_list;
+	struct rte_power_channel_packet_freq_list channel_pkt_freq_list;
 	struct vm_info info;
 
 	if (get_info_vm(pkt->vm_name, &info) != 0)
 		return -1;
 
-	if (!freq_list && vcore_id >= MAX_VCPU_PER_VM)
+	if (!freq_list && vcore_id >= RTE_POWER_MAX_VCPU_PER_VM)
 		return -1;
 
 	if (!info.allow_query)
 		return -1;
 
-	channel_pkt_freq_list.command = CPU_POWER_FREQ_LIST;
+	channel_pkt_freq_list.command = RTE_POWER_FREQ_LIST;
 	channel_pkt_freq_list.num_vcpu = info.num_vcpus;
 
 	if (freq_list) {
@@ -751,12 +756,12 @@ send_freq(struct channel_packet *pkt,
 }
 
 static int
-send_capabilities(struct channel_packet *pkt,
+send_capabilities(struct rte_power_channel_packet *pkt,
 		struct channel_info *chan_info,
 		bool list_requested)
 {
 	unsigned int vcore_id = pkt->resource_id;
-	struct channel_packet_caps_list channel_pkt_caps_list;
+	struct rte_power_channel_packet_caps_list channel_pkt_caps_list;
 	struct vm_info info;
 	struct rte_power_core_capabilities caps;
 	int ret;
@@ -764,13 +769,13 @@ send_capabilities(struct channel_packet *pkt,
 	if (get_info_vm(pkt->vm_name, &info) != 0)
 		return -1;
 
-	if (!list_requested && vcore_id >= MAX_VCPU_PER_VM)
+	if (!list_requested && vcore_id >= RTE_POWER_MAX_VCPU_PER_VM)
 		return -1;
 
 	if (!info.allow_query)
 		return -1;
 
-	channel_pkt_caps_list.command = CPU_POWER_CAPS_LIST;
+	channel_pkt_caps_list.command = RTE_POWER_CAPS_LIST;
 	channel_pkt_caps_list.num_vcpu = info.num_vcpus;
 
 	if (list_requested) {
@@ -805,18 +810,19 @@ send_capabilities(struct channel_packet *pkt,
 }
 
 static int
-send_ack_for_received_cmd(struct channel_packet *pkt,
+send_ack_for_received_cmd(struct rte_power_channel_packet *pkt,
 		struct channel_info *chan_info,
 		uint32_t command)
 {
 	pkt->command = command;
 	return write_binary_packet(pkt,
-			sizeof(struct channel_packet),
+			sizeof(struct rte_power_channel_packet),
 			chan_info);
 }
 
 static int
-process_request(struct channel_packet *pkt, struct channel_info *chan_info)
+process_request(struct rte_power_channel_packet *pkt,
+		struct channel_info *chan_info)
 {
 	int ret;
 
@@ -827,10 +833,10 @@ process_request(struct channel_packet *pkt, struct channel_info *chan_info)
 			CHANNEL_MGR_CHANNEL_PROCESSING) == 0)
 		return -1;
 
-	if (pkt->command == CPU_POWER) {
+	if (pkt->command == RTE_POWER_CPU_POWER) {
 		unsigned int core_num;
 
-		if (pkt->core_type == CORE_TYPE_VIRTUAL)
+		if (pkt->core_type == RTE_POWER_CORE_TYPE_VIRTUAL)
 			core_num = get_pcpu(chan_info, pkt->resource_id);
 		else
 			core_num = pkt->resource_id;
@@ -842,22 +848,22 @@ process_request(struct channel_packet *pkt, struct channel_info *chan_info)
 		bool valid_unit = true;
 
 		switch (pkt->unit) {
-		case(CPU_POWER_SCALE_MIN):
+		case(RTE_POWER_SCALE_MIN):
 			scale_res = power_manager_scale_core_min(core_num);
 			break;
-		case(CPU_POWER_SCALE_MAX):
+		case(RTE_POWER_SCALE_MAX):
 			scale_res = power_manager_scale_core_max(core_num);
 			break;
-		case(CPU_POWER_SCALE_DOWN):
+		case(RTE_POWER_SCALE_DOWN):
 			scale_res = power_manager_scale_core_down(core_num);
 			break;
-		case(CPU_POWER_SCALE_UP):
+		case(RTE_POWER_SCALE_UP):
 			scale_res = power_manager_scale_core_up(core_num);
 			break;
-		case(CPU_POWER_ENABLE_TURBO):
+		case(RTE_POWER_ENABLE_TURBO):
 			scale_res = power_manager_enable_turbo_core(core_num);
 			break;
-		case(CPU_POWER_DISABLE_TURBO):
+		case(RTE_POWER_DISABLE_TURBO):
 			scale_res = power_manager_disable_turbo_core(core_num);
 			break;
 		default:
@@ -869,8 +875,8 @@ process_request(struct channel_packet *pkt, struct channel_info *chan_info)
 			ret = send_ack_for_received_cmd(pkt,
 					chan_info,
 					scale_res >= 0 ?
-						CPU_POWER_CMD_ACK :
-						CPU_POWER_CMD_NACK);
+						RTE_POWER_CMD_ACK :
+						RTE_POWER_CMD_NACK);
 			if (ret < 0)
 				RTE_LOG(ERR, CHANNEL_MONITOR, "Error during sending ack command.\n");
 		} else
@@ -878,19 +884,19 @@ process_request(struct channel_packet *pkt, struct channel_info *chan_info)
 
 	}
 
-	if (pkt->command == PKT_POLICY) {
+	if (pkt->command == RTE_POWER_PKT_POLICY) {
 		RTE_LOG(INFO, CHANNEL_MONITOR, "Processing policy request %s\n",
 				pkt->vm_name);
 		int ret = send_ack_for_received_cmd(pkt,
 				chan_info,
-				CPU_POWER_CMD_ACK);
+				RTE_POWER_CMD_ACK);
 		if (ret < 0)
 			RTE_LOG(ERR, CHANNEL_MONITOR, "Error during sending ack command.\n");
 		update_policy(pkt);
 		policy_is_set = 1;
 	}
 
-	if (pkt->command == PKT_POLICY_REMOVE) {
+	if (pkt->command == RTE_POWER_PKT_POLICY_REMOVE) {
 		ret = remove_policy(pkt);
 		if (ret == 0)
 			RTE_LOG(INFO, CHANNEL_MONITOR,
@@ -900,26 +906,26 @@ process_request(struct channel_packet *pkt, struct channel_info *chan_info)
 				 "Policy %s does not exist\n", pkt->vm_name);
 	}
 
-	if (pkt->command == CPU_POWER_QUERY_FREQ_LIST ||
-		pkt->command == CPU_POWER_QUERY_FREQ) {
+	if (pkt->command == RTE_POWER_QUERY_FREQ_LIST ||
+		pkt->command == RTE_POWER_QUERY_FREQ) {
 
 		RTE_LOG(INFO, CHANNEL_MONITOR,
 			"Frequency for %s requested.\n", pkt->vm_name);
 		int ret = send_freq(pkt,
 				chan_info,
-				pkt->command == CPU_POWER_QUERY_FREQ_LIST);
+				pkt->command == RTE_POWER_QUERY_FREQ_LIST);
 		if (ret < 0)
 			RTE_LOG(ERR, CHANNEL_MONITOR, "Error during frequency sending.\n");
 	}
 
-	if (pkt->command == CPU_POWER_QUERY_CAPS_LIST ||
-		pkt->command == CPU_POWER_QUERY_CAPS) {
+	if (pkt->command == RTE_POWER_QUERY_CAPS_LIST ||
+		pkt->command == RTE_POWER_QUERY_CAPS) {
 
 		RTE_LOG(INFO, CHANNEL_MONITOR,
 			"Capabilities for %s requested.\n", pkt->vm_name);
 		int ret = send_capabilities(pkt,
 				chan_info,
-				pkt->command == CPU_POWER_QUERY_CAPS_LIST);
+				pkt->command == RTE_POWER_QUERY_CAPS_LIST);
 		if (ret < 0)
 			RTE_LOG(ERR, CHANNEL_MONITOR, "Error during sending capabilities.\n");
 	}
@@ -988,7 +994,7 @@ channel_monitor_init(void)
 static void
 read_binary_packet(struct channel_info *chan_info)
 {
-	struct channel_packet pkt;
+	struct rte_power_channel_packet pkt;
 	void *buffer = &pkt;
 	int buffer_len = sizeof(pkt);
 	int n_bytes, err = 0;
@@ -1019,7 +1025,7 @@ read_binary_packet(struct channel_info *chan_info)
 static void
 read_json_packet(struct channel_info *chan_info)
 {
-	struct channel_packet pkt;
+	struct rte_power_channel_packet pkt;
 	int n_bytes, ret;
 	json_t *root;
 	json_error_t error;
diff --git a/examples/vm_power_manager/channel_monitor.h b/examples/vm_power_manager/channel_monitor.h
index 7362a80d2..9184a8327 100644
--- a/examples/vm_power_manager/channel_monitor.h
+++ b/examples/vm_power_manager/channel_monitor.h
@@ -5,8 +5,8 @@
 #ifndef CHANNEL_MONITOR_H_
 #define CHANNEL_MONITOR_H_
 
+#include <rte_power.h>
 #include "channel_manager.h"
-#include "channel_commands.h"
 
 struct core_share {
 	unsigned int pcpu;
@@ -18,11 +18,11 @@ struct core_share {
 };
 
 struct policy {
-	struct channel_packet pkt;
-	uint32_t pfid[MAX_VFS];
-	uint32_t port[MAX_VFS];
+	struct rte_power_channel_packet pkt;
+	uint32_t pfid[RTE_POWER_MAX_VFS];
+	uint32_t port[RTE_POWER_MAX_VFS];
 	unsigned int enabled;
-	struct core_share core_share[MAX_VCPU_PER_VM];
+	struct core_share core_share[RTE_POWER_MAX_VCPU_PER_VM];
 };
 
 #ifdef __cplusplus
diff --git a/examples/vm_power_manager/guest_cli/main.c b/examples/vm_power_manager/guest_cli/main.c
index f63b3c988..4e17f7fb9 100644
--- a/examples/vm_power_manager/guest_cli/main.c
+++ b/examples/vm_power_manager/guest_cli/main.c
@@ -48,10 +48,10 @@ parse_args(int argc, char **argv)
 		{ "policy", required_argument, 0, 'o'},
 		{NULL, 0, 0, 0}
 	};
-	struct channel_packet *policy;
+	struct rte_power_channel_packet *policy;
 	unsigned short int hours[MAX_HOURS];
-	unsigned short int cores[MAX_VCPU_PER_VM];
-	unsigned short int ports[MAX_VCPU_PER_VM];
+	unsigned short int cores[RTE_POWER_MAX_VCPU_PER_VM];
+	unsigned short int ports[RTE_POWER_MAX_VCPU_PER_VM];
 	int i, cnt, idx;
 
 	policy = get_policy();
@@ -69,7 +69,8 @@ parse_args(int argc, char **argv)
 		switch (opt) {
 		/* portmask */
 		case 'n':
-			strlcpy(policy->vm_name, optarg, VM_MAX_NAME_SZ);
+			strlcpy(policy->vm_name, optarg,
+					RTE_POWER_VM_MAX_NAME_SZ);
 			printf("Setting VM Name to [%s]\n", policy->vm_name);
 			break;
 		case 'b':
@@ -97,14 +98,15 @@ parse_args(int argc, char **argv)
 			}
 			break;
 		case 'l':
-			cnt = parse_set(optarg, cores, MAX_VCPU_PER_VM);
+			cnt = parse_set(optarg, cores,
+					RTE_POWER_MAX_VCPU_PER_VM);
 			if (cnt < 0) {
 				printf("Invalid value passed to vcpu-list - [%s]\n",
 						optarg);
 				break;
 			}
 			idx = 0;
-			for (i = 0; i < MAX_VCPU_PER_VM; i++) {
+			for (i = 0; i < RTE_POWER_MAX_VCPU_PER_VM; i++) {
 				if (cores[i]) {
 					printf("***Using core %d\n", i);
 					policy->vcpu_to_control[idx++] = i;
@@ -114,14 +116,15 @@ parse_args(int argc, char **argv)
 			printf("Total cores: %d\n", idx);
 			break;
 		case 'p':
-			cnt = parse_set(optarg, ports, MAX_VCPU_PER_VM);
+			cnt = parse_set(optarg, ports,
+					RTE_POWER_MAX_VCPU_PER_VM);
 			if (cnt < 0) {
 				printf("Invalid value passed to port-list - [%s]\n",
 						optarg);
 				break;
 			}
 			idx = 0;
-			for (i = 0; i < MAX_VCPU_PER_VM; i++) {
+			for (i = 0; i < RTE_POWER_MAX_VCPU_PER_VM; i++) {
 				if (ports[i]) {
 					printf("***Using port %d\n", i);
 					if (set_policy_mac(i, idx++) != 0) {
@@ -135,13 +138,17 @@ parse_args(int argc, char **argv)
 			break;
 		case 'o':
 			if (!strcmp(optarg, "TRAFFIC"))
-				policy->policy_to_use = TRAFFIC;
+				policy->policy_to_use =
+						RTE_POWER_POLICY_TRAFFIC;
 			else if (!strcmp(optarg, "TIME"))
-				policy->policy_to_use = TIME;
+				policy->policy_to_use =
+						RTE_POWER_POLICY_TIME;
 			else if (!strcmp(optarg, "WORKLOAD"))
-				policy->policy_to_use = WORKLOAD;
+				policy->policy_to_use =
+						RTE_POWER_POLICY_WORKLOAD;
 			else if (!strcmp(optarg, "BRANCH_RATIO"))
-				policy->policy_to_use = BRANCH_RATIO;
+				policy->policy_to_use =
+						RTE_POWER_POLICY_BRANCH_RATIO;
 			else {
 				printf("Invalid policy specified: %s\n",
 						optarg);
diff --git a/examples/vm_power_manager/guest_cli/vm_power_cli_guest.c b/examples/vm_power_manager/guest_cli/vm_power_cli_guest.c
index cf1636e78..02b37d877 100644
--- a/examples/vm_power_manager/guest_cli/vm_power_cli_guest.c
+++ b/examples/vm_power_manager/guest_cli/vm_power_cli_guest.c
@@ -19,7 +19,7 @@
 #include <rte_ethdev.h>
 
 #include <rte_power.h>
-#include <guest_channel.h>
+#include <rte_power_guest_channel.h>
 
 #include "vm_power_cli_guest.h"
 
@@ -38,9 +38,9 @@ union PFID {
 	uint64_t pfid;
 };
 
-static struct channel_packet policy;
+static struct rte_power_channel_packet policy;
 
-struct channel_packet *
+struct rte_power_channel_packet *
 get_policy(void)
 {
 	return &policy;
@@ -49,7 +49,7 @@ get_policy(void)
 int
 set_policy_mac(int port, int idx)
 {
-	struct channel_packet *policy;
+	struct rte_power_channel_packet *policy;
 	union PFID pfid;
 	int ret;
 
@@ -73,7 +73,7 @@ set_policy_mac(int port, int idx)
 }
 
 int
-set_policy_defaults(struct channel_packet *pkt)
+set_policy_defaults(struct rte_power_channel_packet *pkt)
 {
 	int ret;
 
@@ -103,10 +103,10 @@ set_policy_defaults(struct channel_packet *pkt)
 	pkt->timer_policy.hours_to_use_traffic_profile[0] = 8;
 	pkt->timer_policy.hours_to_use_traffic_profile[1] = 10;
 
-	pkt->core_type = CORE_TYPE_VIRTUAL;
-	pkt->workload = LOW;
-	pkt->policy_to_use = TIME;
-	pkt->command = PKT_POLICY;
+	pkt->core_type = RTE_POWER_CORE_TYPE_VIRTUAL;
+	pkt->workload = RTE_POWER_WL_LOW;
+	pkt->policy_to_use = RTE_POWER_POLICY_TIME;
+	pkt->command = RTE_POWER_PKT_POLICY;
 	strlcpy(pkt->vm_name, "ubuntu2", sizeof(pkt->vm_name));
 
 	return 0;
@@ -145,7 +145,7 @@ struct cmd_freq_list_result {
 };
 
 static int
-query_data(struct channel_packet *pkt, unsigned int lcore_id)
+query_data(struct rte_power_channel_packet *pkt, unsigned int lcore_id)
 {
 	int ret;
 	ret = rte_power_guest_channel_send_msg(pkt, lcore_id);
@@ -157,19 +157,19 @@ query_data(struct channel_packet *pkt, unsigned int lcore_id)
 }
 
 static int
-receive_freq_list(struct channel_packet_freq_list *pkt_freq_list,
+receive_freq_list(struct rte_power_channel_packet_freq_list *pkt_freq_list,
 		unsigned int lcore_id)
 {
 	int ret;
 
 	ret = rte_power_guest_channel_receive_msg(pkt_freq_list,
-			sizeof(struct channel_packet_freq_list),
+			sizeof(struct rte_power_channel_packet_freq_list),
 			lcore_id);
 	if (ret < 0) {
 		RTE_LOG(ERR, GUEST_CLI, "Error receiving message.\n");
 		return -1;
 	}
-	if (pkt_freq_list->command != CPU_POWER_FREQ_LIST) {
+	if (pkt_freq_list->command != RTE_POWER_FREQ_LIST) {
 		RTE_LOG(ERR, GUEST_CLI, "Unexpected message received.\n");
 		return -1;
 	}
@@ -183,14 +183,15 @@ cmd_query_freq_list_parsed(void *parsed_result,
 {
 	struct cmd_freq_list_result *res = parsed_result;
 	unsigned int lcore_id;
-	struct channel_packet_freq_list pkt_freq_list;
-	struct channel_packet pkt;
+	struct rte_power_channel_packet_freq_list pkt_freq_list;
+	struct rte_power_channel_packet pkt;
 	bool query_list = false;
 	int ret;
 	char *ep;
 
-	memset(&pkt, 0, sizeof(struct channel_packet));
-	memset(&pkt_freq_list, 0, sizeof(struct channel_packet_freq_list));
+	memset(&pkt, 0, sizeof(struct rte_power_channel_packet));
+	memset(&pkt_freq_list, 0,
+			sizeof(struct rte_power_channel_packet_freq_list));
 
 	if (!strcmp(res->cpu_num, "all")) {
 
@@ -203,18 +204,18 @@ cmd_query_freq_list_parsed(void *parsed_result,
 			return;
 		}
 
-		pkt.command = CPU_POWER_QUERY_FREQ_LIST;
+		pkt.command = RTE_POWER_QUERY_FREQ_LIST;
 		strlcpy(pkt.vm_name, policy.vm_name, sizeof(pkt.vm_name));
 		query_list = true;
 	} else {
 		errno = 0;
 		lcore_id = (unsigned int)strtol(res->cpu_num, &ep, 10);
-		if (errno != 0 || lcore_id >= MAX_VCPU_PER_VM ||
+		if (errno != 0 || lcore_id >= RTE_POWER_MAX_VCPU_PER_VM ||
 			ep == res->cpu_num) {
 			cmdline_printf(cl, "Invalid parameter provided.\n");
 			return;
 		}
-		pkt.command = CPU_POWER_QUERY_FREQ;
+		pkt.command = RTE_POWER_QUERY_FREQ;
 		strlcpy(pkt.vm_name, policy.vm_name, sizeof(pkt.vm_name));
 		pkt.resource_id = lcore_id;
 	}
@@ -267,19 +268,19 @@ struct cmd_query_caps_result {
 };
 
 static int
-receive_capabilities(struct channel_packet_caps_list *pkt_caps_list,
+receive_capabilities(struct rte_power_channel_packet_caps_list *pkt_caps_list,
 		unsigned int lcore_id)
 {
 	int ret;
 
 	ret = rte_power_guest_channel_receive_msg(pkt_caps_list,
-		sizeof(struct channel_packet_caps_list),
+		sizeof(struct rte_power_channel_packet_caps_list),
 		lcore_id);
 	if (ret < 0) {
 		RTE_LOG(ERR, GUEST_CLI, "Error receiving message.\n");
 		return -1;
 	}
-	if (pkt_caps_list->command != CPU_POWER_CAPS_LIST) {
+	if (pkt_caps_list->command != RTE_POWER_CAPS_LIST) {
 		RTE_LOG(ERR, GUEST_CLI, "Unexpected message received.\n");
 		return -1;
 	}
@@ -293,14 +294,15 @@ cmd_query_caps_list_parsed(void *parsed_result,
 {
 	struct cmd_query_caps_result *res = parsed_result;
 	unsigned int lcore_id;
-	struct channel_packet_caps_list pkt_caps_list;
-	struct channel_packet pkt;
+	struct rte_power_channel_packet_caps_list pkt_caps_list;
+	struct rte_power_channel_packet pkt;
 	bool query_list = false;
 	int ret;
 	char *ep;
 
-	memset(&pkt, 0, sizeof(struct channel_packet));
-	memset(&pkt_caps_list, 0, sizeof(struct channel_packet_caps_list));
+	memset(&pkt, 0, sizeof(struct rte_power_channel_packet));
+	memset(&pkt_caps_list, 0,
+			sizeof(struct rte_power_channel_packet_caps_list));
 
 	if (!strcmp(res->cpu_num, "all")) {
 
@@ -313,18 +315,18 @@ cmd_query_caps_list_parsed(void *parsed_result,
 			return;
 		}
 
-		pkt.command = CPU_POWER_QUERY_CAPS_LIST;
+		pkt.command = RTE_POWER_QUERY_CAPS_LIST;
 		strlcpy(pkt.vm_name, policy.vm_name, sizeof(pkt.vm_name));
 		query_list = true;
 	} else {
 		errno = 0;
 		lcore_id = (unsigned int)strtol(res->cpu_num, &ep, 10);
-		if (errno != 0 || lcore_id >= MAX_VCPU_PER_VM ||
+		if (errno != 0 || lcore_id >= RTE_POWER_MAX_VCPU_PER_VM ||
 			ep == res->cpu_num) {
 			cmdline_printf(cl, "Invalid parameter provided.\n");
 			return;
 		}
-		pkt.command = CPU_POWER_QUERY_CAPS;
+		pkt.command = RTE_POWER_QUERY_CAPS;
 		strlcpy(pkt.vm_name, policy.vm_name, sizeof(pkt.vm_name));
 		pkt.resource_id = lcore_id;
 	}
@@ -380,7 +382,7 @@ cmdline_parse_inst_t cmd_query_caps_list = {
 static int
 check_response_cmd(unsigned int lcore_id, int *result)
 {
-	struct channel_packet pkt;
+	struct rte_power_channel_packet pkt;
 	int ret;
 
 	ret = rte_power_guest_channel_receive_msg(&pkt, sizeof pkt, lcore_id);
@@ -388,10 +390,10 @@ check_response_cmd(unsigned int lcore_id, int *result)
 		return -1;
 
 	switch (pkt.command) {
-	case(CPU_POWER_CMD_ACK):
+	case(RTE_POWER_CMD_ACK):
 		*result = 1;
 		break;
-	case(CPU_POWER_CMD_NACK):
+	case(RTE_POWER_CMD_NACK):
 		*result = 0;
 		break;
 	default:
@@ -473,7 +475,7 @@ struct cmd_send_policy_result {
 };
 
 static inline int
-send_policy(struct channel_packet *pkt, struct cmdline *cl)
+send_policy(struct rte_power_channel_packet *pkt, struct cmdline *cl)
 {
 	int ret;
 
diff --git a/examples/vm_power_manager/guest_cli/vm_power_cli_guest.h b/examples/vm_power_manager/guest_cli/vm_power_cli_guest.h
index 6ad14a3de..b578ec072 100644
--- a/examples/vm_power_manager/guest_cli/vm_power_cli_guest.h
+++ b/examples/vm_power_manager/guest_cli/vm_power_cli_guest.h
@@ -9,13 +9,11 @@
 extern "C" {
 #endif
 
-#include "channel_commands.h"
-
-struct channel_packet *get_policy(void);
+struct rte_power_channel_packet *get_policy(void);
 
 int set_policy_mac(int port, int idx);
 
-int set_policy_defaults(struct channel_packet *pkt);
+int set_policy_defaults(struct rte_power_channel_packet *pkt);
 
 void run_cli(__rte_unused void *arg);
 
diff --git a/examples/vm_power_manager/main.c b/examples/vm_power_manager/main.c
index 75d5b5364..799d7b9bc 100644
--- a/examples/vm_power_manager/main.c
+++ b/examples/vm_power_manager/main.c
@@ -394,7 +394,7 @@ main(int argc, char **argv)
 					"Cannot init port %"PRIu8 "\n",
 					portid);
 
-			for (w = 0; w < MAX_VFS; w++) {
+			for (w = 0; w < RTE_POWER_MAX_VFS; w++) {
 				eth.addr_bytes[5] = w + 0xf0;
 
 				ret = -ENOTSUP;
diff --git a/examples/vm_power_manager/vm_power_cli.c b/examples/vm_power_manager/vm_power_cli.c
index ed0623a41..1a55e553b 100644
--- a/examples/vm_power_manager/vm_power_cli.c
+++ b/examples/vm_power_manager/vm_power_cli.c
@@ -21,7 +21,6 @@
 #include "channel_manager.h"
 #include "channel_monitor.h"
 #include "power_manager.h"
-#include "channel_commands.h"
 
 struct cmd_quit_result {
 	cmdline_fixed_string_t quit;
diff --git a/lib/librte_power/channel_commands.h b/lib/librte_power/channel_commands.h
deleted file mode 100644
index adc8e5ca2..000000000
--- a/lib/librte_power/channel_commands.h
+++ /dev/null
@@ -1,125 +0,0 @@
-/* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2010-2014 Intel Corporation
- */
-
-#ifndef CHANNEL_COMMANDS_H_
-#define CHANNEL_COMMANDS_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <stdint.h>
-#include <stdbool.h>
-
-/* --- Incoming messages --- */
-
-/* Valid Commands */
-#define CPU_POWER               1
-#define CPU_POWER_CONNECT       2
-#define PKT_POLICY              3
-#define PKT_POLICY_REMOVE       4
-
-/* CPU Power Command Scaling */
-#define CPU_POWER_SCALE_UP      1
-#define CPU_POWER_SCALE_DOWN    2
-#define CPU_POWER_SCALE_MAX     3
-#define CPU_POWER_SCALE_MIN     4
-#define CPU_POWER_ENABLE_TURBO  5
-#define CPU_POWER_DISABLE_TURBO 6
-
-/* CPU Power Queries */
-#define CPU_POWER_QUERY_FREQ_LIST  7
-#define CPU_POWER_QUERY_FREQ       8
-#define CPU_POWER_QUERY_CAPS_LIST  9
-#define CPU_POWER_QUERY_CAPS       10
-
-/* --- Outgoing messages --- */
-
-/* Generic Power Command Response */
-#define CPU_POWER_CMD_ACK       1
-#define CPU_POWER_CMD_NACK      2
-
-/* CPU Power Query Responses */
-#define CPU_POWER_FREQ_LIST     3
-#define CPU_POWER_CAPS_LIST     4
-
-#define HOURS 24
-
-#define MAX_VFS 10
-#define VM_MAX_NAME_SZ 32
-
-#define MAX_VCPU_PER_VM         8
-
-struct t_boost_status {
-	bool tbEnabled;
-};
-
-struct timer_profile {
-	int busy_hours[HOURS];
-	int quiet_hours[HOURS];
-	int hours_to_use_traffic_profile[HOURS];
-};
-
-enum workload {HIGH, MEDIUM, LOW};
-enum policy_to_use {
-	TRAFFIC,
-	TIME,
-	WORKLOAD,
-	BRANCH_RATIO
-};
-
-struct traffic {
-	uint32_t min_packet_thresh;
-	uint32_t avg_max_packet_thresh;
-	uint32_t max_max_packet_thresh;
-};
-
-#define CORE_TYPE_VIRTUAL 0
-#define CORE_TYPE_PHYSICAL 1
-
-struct channel_packet {
-	uint64_t resource_id; /**< core_num, device */
-	uint32_t unit;        /**< scale down/up/min/max */
-	uint32_t command;     /**< Power, IO, etc */
-	char vm_name[VM_MAX_NAME_SZ];
-
-	uint64_t vfid[MAX_VFS];
-	int nb_mac_to_monitor;
-	struct traffic traffic_policy;
-	uint8_t vcpu_to_control[MAX_VCPU_PER_VM];
-	uint8_t num_vcpu;
-	struct timer_profile timer_policy;
-	bool core_type;
-	enum workload workload;
-	enum policy_to_use policy_to_use;
-	struct t_boost_status t_boost_status;
-};
-
-struct channel_packet_freq_list {
-	uint64_t resource_id; /**< core_num, device */
-	uint32_t unit;        /**< scale down/up/min/max */
-	uint32_t command;     /**< Power, IO, etc */
-	char vm_name[VM_MAX_NAME_SZ];
-
-	uint32_t freq_list[MAX_VCPU_PER_VM];
-	uint8_t num_vcpu;
-};
-
-struct channel_packet_caps_list {
-	uint64_t resource_id; /**< core_num, device */
-	uint32_t unit;        /**< scale down/up/min/max */
-	uint32_t command;     /**< Power, IO, etc */
-	char vm_name[VM_MAX_NAME_SZ];
-
-	uint64_t turbo[MAX_VCPU_PER_VM];
-	uint64_t priority[MAX_VCPU_PER_VM];
-	uint8_t num_vcpu;
-};
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif /* CHANNEL_COMMANDS_H_ */
diff --git a/lib/librte_power/guest_channel.c b/lib/librte_power/guest_channel.c
index 7b5926e5c..2f7507a03 100644
--- a/lib/librte_power/guest_channel.c
+++ b/lib/librte_power/guest_channel.c
@@ -15,9 +15,9 @@
 
 
 #include <rte_log.h>
+#include <rte_power.h>
 
 #include "guest_channel.h"
-#include "channel_commands.h"
 
 #define RTE_LOGTYPE_GUEST_CHANNEL RTE_LOGTYPE_USER1
 
@@ -55,7 +55,7 @@ int
 guest_channel_host_connect(const char *path, unsigned int lcore_id)
 {
 	int flags, ret;
-	struct channel_packet pkt;
+	struct rte_power_channel_packet pkt;
 	char fd_path[PATH_MAX];
 	int fd = -1;
 
@@ -100,7 +100,7 @@ guest_channel_host_connect(const char *path, unsigned int lcore_id)
 	/* Send a test packet, this command is ignored by the host, but a successful
 	 * send indicates that the host endpoint is monitoring.
 	 */
-	pkt.command = CPU_POWER_CONNECT;
+	pkt.command = RTE_POWER_CPU_POWER_CONNECT;
 	global_fds[lcore_id] = fd;
 	ret = guest_channel_send_msg(&pkt, lcore_id);
 	if (ret != 0) {
@@ -119,7 +119,8 @@ guest_channel_host_connect(const char *path, unsigned int lcore_id)
 }
 
 int
-guest_channel_send_msg(struct channel_packet *pkt, unsigned int lcore_id)
+guest_channel_send_msg(struct rte_power_channel_packet *pkt,
+		unsigned int lcore_id)
 {
 	int ret, buffer_len = sizeof(*pkt);
 	void *buffer = pkt;
@@ -149,7 +150,7 @@ guest_channel_send_msg(struct channel_packet *pkt, unsigned int lcore_id)
 	return 0;
 }
 
-int rte_power_guest_channel_send_msg(struct channel_packet *pkt,
+int rte_power_guest_channel_send_msg(struct rte_power_channel_packet *pkt,
 			unsigned int lcore_id)
 {
 	return guest_channel_send_msg(pkt, lcore_id);
diff --git a/lib/librte_power/guest_channel.h b/lib/librte_power/guest_channel.h
index e15db46fc..0c01cdffa 100644
--- a/lib/librte_power/guest_channel.h
+++ b/lib/librte_power/guest_channel.h
@@ -8,7 +8,7 @@
 extern "C" {
 #endif
 
-#include <channel_commands.h>
+struct rte_power_channel_packet;
 
 /**
  * Check if any Virtio-Serial VM end-points exist in path.
@@ -63,23 +63,9 @@ void guest_channel_host_disconnect(unsigned int lcore_id);
  *  - Negative on channel not connected.
  *  - errno on write to channel error.
  */
-int guest_channel_send_msg(struct channel_packet *pkt, unsigned int lcore_id);
+int guest_channel_send_msg(struct rte_power_channel_packet *pkt,
+		unsigned int lcore_id);
 
-/**
- * Send a message contained in pkt over the Virtio-Serial to the host endpoint.
- *
- * @param pkt
- *  Pointer to a populated struct channel_packet
- *
- * @param lcore_id
- *  lcore_id.
- *
- * @return
- *  - 0 on success.
- *  - Negative on error.
- */
-int rte_power_guest_channel_send_msg(struct channel_packet *pkt,
-			unsigned int lcore_id);
 
 /**
  * Read a message contained in pkt over the Virtio-Serial
@@ -103,31 +89,6 @@ int power_guest_channel_read_msg(void *pkt,
 		size_t pkt_len,
 		unsigned int lcore_id);
 
-/**
- * Receive a message contained in pkt over the Virtio-Serial
- * from the host endpoint.
- *
- * @param pkt
- *  Pointer to channel_packet or
- *  channel_packet_freq_list struct.
- *
- * @param pkt_len
- *  Size of expected data packet.
- *
- * @param lcore_id
- *  lcore_id.
- *
- * @return
- *  - 0 on success.
- *  - Negative on error.
- */
-__rte_experimental
-int
-rte_power_guest_channel_receive_msg(void *pkt,
-		size_t pkt_len,
-		unsigned int lcore_id);
-
-
 #ifdef __cplusplus
 }
 #endif
diff --git a/lib/librte_power/meson.build b/lib/librte_power/meson.build
index 4b4cf1b90..541569528 100644
--- a/lib/librte_power/meson.build
+++ b/lib/librte_power/meson.build
@@ -10,5 +10,6 @@ sources = files('rte_power.c', 'power_acpi_cpufreq.c',
 		'rte_power_empty_poll.c',
 		'power_pstate_cpufreq.c',
 		'power_common.c')
-headers = files('rte_power.h','rte_power_empty_poll.h')
+headers = files('rte_power.h','rte_power_empty_poll.h',
+	'rte_power_guest_channel.h')
 deps += ['timer']
diff --git a/lib/librte_power/power_kvm_vm.c b/lib/librte_power/power_kvm_vm.c
index 409c3e03a..c15438a01 100644
--- a/lib/librte_power/power_kvm_vm.c
+++ b/lib/librte_power/power_kvm_vm.c
@@ -7,13 +7,12 @@
 #include <rte_log.h>
 
 #include "guest_channel.h"
-#include "channel_commands.h"
 #include "power_kvm_vm.h"
 #include "power_common.h"
 
 #define FD_PATH "/dev/virtio-ports/virtio.serial.port.poweragent"
 
-static struct channel_packet pkt[RTE_MAX_LCORE];
+static struct rte_power_channel_packet pkt[RTE_MAX_LCORE];
 
 int
 power_kvm_vm_check_supported(void)
@@ -29,7 +28,7 @@ power_kvm_vm_init(unsigned int lcore_id)
 				lcore_id, RTE_MAX_LCORE-1);
 		return -1;
 	}
-	pkt[lcore_id].command = CPU_POWER;
+	pkt[lcore_id].command = RTE_POWER_CPU_POWER;
 	pkt[lcore_id].resource_id = lcore_id;
 	return guest_channel_host_connect(FD_PATH, lcore_id);
 }
@@ -90,25 +89,25 @@ send_msg(unsigned int lcore_id, uint32_t scale_direction)
 int
 power_kvm_vm_freq_up(unsigned int lcore_id)
 {
-	return send_msg(lcore_id, CPU_POWER_SCALE_UP);
+	return send_msg(lcore_id, RTE_POWER_SCALE_UP);
 }
 
 int
 power_kvm_vm_freq_down(unsigned int lcore_id)
 {
-	return send_msg(lcore_id, CPU_POWER_SCALE_DOWN);
+	return send_msg(lcore_id, RTE_POWER_SCALE_DOWN);
 }
 
 int
 power_kvm_vm_freq_max(unsigned int lcore_id)
 {
-	return send_msg(lcore_id, CPU_POWER_SCALE_MAX);
+	return send_msg(lcore_id, RTE_POWER_SCALE_MAX);
 }
 
 int
 power_kvm_vm_freq_min(unsigned int lcore_id)
 {
-	return send_msg(lcore_id, CPU_POWER_SCALE_MIN);
+	return send_msg(lcore_id, RTE_POWER_SCALE_MIN);
 }
 
 int
@@ -121,13 +120,13 @@ power_kvm_vm_turbo_status(__rte_unused unsigned int lcore_id)
 int
 power_kvm_vm_enable_turbo(unsigned int lcore_id)
 {
-	return send_msg(lcore_id, CPU_POWER_ENABLE_TURBO);
+	return send_msg(lcore_id, RTE_POWER_ENABLE_TURBO);
 }
 
 int
 power_kvm_vm_disable_turbo(unsigned int lcore_id)
 {
-	return send_msg(lcore_id, CPU_POWER_DISABLE_TURBO);
+	return send_msg(lcore_id, RTE_POWER_DISABLE_TURBO);
 }
 
 struct rte_power_core_capabilities;
diff --git a/lib/librte_power/rte_power.h b/lib/librte_power/rte_power.h
index bbbde4dfb..c8086bf6b 100644
--- a/lib/librte_power/rte_power.h
+++ b/lib/librte_power/rte_power.h
@@ -14,6 +14,7 @@
 #include <rte_byteorder.h>
 #include <rte_log.h>
 #include <rte_string_fns.h>
+#include <rte_power_guest_channel.h>
 
 #ifdef __cplusplus
 extern "C" {
diff --git a/lib/librte_power/rte_power_guest_channel.h b/lib/librte_power/rte_power_guest_channel.h
new file mode 100644
index 000000000..441c42262
--- /dev/null
+++ b/lib/librte_power/rte_power_guest_channel.h
@@ -0,0 +1,160 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2010-2020 Intel Corporation
+ */
+#ifndef RTE_POWER_GUEST_CHANNEL_H
+#define RTE_POWER_GUEST_CHANNEL_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define RTE_POWER_MAX_VFS 10
+#define RTE_POWER_VM_MAX_NAME_SZ 32
+#define RTE_POWER_MAX_VCPU_PER_VM 8
+#define RTE_POWER_HOURS_PER_DAY 24
+
+/* Valid Commands */
+#define RTE_POWER_CPU_POWER               1
+#define RTE_POWER_CPU_POWER_CONNECT       2
+#define RTE_POWER_PKT_POLICY              3
+#define RTE_POWER_PKT_POLICY_REMOVE       4
+
+#define RTE_POWER_CORE_TYPE_VIRTUAL 0
+#define RTE_POWER_CORE_TYPE_PHYSICAL 1
+
+/* CPU Power Command Scaling */
+#define RTE_POWER_SCALE_UP      1
+#define RTE_POWER_SCALE_DOWN    2
+#define RTE_POWER_SCALE_MAX     3
+#define RTE_POWER_SCALE_MIN     4
+#define RTE_POWER_ENABLE_TURBO  5
+#define RTE_POWER_DISABLE_TURBO 6
+
+/* CPU Power Queries */
+#define RTE_POWER_QUERY_FREQ_LIST  7
+#define RTE_POWER_QUERY_FREQ       8
+#define RTE_POWER_QUERY_CAPS_LIST  9
+#define RTE_POWER_QUERY_CAPS       10
+
+/* Generic Power Command Response */
+#define RTE_POWER_CMD_ACK       1
+#define RTE_POWER_CMD_NACK      2
+
+/* CPU Power Query Responses */
+#define RTE_POWER_FREQ_LIST     3
+#define RTE_POWER_CAPS_LIST     4
+
+struct rte_power_traffic_policy {
+	uint32_t min_packet_thresh;
+	uint32_t avg_max_packet_thresh;
+	uint32_t max_max_packet_thresh;
+};
+
+struct rte_power_timer_profile {
+	int busy_hours[RTE_POWER_HOURS_PER_DAY];
+	int quiet_hours[RTE_POWER_HOURS_PER_DAY];
+	int hours_to_use_traffic_profile[RTE_POWER_HOURS_PER_DAY];
+};
+
+enum rte_power_workload_level {
+	RTE_POWER_WL_HIGH,
+	RTE_POWER_WL_MEDIUM,
+	RTE_POWER_WL_LOW
+};
+
+enum rte_power_policy {
+	RTE_POWER_POLICY_TRAFFIC,
+	RTE_POWER_POLICY_TIME,
+	RTE_POWER_POLICY_WORKLOAD,
+	RTE_POWER_POLICY_BRANCH_RATIO
+};
+
+struct rte_power_turbo_status {
+	bool tbEnabled;
+};
+
+struct rte_power_channel_packet {
+	uint64_t resource_id; /**< core_num, device */
+	uint32_t unit;        /**< scale down/up/min/max */
+	uint32_t command;     /**< Power, IO, etc */
+	char vm_name[RTE_POWER_VM_MAX_NAME_SZ];
+
+	uint64_t vfid[RTE_POWER_MAX_VFS];
+	int nb_mac_to_monitor;
+	struct rte_power_traffic_policy traffic_policy;
+	uint8_t vcpu_to_control[RTE_POWER_MAX_VCPU_PER_VM];
+	uint8_t num_vcpu;
+	struct rte_power_timer_profile timer_policy;
+	bool core_type;
+	enum rte_power_workload_level workload;
+	enum rte_power_policy policy_to_use;
+	struct rte_power_turbo_status t_boost_status;
+};
+
+struct rte_power_channel_packet_freq_list {
+	uint64_t resource_id; /**< core_num, device */
+	uint32_t unit;        /**< scale down/up/min/max */
+	uint32_t command;     /**< Power, IO, etc */
+	char vm_name[RTE_POWER_VM_MAX_NAME_SZ];
+
+	uint32_t freq_list[RTE_POWER_MAX_VCPU_PER_VM];
+	uint8_t num_vcpu;
+};
+
+struct rte_power_channel_packet_caps_list {
+	uint64_t resource_id; /**< core_num, device */
+	uint32_t unit;        /**< scale down/up/min/max */
+	uint32_t command;     /**< Power, IO, etc */
+	char vm_name[RTE_POWER_VM_MAX_NAME_SZ];
+
+	uint64_t turbo[RTE_POWER_MAX_VCPU_PER_VM];
+	uint64_t priority[RTE_POWER_MAX_VCPU_PER_VM];
+	uint8_t num_vcpu;
+};
+
+/**
+ * Send a message contained in pkt over the Virtio-Serial to the host endpoint.
+ *
+ * @param pkt
+ *  Pointer to a populated struct channel_packet
+ *
+ * @param lcore_id
+ *  lcore_id.
+ *
+ * @return
+ *  - 0 on success.
+ *  - Negative on error.
+ */
+int rte_power_guest_channel_send_msg(struct rte_power_channel_packet *pkt,
+			unsigned int lcore_id);
+
+/**
+ * Receive a message contained in pkt over the Virtio-Serial
+ * from the host endpoint.
+ *
+ * @param pkt
+ *  Pointer to channel_packet or
+ *  channel_packet_freq_list struct.
+ *
+ * @param pkt_len
+ *  Size of expected data packet.
+ *
+ * @param lcore_id
+ *  lcore_id.
+ *
+ * @return
+ *  - 0 on success.
+ *  - Negative on error.
+ */
+__rte_experimental
+int
+rte_power_guest_channel_receive_msg(void *pkt,
+		size_t pkt_len,
+		unsigned int lcore_id);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
-- 
2.17.1


^ permalink raw reply	[flat|nested] 69+ messages in thread

* [dpdk-dev] [PATCH 0/6] power: fix make build for power apps
  2020-12-17 11:36 [dpdk-dev] [PATCH v1] power: fix make build for power apps David Hunt
@ 2021-01-08 14:30 ` David Hunt
  2021-01-08 14:30   ` [dpdk-dev] [PATCH v2 1/6] power: create guest channel public header file David Hunt
                     ` (6 more replies)
  0 siblings, 7 replies; 69+ messages in thread
From: David Hunt @ 2021-01-08 14:30 UTC (permalink / raw)
  To: dev; +Cc: david.hunt, stable

The power example applications that uses the virtio-serial method of
communication cannot currently be built with make, and can only be built
using meson/ninja.

The guest channel message definitions and functions in guest_channel.h
are needed by applications and need to be made public.

This worked pre-20.11, but now with all the meson/ninja changes, making
these apps externally no longer works. To fix, we need to move the header
file with the API definitions for the channel commands public, and rename
the functions accordingly.

The main change is to rename channel_commands.h to
rte_power_guest_channel.h so that it gets picked up by the installer and
copied to /usr/local/include. Other changes include renaming #defines to
have RTE_ at the beginning instead of CPU_. Finally we refactor the code
to work with those changes.

---
v2 changes
  - re-worked from monolithic patch to a 6 patch patchset for easier review

[PATCH v2 1/6] power: create guest channel public header file
[PATCH v2 2/6] power: make channel msg functions public
[PATCH v2 3/6] power: rename public structs
[PATCH v2 4/6] power: rename defines
[PATCH v2 5/6] power: add new header file to export list
[PATCH v2 6/6] power: clean up includes


^ permalink raw reply	[flat|nested] 69+ messages in thread

* [dpdk-dev] [PATCH v2 1/6] power: create guest channel public header file
  2021-01-08 14:30 ` [dpdk-dev] [PATCH 0/6] " David Hunt
@ 2021-01-08 14:30   ` David Hunt
  2021-01-20 13:55     ` [dpdk-dev] [PATCH v3 0/6] power: fix make build for power apps David Hunt
  2021-01-08 14:30   ` [dpdk-dev] [PATCH v2 2/6] power: make channel msg functions public David Hunt
                     ` (5 subsequent siblings)
  6 siblings, 1 reply; 69+ messages in thread
From: David Hunt @ 2021-01-08 14:30 UTC (permalink / raw)
  To: dev; +Cc: david.hunt, stable, Bruce Richardson

From: Bruce Richardson <bruce.richardson@intel.com>

In preparation for making the header file public, we first rename
channel_commands.h as rte_power_guest_channel.h.

Fixes: 210c383e247b ("power: packet format for vm power management")
Fixes: cd0d5547e873 ("power: vm communication channels in guest")
Cc: stable@dpdk.org

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: David Hunt <david.hunt@intel.com>
---
 examples/vm_power_manager/channel_manager.c              | 2 +-
 examples/vm_power_manager/channel_monitor.c              | 2 +-
 examples/vm_power_manager/channel_monitor.h              | 2 +-
 examples/vm_power_manager/guest_cli/vm_power_cli_guest.h | 2 +-
 examples/vm_power_manager/vm_power_cli.c                 | 2 +-
 lib/librte_power/guest_channel.c                         | 2 +-
 lib/librte_power/guest_channel.h                         | 2 +-
 lib/librte_power/power_kvm_vm.c                          | 2 +-
 .../{channel_commands.h => rte_power_guest_channel.h}    | 9 ++++-----
 9 files changed, 12 insertions(+), 13 deletions(-)
 rename lib/librte_power/{channel_commands.h => rte_power_guest_channel.h} (94%)

diff --git a/examples/vm_power_manager/channel_manager.c b/examples/vm_power_manager/channel_manager.c
index a26315051..c7d5bf5a8 100644
--- a/examples/vm_power_manager/channel_manager.c
+++ b/examples/vm_power_manager/channel_manager.c
@@ -27,7 +27,7 @@
 #include <libvirt/libvirt.h>
 
 #include "channel_manager.h"
-#include "channel_commands.h"
+#include "rte_power_guest_channel.h"
 #include "channel_monitor.h"
 #include "power_manager.h"
 
diff --git a/examples/vm_power_manager/channel_monitor.c b/examples/vm_power_manager/channel_monitor.c
index 228f06803..08306105d 100644
--- a/examples/vm_power_manager/channel_monitor.c
+++ b/examples/vm_power_manager/channel_monitor.c
@@ -35,7 +35,7 @@
 
 #include <libvirt/libvirt.h>
 #include "channel_monitor.h"
-#include "channel_commands.h"
+#include "rte_power_guest_channel.h"
 #include "channel_manager.h"
 #include "power_manager.h"
 #include "oob_monitor.h"
diff --git a/examples/vm_power_manager/channel_monitor.h b/examples/vm_power_manager/channel_monitor.h
index 7362a80d2..4a526ff67 100644
--- a/examples/vm_power_manager/channel_monitor.h
+++ b/examples/vm_power_manager/channel_monitor.h
@@ -6,7 +6,7 @@
 #define CHANNEL_MONITOR_H_
 
 #include "channel_manager.h"
-#include "channel_commands.h"
+#include "rte_power_guest_channel.h"
 
 struct core_share {
 	unsigned int pcpu;
diff --git a/examples/vm_power_manager/guest_cli/vm_power_cli_guest.h b/examples/vm_power_manager/guest_cli/vm_power_cli_guest.h
index 6ad14a3de..2299d23dc 100644
--- a/examples/vm_power_manager/guest_cli/vm_power_cli_guest.h
+++ b/examples/vm_power_manager/guest_cli/vm_power_cli_guest.h
@@ -9,7 +9,7 @@
 extern "C" {
 #endif
 
-#include "channel_commands.h"
+#include "rte_power_guest_channel.h"
 
 struct channel_packet *get_policy(void);
 
diff --git a/examples/vm_power_manager/vm_power_cli.c b/examples/vm_power_manager/vm_power_cli.c
index ed0623a41..f7e1b596e 100644
--- a/examples/vm_power_manager/vm_power_cli.c
+++ b/examples/vm_power_manager/vm_power_cli.c
@@ -21,7 +21,7 @@
 #include "channel_manager.h"
 #include "channel_monitor.h"
 #include "power_manager.h"
-#include "channel_commands.h"
+#include "rte_power_guest_channel.h"
 
 struct cmd_quit_result {
 	cmdline_fixed_string_t quit;
diff --git a/lib/librte_power/guest_channel.c b/lib/librte_power/guest_channel.c
index 7b5926e5c..4cb5ae1dd 100644
--- a/lib/librte_power/guest_channel.c
+++ b/lib/librte_power/guest_channel.c
@@ -17,7 +17,7 @@
 #include <rte_log.h>
 
 #include "guest_channel.h"
-#include "channel_commands.h"
+#include "rte_power_guest_channel.h"
 
 #define RTE_LOGTYPE_GUEST_CHANNEL RTE_LOGTYPE_USER1
 
diff --git a/lib/librte_power/guest_channel.h b/lib/librte_power/guest_channel.h
index e15db46fc..d3d87f0ae 100644
--- a/lib/librte_power/guest_channel.h
+++ b/lib/librte_power/guest_channel.h
@@ -8,7 +8,7 @@
 extern "C" {
 #endif
 
-#include <channel_commands.h>
+#include <rte_power_guest_channel.h>
 
 /**
  * Check if any Virtio-Serial VM end-points exist in path.
diff --git a/lib/librte_power/power_kvm_vm.c b/lib/librte_power/power_kvm_vm.c
index 409c3e03a..649ebe85c 100644
--- a/lib/librte_power/power_kvm_vm.c
+++ b/lib/librte_power/power_kvm_vm.c
@@ -7,7 +7,7 @@
 #include <rte_log.h>
 
 #include "guest_channel.h"
-#include "channel_commands.h"
+#include "rte_power_guest_channel.h"
 #include "power_kvm_vm.h"
 #include "power_common.h"
 
diff --git a/lib/librte_power/channel_commands.h b/lib/librte_power/rte_power_guest_channel.h
similarity index 94%
rename from lib/librte_power/channel_commands.h
rename to lib/librte_power/rte_power_guest_channel.h
index adc8e5ca2..ef3b064a8 100644
--- a/lib/librte_power/channel_commands.h
+++ b/lib/librte_power/rte_power_guest_channel.h
@@ -1,9 +1,8 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2010-2014 Intel Corporation
+ * Copyright(c) 2010-2021 Intel Corporation
  */
-
-#ifndef CHANNEL_COMMANDS_H_
-#define CHANNEL_COMMANDS_H_
+#ifndef RTE_POWER_GUEST_CHANNEL_H
+#define RTE_POWER_GUEST_CHANNEL_H
 
 #ifdef __cplusplus
 extern "C" {
@@ -122,4 +121,4 @@ struct channel_packet_caps_list {
 }
 #endif
 
-#endif /* CHANNEL_COMMANDS_H_ */
+#endif /* RTE_POWER_GUEST_CHANNEL_H_ */
-- 
2.17.1


^ permalink raw reply	[flat|nested] 69+ messages in thread

* [dpdk-dev] [PATCH v2 2/6] power: make channel msg functions public
  2021-01-08 14:30 ` [dpdk-dev] [PATCH 0/6] " David Hunt
  2021-01-08 14:30   ` [dpdk-dev] [PATCH v2 1/6] power: create guest channel public header file David Hunt
@ 2021-01-08 14:30   ` David Hunt
  2021-01-19 14:31     ` [dpdk-dev] [dpdk-stable] " Thomas Monjalon
  2021-01-08 14:30   ` [dpdk-dev] [PATCH v2 3/6] power: rename public structs David Hunt
                     ` (4 subsequent siblings)
  6 siblings, 1 reply; 69+ messages in thread
From: David Hunt @ 2021-01-08 14:30 UTC (permalink / raw)
  To: dev; +Cc: david.hunt, stable, Bruce Richardson

From: Bruce Richardson <bruce.richardson@intel.com>

Move the 2 public functions into rte_power_guest_channel.h

Fixes: 210c383e247b ("power: packet format for vm power management")
Fixes: cd0d5547e873 ("power: vm communication channels in guest")
Cc: stable@dpdk.org

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: David Hunt <david.hunt@intel.com>
---
 lib/librte_power/guest_channel.h           | 40 +---------------------
 lib/librte_power/rte_power_guest_channel.h | 40 ++++++++++++++++++++++
 2 files changed, 41 insertions(+), 39 deletions(-)

diff --git a/lib/librte_power/guest_channel.h b/lib/librte_power/guest_channel.h
index d3d87f0ae..69020b030 100644
--- a/lib/librte_power/guest_channel.h
+++ b/lib/librte_power/guest_channel.h
@@ -65,21 +65,7 @@ void guest_channel_host_disconnect(unsigned int 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.
- *
- * @param pkt
- *  Pointer to a populated struct channel_packet
- *
- * @param lcore_id
- *  lcore_id.
- *
- * @return
- *  - 0 on success.
- *  - Negative on error.
- */
-int rte_power_guest_channel_send_msg(struct channel_packet *pkt,
-			unsigned int lcore_id);
+
 
 /**
  * Read a message contained in pkt over the Virtio-Serial
@@ -103,30 +89,6 @@ int power_guest_channel_read_msg(void *pkt,
 		size_t pkt_len,
 		unsigned int lcore_id);
 
-/**
- * Receive a message contained in pkt over the Virtio-Serial
- * from the host endpoint.
- *
- * @param pkt
- *  Pointer to channel_packet or
- *  channel_packet_freq_list struct.
- *
- * @param pkt_len
- *  Size of expected data packet.
- *
- * @param lcore_id
- *  lcore_id.
- *
- * @return
- *  - 0 on success.
- *  - Negative on error.
- */
-__rte_experimental
-int
-rte_power_guest_channel_receive_msg(void *pkt,
-		size_t pkt_len,
-		unsigned int lcore_id);
-
 
 #ifdef __cplusplus
 }
diff --git a/lib/librte_power/rte_power_guest_channel.h b/lib/librte_power/rte_power_guest_channel.h
index ef3b064a8..6e66ce47f 100644
--- a/lib/librte_power/rte_power_guest_channel.h
+++ b/lib/librte_power/rte_power_guest_channel.h
@@ -116,6 +116,46 @@ struct channel_packet_caps_list {
 	uint8_t num_vcpu;
 };
 
+/**
+ * Send a message contained in pkt over the Virtio-Serial to the host endpoint.
+ *
+ * @param pkt
+ *  Pointer to a populated struct channel_packet
+ *
+ * @param lcore_id
+ *  lcore_id.
+ *
+ * @return
+ *  - 0 on success.
+ *  - Negative on error.
+ */
+int rte_power_guest_channel_send_msg(struct channel_packet *pkt,
+			unsigned int lcore_id);
+
+/**
+ * Receive a message contained in pkt over the Virtio-Serial
+ * from the host endpoint.
+ *
+ * @param pkt
+ *  Pointer to channel_packet or
+ *  channel_packet_freq_list struct.
+ *
+ * @param pkt_len
+ *  Size of expected data packet.
+ *
+ * @param lcore_id
+ *  lcore_id.
+ *
+ * @return
+ *  - 0 on success.
+ *  - Negative on error.
+ */
+__rte_experimental
+int
+rte_power_guest_channel_receive_msg(void *pkt,
+		size_t pkt_len,
+		unsigned int lcore_id);
+
 
 #ifdef __cplusplus
 }
-- 
2.17.1


^ permalink raw reply	[flat|nested] 69+ messages in thread

* [dpdk-dev] [PATCH v2 3/6] power: rename public structs
  2021-01-08 14:30 ` [dpdk-dev] [PATCH 0/6] " David Hunt
  2021-01-08 14:30   ` [dpdk-dev] [PATCH v2 1/6] power: create guest channel public header file David Hunt
  2021-01-08 14:30   ` [dpdk-dev] [PATCH v2 2/6] power: make channel msg functions public David Hunt
@ 2021-01-08 14:30   ` David Hunt
  2021-01-08 14:30   ` [dpdk-dev] [PATCH v2 4/6] power: rename defines David Hunt
                     ` (3 subsequent siblings)
  6 siblings, 0 replies; 69+ messages in thread
From: David Hunt @ 2021-01-08 14:30 UTC (permalink / raw)
  To: dev; +Cc: david.hunt, stable, Bruce Richardson

From: Bruce Richardson <bruce.richardson@intel.com>

rename the public structs to have an rte_power_ prefix.

Fixes: 210c383e247b ("power: packet format for vm power management")
Fixes: cd0d5547e873 ("power: vm communication channels in guest")
Cc: stable@dpdk.org

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: David Hunt <david.hunt@intel.com>
---
 examples/vm_power_manager/channel_monitor.c   | 33 ++++++------
 examples/vm_power_manager/channel_monitor.h   |  2 +-
 examples/vm_power_manager/guest_cli/main.c    |  2 +-
 .../guest_cli/vm_power_cli_guest.c            | 40 ++++++++-------
 .../guest_cli/vm_power_cli_guest.h            |  4 +-
 lib/librte_power/guest_channel.c              |  7 +--
 lib/librte_power/guest_channel.h              |  7 +--
 lib/librte_power/power_kvm_vm.c               |  2 +-
 lib/librte_power/rte_power_guest_channel.h    | 51 +++++++++----------
 9 files changed, 75 insertions(+), 73 deletions(-)

diff --git a/examples/vm_power_manager/channel_monitor.c b/examples/vm_power_manager/channel_monitor.c
index 08306105d..5d5383494 100644
--- a/examples/vm_power_manager/channel_monitor.c
+++ b/examples/vm_power_manager/channel_monitor.c
@@ -108,7 +108,7 @@ str_to_ether_addr(const char *a, struct rte_ether_addr *ether_addr)
 }
 
 static int
-set_policy_mac(struct channel_packet *pkt, int idx, char *mac)
+set_policy_mac(struct rte_power_channel_packet *pkt, int idx, char *mac)
 {
 	union PFID pfid;
 	int ret;
@@ -165,7 +165,7 @@ get_resource_id_from_vmname(const char *vm_name)
 }
 
 static int
-parse_json_to_pkt(json_t *element, struct channel_packet *pkt,
+parse_json_to_pkt(json_t *element, struct rte_power_channel_packet *pkt,
 					const char *vm_name)
 {
 	const char *key;
@@ -173,7 +173,7 @@ parse_json_to_pkt(json_t *element, struct channel_packet *pkt,
 	int ret;
 	int resource_id;
 
-	memset(pkt, 0, sizeof(struct channel_packet));
+	memset(pkt, 0, sizeof(struct rte_power_channel_packet));
 
 	pkt->nb_mac_to_monitor = 0;
 	pkt->t_boost_status.tbEnabled = false;
@@ -463,7 +463,7 @@ get_pfid(struct policy *pol)
 }
 
 static int
-update_policy(struct channel_packet *pkt)
+update_policy(struct rte_power_channel_packet *pkt)
 {
 
 	unsigned int updated = 0;
@@ -512,7 +512,7 @@ update_policy(struct channel_packet *pkt)
 }
 
 static int
-remove_policy(struct channel_packet *pkt __rte_unused)
+remove_policy(struct rte_power_channel_packet *pkt __rte_unused)
 {
 	unsigned int i;
 
@@ -673,7 +673,7 @@ static void
 apply_policy(struct policy *pol)
 {
 
-	struct channel_packet *pkt = &pol->pkt;
+	struct rte_power_channel_packet *pkt = &pol->pkt;
 
 	/*Check policy to use*/
 	if (pkt->policy_to_use == TRAFFIC)
@@ -715,12 +715,12 @@ write_binary_packet(void *buffer,
 }
 
 static int
-send_freq(struct channel_packet *pkt,
+send_freq(struct rte_power_channel_packet *pkt,
 		struct channel_info *chan_info,
 		bool freq_list)
 {
 	unsigned int vcore_id = pkt->resource_id;
-	struct channel_packet_freq_list channel_pkt_freq_list;
+	struct rte_power_channel_packet_freq_list channel_pkt_freq_list;
 	struct vm_info info;
 
 	if (get_info_vm(pkt->vm_name, &info) != 0)
@@ -751,12 +751,12 @@ send_freq(struct channel_packet *pkt,
 }
 
 static int
-send_capabilities(struct channel_packet *pkt,
+send_capabilities(struct rte_power_channel_packet *pkt,
 		struct channel_info *chan_info,
 		bool list_requested)
 {
 	unsigned int vcore_id = pkt->resource_id;
-	struct channel_packet_caps_list channel_pkt_caps_list;
+	struct rte_power_channel_packet_caps_list channel_pkt_caps_list;
 	struct vm_info info;
 	struct rte_power_core_capabilities caps;
 	int ret;
@@ -805,18 +805,19 @@ send_capabilities(struct channel_packet *pkt,
 }
 
 static int
-send_ack_for_received_cmd(struct channel_packet *pkt,
+send_ack_for_received_cmd(struct rte_power_channel_packet *pkt,
 		struct channel_info *chan_info,
 		uint32_t command)
 {
 	pkt->command = command;
 	return write_binary_packet(pkt,
-			sizeof(struct channel_packet),
+			sizeof(struct rte_power_channel_packet),
 			chan_info);
 }
 
 static int
-process_request(struct channel_packet *pkt, struct channel_info *chan_info)
+process_request(struct rte_power_channel_packet *pkt,
+		struct channel_info *chan_info)
 {
 	int ret;
 
@@ -988,7 +989,7 @@ channel_monitor_init(void)
 static void
 read_binary_packet(struct channel_info *chan_info)
 {
-	struct channel_packet pkt;
+	struct rte_power_channel_packet pkt;
 	void *buffer = &pkt;
 	int buffer_len = sizeof(pkt);
 	int n_bytes, err = 0;
@@ -1019,7 +1020,7 @@ read_binary_packet(struct channel_info *chan_info)
 static void
 read_json_packet(struct channel_info *chan_info)
 {
-	struct channel_packet pkt;
+	struct rte_power_channel_packet pkt;
 	int n_bytes, ret;
 	json_t *root;
 	json_error_t error;
@@ -1063,7 +1064,7 @@ read_json_packet(struct channel_info *chan_info)
 			/*
 			 * Because our data is now in the json
 			 * object, we can overwrite the pkt
-			 * with a channel_packet struct, using
+			 * with a rte_power_channel_packet struct, using
 			 * parse_json_to_pkt()
 			 */
 			ret = parse_json_to_pkt(root, &pkt, resource_name);
diff --git a/examples/vm_power_manager/channel_monitor.h b/examples/vm_power_manager/channel_monitor.h
index 4a526ff67..0ca6207ad 100644
--- a/examples/vm_power_manager/channel_monitor.h
+++ b/examples/vm_power_manager/channel_monitor.h
@@ -18,7 +18,7 @@ struct core_share {
 };
 
 struct policy {
-	struct channel_packet pkt;
+	struct rte_power_channel_packet pkt;
 	uint32_t pfid[MAX_VFS];
 	uint32_t port[MAX_VFS];
 	unsigned int enabled;
diff --git a/examples/vm_power_manager/guest_cli/main.c b/examples/vm_power_manager/guest_cli/main.c
index f63b3c988..fc7a8c30a 100644
--- a/examples/vm_power_manager/guest_cli/main.c
+++ b/examples/vm_power_manager/guest_cli/main.c
@@ -48,7 +48,7 @@ parse_args(int argc, char **argv)
 		{ "policy", required_argument, 0, 'o'},
 		{NULL, 0, 0, 0}
 	};
-	struct channel_packet *policy;
+	struct rte_power_channel_packet *policy;
 	unsigned short int hours[MAX_HOURS];
 	unsigned short int cores[MAX_VCPU_PER_VM];
 	unsigned short int ports[MAX_VCPU_PER_VM];
diff --git a/examples/vm_power_manager/guest_cli/vm_power_cli_guest.c b/examples/vm_power_manager/guest_cli/vm_power_cli_guest.c
index cf1636e78..b7c8f850e 100644
--- a/examples/vm_power_manager/guest_cli/vm_power_cli_guest.c
+++ b/examples/vm_power_manager/guest_cli/vm_power_cli_guest.c
@@ -38,9 +38,9 @@ union PFID {
 	uint64_t pfid;
 };
 
-static struct channel_packet policy;
+static struct rte_power_channel_packet policy;
 
-struct channel_packet *
+struct rte_power_channel_packet *
 get_policy(void)
 {
 	return &policy;
@@ -49,7 +49,7 @@ get_policy(void)
 int
 set_policy_mac(int port, int idx)
 {
-	struct channel_packet *policy;
+	struct rte_power_channel_packet *policy;
 	union PFID pfid;
 	int ret;
 
@@ -73,7 +73,7 @@ set_policy_mac(int port, int idx)
 }
 
 int
-set_policy_defaults(struct channel_packet *pkt)
+set_policy_defaults(struct rte_power_channel_packet *pkt)
 {
 	int ret;
 
@@ -145,7 +145,7 @@ struct cmd_freq_list_result {
 };
 
 static int
-query_data(struct channel_packet *pkt, unsigned int lcore_id)
+query_data(struct rte_power_channel_packet *pkt, unsigned int lcore_id)
 {
 	int ret;
 	ret = rte_power_guest_channel_send_msg(pkt, lcore_id);
@@ -157,13 +157,13 @@ query_data(struct channel_packet *pkt, unsigned int lcore_id)
 }
 
 static int
-receive_freq_list(struct channel_packet_freq_list *pkt_freq_list,
+receive_freq_list(struct rte_power_channel_packet_freq_list *pkt_freq_list,
 		unsigned int lcore_id)
 {
 	int ret;
 
 	ret = rte_power_guest_channel_receive_msg(pkt_freq_list,
-			sizeof(struct channel_packet_freq_list),
+			sizeof(struct rte_power_channel_packet_freq_list),
 			lcore_id);
 	if (ret < 0) {
 		RTE_LOG(ERR, GUEST_CLI, "Error receiving message.\n");
@@ -183,14 +183,15 @@ cmd_query_freq_list_parsed(void *parsed_result,
 {
 	struct cmd_freq_list_result *res = parsed_result;
 	unsigned int lcore_id;
-	struct channel_packet_freq_list pkt_freq_list;
-	struct channel_packet pkt;
+	struct rte_power_channel_packet_freq_list pkt_freq_list;
+	struct rte_power_channel_packet pkt;
 	bool query_list = false;
 	int ret;
 	char *ep;
 
-	memset(&pkt, 0, sizeof(struct channel_packet));
-	memset(&pkt_freq_list, 0, sizeof(struct channel_packet_freq_list));
+	memset(&pkt, 0, sizeof(struct rte_power_channel_packet));
+	memset(&pkt_freq_list, 0,
+			sizeof(struct rte_power_channel_packet_freq_list));
 
 	if (!strcmp(res->cpu_num, "all")) {
 
@@ -267,13 +268,13 @@ struct cmd_query_caps_result {
 };
 
 static int
-receive_capabilities(struct channel_packet_caps_list *pkt_caps_list,
+receive_capabilities(struct rte_power_channel_packet_caps_list *pkt_caps_list,
 		unsigned int lcore_id)
 {
 	int ret;
 
 	ret = rte_power_guest_channel_receive_msg(pkt_caps_list,
-		sizeof(struct channel_packet_caps_list),
+		sizeof(struct rte_power_channel_packet_caps_list),
 		lcore_id);
 	if (ret < 0) {
 		RTE_LOG(ERR, GUEST_CLI, "Error receiving message.\n");
@@ -293,14 +294,15 @@ cmd_query_caps_list_parsed(void *parsed_result,
 {
 	struct cmd_query_caps_result *res = parsed_result;
 	unsigned int lcore_id;
-	struct channel_packet_caps_list pkt_caps_list;
-	struct channel_packet pkt;
+	struct rte_power_channel_packet_caps_list pkt_caps_list;
+	struct rte_power_channel_packet pkt;
 	bool query_list = false;
 	int ret;
 	char *ep;
 
-	memset(&pkt, 0, sizeof(struct channel_packet));
-	memset(&pkt_caps_list, 0, sizeof(struct channel_packet_caps_list));
+	memset(&pkt, 0, sizeof(struct rte_power_channel_packet));
+	memset(&pkt_caps_list, 0,
+			sizeof(struct rte_power_channel_packet_caps_list));
 
 	if (!strcmp(res->cpu_num, "all")) {
 
@@ -380,7 +382,7 @@ cmdline_parse_inst_t cmd_query_caps_list = {
 static int
 check_response_cmd(unsigned int lcore_id, int *result)
 {
-	struct channel_packet pkt;
+	struct rte_power_channel_packet pkt;
 	int ret;
 
 	ret = rte_power_guest_channel_receive_msg(&pkt, sizeof pkt, lcore_id);
@@ -473,7 +475,7 @@ struct cmd_send_policy_result {
 };
 
 static inline int
-send_policy(struct channel_packet *pkt, struct cmdline *cl)
+send_policy(struct rte_power_channel_packet *pkt, struct cmdline *cl)
 {
 	int ret;
 
diff --git a/examples/vm_power_manager/guest_cli/vm_power_cli_guest.h b/examples/vm_power_manager/guest_cli/vm_power_cli_guest.h
index 2299d23dc..5d285ca9d 100644
--- a/examples/vm_power_manager/guest_cli/vm_power_cli_guest.h
+++ b/examples/vm_power_manager/guest_cli/vm_power_cli_guest.h
@@ -11,11 +11,11 @@ extern "C" {
 
 #include "rte_power_guest_channel.h"
 
-struct channel_packet *get_policy(void);
+struct rte_power_channel_packet *get_policy(void);
 
 int set_policy_mac(int port, int idx);
 
-int set_policy_defaults(struct channel_packet *pkt);
+int set_policy_defaults(struct rte_power_channel_packet *pkt);
 
 void run_cli(__rte_unused void *arg);
 
diff --git a/lib/librte_power/guest_channel.c b/lib/librte_power/guest_channel.c
index 4cb5ae1dd..9eb2f6330 100644
--- a/lib/librte_power/guest_channel.c
+++ b/lib/librte_power/guest_channel.c
@@ -55,7 +55,7 @@ int
 guest_channel_host_connect(const char *path, unsigned int lcore_id)
 {
 	int flags, ret;
-	struct channel_packet pkt;
+	struct rte_power_channel_packet pkt;
 	char fd_path[PATH_MAX];
 	int fd = -1;
 
@@ -119,7 +119,8 @@ guest_channel_host_connect(const char *path, unsigned int lcore_id)
 }
 
 int
-guest_channel_send_msg(struct channel_packet *pkt, unsigned int lcore_id)
+guest_channel_send_msg(struct rte_power_channel_packet *pkt,
+		unsigned int lcore_id)
 {
 	int ret, buffer_len = sizeof(*pkt);
 	void *buffer = pkt;
@@ -149,7 +150,7 @@ guest_channel_send_msg(struct channel_packet *pkt, unsigned int lcore_id)
 	return 0;
 }
 
-int rte_power_guest_channel_send_msg(struct channel_packet *pkt,
+int rte_power_guest_channel_send_msg(struct rte_power_channel_packet *pkt,
 			unsigned int lcore_id)
 {
 	return guest_channel_send_msg(pkt, lcore_id);
diff --git a/lib/librte_power/guest_channel.h b/lib/librte_power/guest_channel.h
index 69020b030..7d3a909d9 100644
--- a/lib/librte_power/guest_channel.h
+++ b/lib/librte_power/guest_channel.h
@@ -63,7 +63,8 @@ void guest_channel_host_disconnect(unsigned int lcore_id);
  *  - Negative on channel not connected.
  *  - errno on write to channel error.
  */
-int guest_channel_send_msg(struct channel_packet *pkt, unsigned int lcore_id);
+int guest_channel_send_msg(struct rte_power_channel_packet *pkt,
+		unsigned int lcore_id);
 
 
 
@@ -72,8 +73,8 @@ int guest_channel_send_msg(struct channel_packet *pkt, unsigned int lcore_id);
  * from the host endpoint.
  *
  * @param pkt
- *  Pointer to channel_packet or
- *  channel_packet_freq_list struct.
+ *  Pointer to rte_power_channel_packet or
+ *  rte_power_channel_packet_freq_list struct.
  *
  * @param pkt_len
  *  Size of expected data packet.
diff --git a/lib/librte_power/power_kvm_vm.c b/lib/librte_power/power_kvm_vm.c
index 649ebe85c..9ae438489 100644
--- a/lib/librte_power/power_kvm_vm.c
+++ b/lib/librte_power/power_kvm_vm.c
@@ -13,7 +13,7 @@
 
 #define FD_PATH "/dev/virtio-ports/virtio.serial.port.poweragent"
 
-static struct channel_packet pkt[RTE_MAX_LCORE];
+static struct rte_power_channel_packet pkt[RTE_MAX_LCORE];
 
 int
 power_kvm_vm_check_supported(void)
diff --git a/lib/librte_power/rte_power_guest_channel.h b/lib/librte_power/rte_power_guest_channel.h
index 6e66ce47f..f330e38bc 100644
--- a/lib/librte_power/rte_power_guest_channel.h
+++ b/lib/librte_power/rte_power_guest_channel.h
@@ -11,7 +11,10 @@ extern "C" {
 #include <stdint.h>
 #include <stdbool.h>
 
-/* --- Incoming messages --- */
+#define MAX_VFS 10
+#define VM_MAX_NAME_SZ 32
+#define MAX_VCPU_PER_VM         8
+#define HOURS 24
 
 /* Valid Commands */
 #define CPU_POWER               1
@@ -19,6 +22,9 @@ extern "C" {
 #define PKT_POLICY              3
 #define PKT_POLICY_REMOVE       4
 
+#define CORE_TYPE_VIRTUAL 0
+#define CORE_TYPE_PHYSICAL 1
+
 /* CPU Power Command Scaling */
 #define CPU_POWER_SCALE_UP      1
 #define CPU_POWER_SCALE_DOWN    2
@@ -43,41 +49,32 @@ extern "C" {
 #define CPU_POWER_FREQ_LIST     3
 #define CPU_POWER_CAPS_LIST     4
 
-#define HOURS 24
-
-#define MAX_VFS 10
-#define VM_MAX_NAME_SZ 32
-
-#define MAX_VCPU_PER_VM         8
-
-struct t_boost_status {
-	bool tbEnabled;
-};
-
-struct timer_profile {
+struct rte_power_timer_profile {
 	int busy_hours[HOURS];
 	int quiet_hours[HOURS];
 	int hours_to_use_traffic_profile[HOURS];
 };
 
-enum workload {HIGH, MEDIUM, LOW};
-enum policy_to_use {
+enum rte_power_workload_level {HIGH, MEDIUM, LOW};
+
+enum rte_power_policy {
 	TRAFFIC,
 	TIME,
 	WORKLOAD,
 	BRANCH_RATIO
 };
 
-struct traffic {
+struct rte_power_traffic_policy {
 	uint32_t min_packet_thresh;
 	uint32_t avg_max_packet_thresh;
 	uint32_t max_max_packet_thresh;
 };
 
-#define CORE_TYPE_VIRTUAL 0
-#define CORE_TYPE_PHYSICAL 1
+struct rte_power_turbo_status {
+	bool tbEnabled;
+};
 
-struct channel_packet {
+struct rte_power_channel_packet {
 	uint64_t resource_id; /**< core_num, device */
 	uint32_t unit;        /**< scale down/up/min/max */
 	uint32_t command;     /**< Power, IO, etc */
@@ -85,17 +82,17 @@ struct channel_packet {
 
 	uint64_t vfid[MAX_VFS];
 	int nb_mac_to_monitor;
-	struct traffic traffic_policy;
+	struct rte_power_traffic_policy traffic_policy;
 	uint8_t vcpu_to_control[MAX_VCPU_PER_VM];
 	uint8_t num_vcpu;
-	struct timer_profile timer_policy;
+	struct rte_power_timer_profile timer_policy;
 	bool core_type;
-	enum workload workload;
-	enum policy_to_use policy_to_use;
-	struct t_boost_status t_boost_status;
+	enum rte_power_workload_level workload;
+	enum rte_power_policy policy_to_use;
+	struct rte_power_turbo_status t_boost_status;
 };
 
-struct channel_packet_freq_list {
+struct rte_power_channel_packet_freq_list {
 	uint64_t resource_id; /**< core_num, device */
 	uint32_t unit;        /**< scale down/up/min/max */
 	uint32_t command;     /**< Power, IO, etc */
@@ -105,7 +102,7 @@ struct channel_packet_freq_list {
 	uint8_t num_vcpu;
 };
 
-struct channel_packet_caps_list {
+struct rte_power_channel_packet_caps_list {
 	uint64_t resource_id; /**< core_num, device */
 	uint32_t unit;        /**< scale down/up/min/max */
 	uint32_t command;     /**< Power, IO, etc */
@@ -129,7 +126,7 @@ struct channel_packet_caps_list {
  *  - 0 on success.
  *  - Negative on error.
  */
-int rte_power_guest_channel_send_msg(struct channel_packet *pkt,
+int rte_power_guest_channel_send_msg(struct rte_power_channel_packet *pkt,
 			unsigned int lcore_id);
 
 /**
-- 
2.17.1


^ permalink raw reply	[flat|nested] 69+ messages in thread

* [dpdk-dev] [PATCH v2 4/6] power: rename defines
  2021-01-08 14:30 ` [dpdk-dev] [PATCH 0/6] " David Hunt
                     ` (2 preceding siblings ...)
  2021-01-08 14:30   ` [dpdk-dev] [PATCH v2 3/6] power: rename public structs David Hunt
@ 2021-01-08 14:30   ` David Hunt
  2021-01-08 14:30   ` [dpdk-dev] [PATCH v2 5/6] power: add new header file to export list David Hunt
                     ` (2 subsequent siblings)
  6 siblings, 0 replies; 69+ messages in thread
From: David Hunt @ 2021-01-08 14:30 UTC (permalink / raw)
  To: dev; +Cc: david.hunt, stable, Bruce Richardson

From: Bruce Richardson <bruce.richardson@intel.com>

Rename the #defines to have an RTE_POWER_ prefix

Fixes: 210c383e247b ("power: packet format for vm power management")
Fixes: cd0d5547e873 ("power: vm communication channels in guest")
Cc: stable@dpdk.org

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: David Hunt <david.hunt@intel.com>
---
 examples/vm_power_manager/channel_monitor.c   | 116 +++++++++---------
 examples/vm_power_manager/channel_monitor.h   |   6 +-
 examples/vm_power_manager/guest_cli/main.c    |  29 +++--
 .../guest_cli/vm_power_cli_guest.c            |  28 ++---
 examples/vm_power_manager/main.c              |   2 +-
 lib/librte_power/guest_channel.c              |   2 +-
 lib/librte_power/power_kvm_vm.c               |  14 +--
 lib/librte_power/rte_power_guest_channel.h    |  98 +++++++--------
 8 files changed, 155 insertions(+), 140 deletions(-)

diff --git a/examples/vm_power_manager/channel_monitor.c b/examples/vm_power_manager/channel_monitor.c
index 5d5383494..06af3796f 100644
--- a/examples/vm_power_manager/channel_monitor.c
+++ b/examples/vm_power_manager/channel_monitor.c
@@ -177,10 +177,10 @@ parse_json_to_pkt(json_t *element, struct rte_power_channel_packet *pkt,
 
 	pkt->nb_mac_to_monitor = 0;
 	pkt->t_boost_status.tbEnabled = false;
-	pkt->workload = LOW;
-	pkt->policy_to_use = TIME;
-	pkt->command = PKT_POLICY;
-	pkt->core_type = CORE_TYPE_PHYSICAL;
+	pkt->workload = RTE_POWER_WL_LOW;
+	pkt->policy_to_use = RTE_POWER_POLICY_TIME;
+	pkt->command = RTE_POWER_PKT_POLICY;
+	pkt->core_type = RTE_POWER_CORE_TYPE_PHYSICAL;
 
 	if (vm_name == NULL) {
 		RTE_LOG(ERR, CHANNEL_MONITOR,
@@ -203,11 +203,11 @@ parse_json_to_pkt(json_t *element, struct rte_power_channel_packet *pkt,
 			char command[32];
 			strlcpy(command, json_string_value(value), 32);
 			if (!strcmp(command, "power")) {
-				pkt->command = CPU_POWER;
+				pkt->command = RTE_POWER_CPU_POWER;
 			} else if (!strcmp(command, "create")) {
-				pkt->command = PKT_POLICY;
+				pkt->command = RTE_POWER_PKT_POLICY;
 			} else if (!strcmp(command, "destroy")) {
-				pkt->command = PKT_POLICY_REMOVE;
+				pkt->command = RTE_POWER_PKT_POLICY_REMOVE;
 			} else {
 				RTE_LOG(ERR, CHANNEL_MONITOR,
 					"Invalid command received in JSON\n");
@@ -217,13 +217,17 @@ parse_json_to_pkt(json_t *element, struct rte_power_channel_packet *pkt,
 			char command[32];
 			strlcpy(command, json_string_value(value), 32);
 			if (!strcmp(command, "TIME")) {
-				pkt->policy_to_use = TIME;
+				pkt->policy_to_use =
+						RTE_POWER_POLICY_TIME;
 			} else if (!strcmp(command, "TRAFFIC")) {
-				pkt->policy_to_use = TRAFFIC;
+				pkt->policy_to_use =
+						RTE_POWER_POLICY_TRAFFIC;
 			} else if (!strcmp(command, "WORKLOAD")) {
-				pkt->policy_to_use = WORKLOAD;
+				pkt->policy_to_use =
+						RTE_POWER_POLICY_WORKLOAD;
 			} else if (!strcmp(command, "BRANCH_RATIO")) {
-				pkt->policy_to_use = BRANCH_RATIO;
+				pkt->policy_to_use =
+						RTE_POWER_POLICY_BRANCH_RATIO;
 			} else {
 				RTE_LOG(ERR, CHANNEL_MONITOR,
 					"Wrong policy_type received in JSON\n");
@@ -233,11 +237,11 @@ parse_json_to_pkt(json_t *element, struct rte_power_channel_packet *pkt,
 			char command[32];
 			strlcpy(command, json_string_value(value), 32);
 			if (!strcmp(command, "HIGH")) {
-				pkt->workload = HIGH;
+				pkt->workload = RTE_POWER_WL_HIGH;
 			} else if (!strcmp(command, "MEDIUM")) {
-				pkt->workload = MEDIUM;
+				pkt->workload = RTE_POWER_WL_MEDIUM;
 			} else if (!strcmp(command, "LOW")) {
-				pkt->workload = LOW;
+				pkt->workload = RTE_POWER_WL_LOW;
 			} else {
 				RTE_LOG(ERR, CHANNEL_MONITOR,
 					"Wrong workload received in JSON\n");
@@ -283,17 +287,17 @@ parse_json_to_pkt(json_t *element, struct rte_power_channel_packet *pkt,
 			char unit[32];
 			strlcpy(unit, json_string_value(value), 32);
 			if (!strcmp(unit, "SCALE_UP")) {
-				pkt->unit = CPU_POWER_SCALE_UP;
+				pkt->unit = RTE_POWER_SCALE_UP;
 			} else if (!strcmp(unit, "SCALE_DOWN")) {
-				pkt->unit = CPU_POWER_SCALE_DOWN;
+				pkt->unit = RTE_POWER_SCALE_DOWN;
 			} else if (!strcmp(unit, "SCALE_MAX")) {
-				pkt->unit = CPU_POWER_SCALE_MAX;
+				pkt->unit = RTE_POWER_SCALE_MAX;
 			} else if (!strcmp(unit, "SCALE_MIN")) {
-				pkt->unit = CPU_POWER_SCALE_MIN;
+				pkt->unit = RTE_POWER_SCALE_MIN;
 			} else if (!strcmp(unit, "ENABLE_TURBO")) {
-				pkt->unit = CPU_POWER_ENABLE_TURBO;
+				pkt->unit = RTE_POWER_ENABLE_TURBO;
 			} else if (!strcmp(unit, "DISABLE_TURBO")) {
-				pkt->unit = CPU_POWER_DISABLE_TURBO;
+				pkt->unit = RTE_POWER_DISABLE_TURBO;
 			} else {
 				RTE_LOG(ERR, CHANNEL_MONITOR,
 					"Invalid command received in JSON\n");
@@ -312,7 +316,7 @@ parse_json_to_pkt(json_t *element, struct rte_power_channel_packet *pkt,
 				vm_name);
 			return -1;
 		}
-		strlcpy(pkt->vm_name, vm_name, VM_MAX_NAME_SZ);
+		strlcpy(pkt->vm_name, vm_name, RTE_POWER_VM_MAX_NAME_SZ);
 		pkt->resource_id = resource_id;
 	}
 	return 0;
@@ -367,7 +371,7 @@ pcpu_monitor(struct policy *pol, struct core_info *ci, int pcpu, int count)
 {
 	int ret = 0;
 
-	if (pol->pkt.policy_to_use == BRANCH_RATIO) {
+	if (pol->pkt.policy_to_use == RTE_POWER_POLICY_BRANCH_RATIO) {
 		ci->cd[pcpu].oob_enabled = 1;
 		ret = add_core_to_monitor(pcpu);
 		if (ret == 0)
@@ -407,7 +411,7 @@ get_pcpu_to_control(struct policy *pol)
 	 * differenciate between them when adding them to the branch monitor.
 	 * Virtual cores need to be converted to physical cores.
 	 */
-	if (pol->pkt.core_type == CORE_TYPE_VIRTUAL) {
+	if (pol->pkt.core_type == RTE_POWER_CORE_TYPE_VIRTUAL) {
 		/*
 		 * If the cores in the policy are virtual, we need to map them
 		 * to physical core. We look up the vm info and use that for
@@ -479,7 +483,8 @@ update_policy(struct rte_power_channel_packet *pkt)
 			policies[i].pkt = *pkt;
 			get_pcpu_to_control(&policies[i]);
 			/* Check Eth dev only for Traffic policy */
-			if (policies[i].pkt.policy_to_use == TRAFFIC) {
+			if (policies[i].pkt.policy_to_use ==
+					RTE_POWER_POLICY_TRAFFIC) {
 				if (get_pfid(&policies[i]) < 0) {
 					updated = 1;
 					break;
@@ -496,7 +501,8 @@ update_policy(struct rte_power_channel_packet *pkt)
 				policies[i].pkt = *pkt;
 				get_pcpu_to_control(&policies[i]);
 				/* Check Eth dev only for Traffic policy */
-				if (policies[i].pkt.policy_to_use == TRAFFIC) {
+				if (policies[i].pkt.policy_to_use ==
+						RTE_POWER_POLICY_TRAFFIC) {
 					if (get_pfid(&policies[i]) < 0) {
 						updated = 1;
 						break;
@@ -615,7 +621,7 @@ apply_time_profile(struct policy *pol)
 	/* Format the date and time, down to a single second. */
 	strftime(time_string, sizeof(time_string), "%Y-%m-%d %H:%M:%S", ptm);
 
-	for (x = 0; x < HOURS; x++) {
+	for (x = 0; x < RTE_POWER_HOURS_PER_DAY; x++) {
 
 		if (ptm->tm_hour == pol->pkt.timer_policy.busy_hours[x]) {
 			for (count = 0; count < pol->pkt.num_vcpu; count++) {
@@ -648,19 +654,19 @@ apply_workload_profile(struct policy *pol)
 
 	int count;
 
-	if (pol->pkt.workload == HIGH) {
+	if (pol->pkt.workload == RTE_POWER_WL_HIGH) {
 		for (count = 0; count < pol->pkt.num_vcpu; count++) {
 			if (pol->core_share[count].status != 1)
 				power_manager_scale_core_max(
 						pol->core_share[count].pcpu);
 		}
-	} else if (pol->pkt.workload == MEDIUM) {
+	} else if (pol->pkt.workload == RTE_POWER_WL_MEDIUM) {
 		for (count = 0; count < pol->pkt.num_vcpu; count++) {
 			if (pol->core_share[count].status != 1)
 				power_manager_scale_core_med(
 						pol->core_share[count].pcpu);
 		}
-	} else if (pol->pkt.workload == LOW) {
+	} else if (pol->pkt.workload == RTE_POWER_WL_LOW) {
 		for (count = 0; count < pol->pkt.num_vcpu; count++) {
 			if (pol->core_share[count].status != 1)
 				power_manager_scale_core_min(
@@ -676,11 +682,11 @@ apply_policy(struct policy *pol)
 	struct rte_power_channel_packet *pkt = &pol->pkt;
 
 	/*Check policy to use*/
-	if (pkt->policy_to_use == TRAFFIC)
+	if (pkt->policy_to_use == RTE_POWER_POLICY_TRAFFIC)
 		apply_traffic_profile(pol);
-	else if (pkt->policy_to_use == TIME)
+	else if (pkt->policy_to_use == RTE_POWER_POLICY_TIME)
 		apply_time_profile(pol);
-	else if (pkt->policy_to_use == WORKLOAD)
+	else if (pkt->policy_to_use == RTE_POWER_POLICY_WORKLOAD)
 		apply_workload_profile(pol);
 }
 
@@ -726,13 +732,13 @@ send_freq(struct rte_power_channel_packet *pkt,
 	if (get_info_vm(pkt->vm_name, &info) != 0)
 		return -1;
 
-	if (!freq_list && vcore_id >= MAX_VCPU_PER_VM)
+	if (!freq_list && vcore_id >= RTE_POWER_MAX_VCPU_PER_VM)
 		return -1;
 
 	if (!info.allow_query)
 		return -1;
 
-	channel_pkt_freq_list.command = CPU_POWER_FREQ_LIST;
+	channel_pkt_freq_list.command = RTE_POWER_FREQ_LIST;
 	channel_pkt_freq_list.num_vcpu = info.num_vcpus;
 
 	if (freq_list) {
@@ -764,13 +770,13 @@ send_capabilities(struct rte_power_channel_packet *pkt,
 	if (get_info_vm(pkt->vm_name, &info) != 0)
 		return -1;
 
-	if (!list_requested && vcore_id >= MAX_VCPU_PER_VM)
+	if (!list_requested && vcore_id >= RTE_POWER_MAX_VCPU_PER_VM)
 		return -1;
 
 	if (!info.allow_query)
 		return -1;
 
-	channel_pkt_caps_list.command = CPU_POWER_CAPS_LIST;
+	channel_pkt_caps_list.command = RTE_POWER_CAPS_LIST;
 	channel_pkt_caps_list.num_vcpu = info.num_vcpus;
 
 	if (list_requested) {
@@ -828,10 +834,10 @@ process_request(struct rte_power_channel_packet *pkt,
 			CHANNEL_MGR_CHANNEL_PROCESSING) == 0)
 		return -1;
 
-	if (pkt->command == CPU_POWER) {
+	if (pkt->command == RTE_POWER_CPU_POWER) {
 		unsigned int core_num;
 
-		if (pkt->core_type == CORE_TYPE_VIRTUAL)
+		if (pkt->core_type == RTE_POWER_CORE_TYPE_VIRTUAL)
 			core_num = get_pcpu(chan_info, pkt->resource_id);
 		else
 			core_num = pkt->resource_id;
@@ -843,22 +849,22 @@ process_request(struct rte_power_channel_packet *pkt,
 		bool valid_unit = true;
 
 		switch (pkt->unit) {
-		case(CPU_POWER_SCALE_MIN):
+		case(RTE_POWER_SCALE_MIN):
 			scale_res = power_manager_scale_core_min(core_num);
 			break;
-		case(CPU_POWER_SCALE_MAX):
+		case(RTE_POWER_SCALE_MAX):
 			scale_res = power_manager_scale_core_max(core_num);
 			break;
-		case(CPU_POWER_SCALE_DOWN):
+		case(RTE_POWER_SCALE_DOWN):
 			scale_res = power_manager_scale_core_down(core_num);
 			break;
-		case(CPU_POWER_SCALE_UP):
+		case(RTE_POWER_SCALE_UP):
 			scale_res = power_manager_scale_core_up(core_num);
 			break;
-		case(CPU_POWER_ENABLE_TURBO):
+		case(RTE_POWER_ENABLE_TURBO):
 			scale_res = power_manager_enable_turbo_core(core_num);
 			break;
-		case(CPU_POWER_DISABLE_TURBO):
+		case(RTE_POWER_DISABLE_TURBO):
 			scale_res = power_manager_disable_turbo_core(core_num);
 			break;
 		default:
@@ -870,8 +876,8 @@ process_request(struct rte_power_channel_packet *pkt,
 			ret = send_ack_for_received_cmd(pkt,
 					chan_info,
 					scale_res >= 0 ?
-						CPU_POWER_CMD_ACK :
-						CPU_POWER_CMD_NACK);
+						RTE_POWER_CMD_ACK :
+						RTE_POWER_CMD_NACK);
 			if (ret < 0)
 				RTE_LOG(ERR, CHANNEL_MONITOR, "Error during sending ack command.\n");
 		} else
@@ -879,19 +885,19 @@ process_request(struct rte_power_channel_packet *pkt,
 
 	}
 
-	if (pkt->command == PKT_POLICY) {
+	if (pkt->command == RTE_POWER_PKT_POLICY) {
 		RTE_LOG(INFO, CHANNEL_MONITOR, "Processing policy request %s\n",
 				pkt->vm_name);
 		int ret = send_ack_for_received_cmd(pkt,
 				chan_info,
-				CPU_POWER_CMD_ACK);
+				RTE_POWER_CMD_ACK);
 		if (ret < 0)
 			RTE_LOG(ERR, CHANNEL_MONITOR, "Error during sending ack command.\n");
 		update_policy(pkt);
 		policy_is_set = 1;
 	}
 
-	if (pkt->command == PKT_POLICY_REMOVE) {
+	if (pkt->command == RTE_POWER_PKT_POLICY_REMOVE) {
 		ret = remove_policy(pkt);
 		if (ret == 0)
 			RTE_LOG(INFO, CHANNEL_MONITOR,
@@ -901,26 +907,26 @@ process_request(struct rte_power_channel_packet *pkt,
 				 "Policy %s does not exist\n", pkt->vm_name);
 	}
 
-	if (pkt->command == CPU_POWER_QUERY_FREQ_LIST ||
-		pkt->command == CPU_POWER_QUERY_FREQ) {
+	if (pkt->command == RTE_POWER_QUERY_FREQ_LIST ||
+		pkt->command == RTE_POWER_QUERY_FREQ) {
 
 		RTE_LOG(INFO, CHANNEL_MONITOR,
 			"Frequency for %s requested.\n", pkt->vm_name);
 		int ret = send_freq(pkt,
 				chan_info,
-				pkt->command == CPU_POWER_QUERY_FREQ_LIST);
+				pkt->command == RTE_POWER_QUERY_FREQ_LIST);
 		if (ret < 0)
 			RTE_LOG(ERR, CHANNEL_MONITOR, "Error during frequency sending.\n");
 	}
 
-	if (pkt->command == CPU_POWER_QUERY_CAPS_LIST ||
-		pkt->command == CPU_POWER_QUERY_CAPS) {
+	if (pkt->command == RTE_POWER_QUERY_CAPS_LIST ||
+		pkt->command == RTE_POWER_QUERY_CAPS) {
 
 		RTE_LOG(INFO, CHANNEL_MONITOR,
 			"Capabilities for %s requested.\n", pkt->vm_name);
 		int ret = send_capabilities(pkt,
 				chan_info,
-				pkt->command == CPU_POWER_QUERY_CAPS_LIST);
+				pkt->command == RTE_POWER_QUERY_CAPS_LIST);
 		if (ret < 0)
 			RTE_LOG(ERR, CHANNEL_MONITOR, "Error during sending capabilities.\n");
 	}
diff --git a/examples/vm_power_manager/channel_monitor.h b/examples/vm_power_manager/channel_monitor.h
index 0ca6207ad..5d3537b91 100644
--- a/examples/vm_power_manager/channel_monitor.h
+++ b/examples/vm_power_manager/channel_monitor.h
@@ -19,10 +19,10 @@ struct core_share {
 
 struct policy {
 	struct rte_power_channel_packet pkt;
-	uint32_t pfid[MAX_VFS];
-	uint32_t port[MAX_VFS];
+	uint32_t pfid[RTE_POWER_MAX_VFS];
+	uint32_t port[RTE_POWER_MAX_VFS];
 	unsigned int enabled;
-	struct core_share core_share[MAX_VCPU_PER_VM];
+	struct core_share core_share[RTE_POWER_MAX_VCPU_PER_VM];
 };
 
 #ifdef __cplusplus
diff --git a/examples/vm_power_manager/guest_cli/main.c b/examples/vm_power_manager/guest_cli/main.c
index fc7a8c30a..4e17f7fb9 100644
--- a/examples/vm_power_manager/guest_cli/main.c
+++ b/examples/vm_power_manager/guest_cli/main.c
@@ -50,8 +50,8 @@ parse_args(int argc, char **argv)
 	};
 	struct rte_power_channel_packet *policy;
 	unsigned short int hours[MAX_HOURS];
-	unsigned short int cores[MAX_VCPU_PER_VM];
-	unsigned short int ports[MAX_VCPU_PER_VM];
+	unsigned short int cores[RTE_POWER_MAX_VCPU_PER_VM];
+	unsigned short int ports[RTE_POWER_MAX_VCPU_PER_VM];
 	int i, cnt, idx;
 
 	policy = get_policy();
@@ -69,7 +69,8 @@ parse_args(int argc, char **argv)
 		switch (opt) {
 		/* portmask */
 		case 'n':
-			strlcpy(policy->vm_name, optarg, VM_MAX_NAME_SZ);
+			strlcpy(policy->vm_name, optarg,
+					RTE_POWER_VM_MAX_NAME_SZ);
 			printf("Setting VM Name to [%s]\n", policy->vm_name);
 			break;
 		case 'b':
@@ -97,14 +98,15 @@ parse_args(int argc, char **argv)
 			}
 			break;
 		case 'l':
-			cnt = parse_set(optarg, cores, MAX_VCPU_PER_VM);
+			cnt = parse_set(optarg, cores,
+					RTE_POWER_MAX_VCPU_PER_VM);
 			if (cnt < 0) {
 				printf("Invalid value passed to vcpu-list - [%s]\n",
 						optarg);
 				break;
 			}
 			idx = 0;
-			for (i = 0; i < MAX_VCPU_PER_VM; i++) {
+			for (i = 0; i < RTE_POWER_MAX_VCPU_PER_VM; i++) {
 				if (cores[i]) {
 					printf("***Using core %d\n", i);
 					policy->vcpu_to_control[idx++] = i;
@@ -114,14 +116,15 @@ parse_args(int argc, char **argv)
 			printf("Total cores: %d\n", idx);
 			break;
 		case 'p':
-			cnt = parse_set(optarg, ports, MAX_VCPU_PER_VM);
+			cnt = parse_set(optarg, ports,
+					RTE_POWER_MAX_VCPU_PER_VM);
 			if (cnt < 0) {
 				printf("Invalid value passed to port-list - [%s]\n",
 						optarg);
 				break;
 			}
 			idx = 0;
-			for (i = 0; i < MAX_VCPU_PER_VM; i++) {
+			for (i = 0; i < RTE_POWER_MAX_VCPU_PER_VM; i++) {
 				if (ports[i]) {
 					printf("***Using port %d\n", i);
 					if (set_policy_mac(i, idx++) != 0) {
@@ -135,13 +138,17 @@ parse_args(int argc, char **argv)
 			break;
 		case 'o':
 			if (!strcmp(optarg, "TRAFFIC"))
-				policy->policy_to_use = TRAFFIC;
+				policy->policy_to_use =
+						RTE_POWER_POLICY_TRAFFIC;
 			else if (!strcmp(optarg, "TIME"))
-				policy->policy_to_use = TIME;
+				policy->policy_to_use =
+						RTE_POWER_POLICY_TIME;
 			else if (!strcmp(optarg, "WORKLOAD"))
-				policy->policy_to_use = WORKLOAD;
+				policy->policy_to_use =
+						RTE_POWER_POLICY_WORKLOAD;
 			else if (!strcmp(optarg, "BRANCH_RATIO"))
-				policy->policy_to_use = BRANCH_RATIO;
+				policy->policy_to_use =
+						RTE_POWER_POLICY_BRANCH_RATIO;
 			else {
 				printf("Invalid policy specified: %s\n",
 						optarg);
diff --git a/examples/vm_power_manager/guest_cli/vm_power_cli_guest.c b/examples/vm_power_manager/guest_cli/vm_power_cli_guest.c
index b7c8f850e..3fde38dd3 100644
--- a/examples/vm_power_manager/guest_cli/vm_power_cli_guest.c
+++ b/examples/vm_power_manager/guest_cli/vm_power_cli_guest.c
@@ -103,10 +103,10 @@ set_policy_defaults(struct rte_power_channel_packet *pkt)
 	pkt->timer_policy.hours_to_use_traffic_profile[0] = 8;
 	pkt->timer_policy.hours_to_use_traffic_profile[1] = 10;
 
-	pkt->core_type = CORE_TYPE_VIRTUAL;
-	pkt->workload = LOW;
-	pkt->policy_to_use = TIME;
-	pkt->command = PKT_POLICY;
+	pkt->core_type = RTE_POWER_CORE_TYPE_VIRTUAL;
+	pkt->workload = RTE_POWER_WL_LOW;
+	pkt->policy_to_use = RTE_POWER_POLICY_TIME;
+	pkt->command = RTE_POWER_PKT_POLICY;
 	strlcpy(pkt->vm_name, "ubuntu2", sizeof(pkt->vm_name));
 
 	return 0;
@@ -169,7 +169,7 @@ receive_freq_list(struct rte_power_channel_packet_freq_list *pkt_freq_list,
 		RTE_LOG(ERR, GUEST_CLI, "Error receiving message.\n");
 		return -1;
 	}
-	if (pkt_freq_list->command != CPU_POWER_FREQ_LIST) {
+	if (pkt_freq_list->command != RTE_POWER_FREQ_LIST) {
 		RTE_LOG(ERR, GUEST_CLI, "Unexpected message received.\n");
 		return -1;
 	}
@@ -204,18 +204,18 @@ cmd_query_freq_list_parsed(void *parsed_result,
 			return;
 		}
 
-		pkt.command = CPU_POWER_QUERY_FREQ_LIST;
+		pkt.command = RTE_POWER_QUERY_FREQ_LIST;
 		strlcpy(pkt.vm_name, policy.vm_name, sizeof(pkt.vm_name));
 		query_list = true;
 	} else {
 		errno = 0;
 		lcore_id = (unsigned int)strtol(res->cpu_num, &ep, 10);
-		if (errno != 0 || lcore_id >= MAX_VCPU_PER_VM ||
+		if (errno != 0 || lcore_id >= RTE_POWER_MAX_VCPU_PER_VM ||
 			ep == res->cpu_num) {
 			cmdline_printf(cl, "Invalid parameter provided.\n");
 			return;
 		}
-		pkt.command = CPU_POWER_QUERY_FREQ;
+		pkt.command = RTE_POWER_QUERY_FREQ;
 		strlcpy(pkt.vm_name, policy.vm_name, sizeof(pkt.vm_name));
 		pkt.resource_id = lcore_id;
 	}
@@ -280,7 +280,7 @@ receive_capabilities(struct rte_power_channel_packet_caps_list *pkt_caps_list,
 		RTE_LOG(ERR, GUEST_CLI, "Error receiving message.\n");
 		return -1;
 	}
-	if (pkt_caps_list->command != CPU_POWER_CAPS_LIST) {
+	if (pkt_caps_list->command != RTE_POWER_CAPS_LIST) {
 		RTE_LOG(ERR, GUEST_CLI, "Unexpected message received.\n");
 		return -1;
 	}
@@ -315,18 +315,18 @@ cmd_query_caps_list_parsed(void *parsed_result,
 			return;
 		}
 
-		pkt.command = CPU_POWER_QUERY_CAPS_LIST;
+		pkt.command = RTE_POWER_QUERY_CAPS_LIST;
 		strlcpy(pkt.vm_name, policy.vm_name, sizeof(pkt.vm_name));
 		query_list = true;
 	} else {
 		errno = 0;
 		lcore_id = (unsigned int)strtol(res->cpu_num, &ep, 10);
-		if (errno != 0 || lcore_id >= MAX_VCPU_PER_VM ||
+		if (errno != 0 || lcore_id >= RTE_POWER_MAX_VCPU_PER_VM ||
 			ep == res->cpu_num) {
 			cmdline_printf(cl, "Invalid parameter provided.\n");
 			return;
 		}
-		pkt.command = CPU_POWER_QUERY_CAPS;
+		pkt.command = RTE_POWER_QUERY_CAPS;
 		strlcpy(pkt.vm_name, policy.vm_name, sizeof(pkt.vm_name));
 		pkt.resource_id = lcore_id;
 	}
@@ -390,10 +390,10 @@ check_response_cmd(unsigned int lcore_id, int *result)
 		return -1;
 
 	switch (pkt.command) {
-	case(CPU_POWER_CMD_ACK):
+	case(RTE_POWER_CMD_ACK):
 		*result = 1;
 		break;
-	case(CPU_POWER_CMD_NACK):
+	case(RTE_POWER_CMD_NACK):
 		*result = 0;
 		break;
 	default:
diff --git a/examples/vm_power_manager/main.c b/examples/vm_power_manager/main.c
index 75d5b5364..799d7b9bc 100644
--- a/examples/vm_power_manager/main.c
+++ b/examples/vm_power_manager/main.c
@@ -394,7 +394,7 @@ main(int argc, char **argv)
 					"Cannot init port %"PRIu8 "\n",
 					portid);
 
-			for (w = 0; w < MAX_VFS; w++) {
+			for (w = 0; w < RTE_POWER_MAX_VFS; w++) {
 				eth.addr_bytes[5] = w + 0xf0;
 
 				ret = -ENOTSUP;
diff --git a/lib/librte_power/guest_channel.c b/lib/librte_power/guest_channel.c
index 9eb2f6330..039cb1872 100644
--- a/lib/librte_power/guest_channel.c
+++ b/lib/librte_power/guest_channel.c
@@ -100,7 +100,7 @@ guest_channel_host_connect(const char *path, unsigned int lcore_id)
 	/* Send a test packet, this command is ignored by the host, but a successful
 	 * send indicates that the host endpoint is monitoring.
 	 */
-	pkt.command = CPU_POWER_CONNECT;
+	pkt.command = RTE_POWER_CPU_POWER_CONNECT;
 	global_fds[lcore_id] = fd;
 	ret = guest_channel_send_msg(&pkt, lcore_id);
 	if (ret != 0) {
diff --git a/lib/librte_power/power_kvm_vm.c b/lib/librte_power/power_kvm_vm.c
index 9ae438489..27f9937aa 100644
--- a/lib/librte_power/power_kvm_vm.c
+++ b/lib/librte_power/power_kvm_vm.c
@@ -29,7 +29,7 @@ power_kvm_vm_init(unsigned int lcore_id)
 				lcore_id, RTE_MAX_LCORE-1);
 		return -1;
 	}
-	pkt[lcore_id].command = CPU_POWER;
+	pkt[lcore_id].command = RTE_POWER_CPU_POWER;
 	pkt[lcore_id].resource_id = lcore_id;
 	return guest_channel_host_connect(FD_PATH, lcore_id);
 }
@@ -90,25 +90,25 @@ send_msg(unsigned int lcore_id, uint32_t scale_direction)
 int
 power_kvm_vm_freq_up(unsigned int lcore_id)
 {
-	return send_msg(lcore_id, CPU_POWER_SCALE_UP);
+	return send_msg(lcore_id, RTE_POWER_SCALE_UP);
 }
 
 int
 power_kvm_vm_freq_down(unsigned int lcore_id)
 {
-	return send_msg(lcore_id, CPU_POWER_SCALE_DOWN);
+	return send_msg(lcore_id, RTE_POWER_SCALE_DOWN);
 }
 
 int
 power_kvm_vm_freq_max(unsigned int lcore_id)
 {
-	return send_msg(lcore_id, CPU_POWER_SCALE_MAX);
+	return send_msg(lcore_id, RTE_POWER_SCALE_MAX);
 }
 
 int
 power_kvm_vm_freq_min(unsigned int lcore_id)
 {
-	return send_msg(lcore_id, CPU_POWER_SCALE_MIN);
+	return send_msg(lcore_id, RTE_POWER_SCALE_MIN);
 }
 
 int
@@ -121,13 +121,13 @@ power_kvm_vm_turbo_status(__rte_unused unsigned int lcore_id)
 int
 power_kvm_vm_enable_turbo(unsigned int lcore_id)
 {
-	return send_msg(lcore_id, CPU_POWER_ENABLE_TURBO);
+	return send_msg(lcore_id, RTE_POWER_ENABLE_TURBO);
 }
 
 int
 power_kvm_vm_disable_turbo(unsigned int lcore_id)
 {
-	return send_msg(lcore_id, CPU_POWER_DISABLE_TURBO);
+	return send_msg(lcore_id, RTE_POWER_DISABLE_TURBO);
 }
 
 struct rte_power_core_capabilities;
diff --git a/lib/librte_power/rte_power_guest_channel.h b/lib/librte_power/rte_power_guest_channel.h
index f330e38bc..8202314f7 100644
--- a/lib/librte_power/rte_power_guest_channel.h
+++ b/lib/librte_power/rte_power_guest_channel.h
@@ -11,63 +11,65 @@ extern "C" {
 #include <stdint.h>
 #include <stdbool.h>
 
-#define MAX_VFS 10
-#define VM_MAX_NAME_SZ 32
-#define MAX_VCPU_PER_VM         8
-#define HOURS 24
+#define RTE_POWER_MAX_VFS 10
+#define RTE_POWER_VM_MAX_NAME_SZ 32
+#define RTE_POWER_MAX_VCPU_PER_VM 8
+#define RTE_POWER_HOURS_PER_DAY 24
 
 /* Valid Commands */
-#define CPU_POWER               1
-#define CPU_POWER_CONNECT       2
-#define PKT_POLICY              3
-#define PKT_POLICY_REMOVE       4
+#define RTE_POWER_CPU_POWER               1
+#define RTE_POWER_CPU_POWER_CONNECT       2
+#define RTE_POWER_PKT_POLICY              3
+#define RTE_POWER_PKT_POLICY_REMOVE       4
 
-#define CORE_TYPE_VIRTUAL 0
-#define CORE_TYPE_PHYSICAL 1
+#define RTE_POWER_CORE_TYPE_VIRTUAL 0
+#define RTE_POWER_CORE_TYPE_PHYSICAL 1
 
 /* CPU Power Command Scaling */
-#define CPU_POWER_SCALE_UP      1
-#define CPU_POWER_SCALE_DOWN    2
-#define CPU_POWER_SCALE_MAX     3
-#define CPU_POWER_SCALE_MIN     4
-#define CPU_POWER_ENABLE_TURBO  5
-#define CPU_POWER_DISABLE_TURBO 6
+#define RTE_POWER_SCALE_UP      1
+#define RTE_POWER_SCALE_DOWN    2
+#define RTE_POWER_SCALE_MAX     3
+#define RTE_POWER_SCALE_MIN     4
+#define RTE_POWER_ENABLE_TURBO  5
+#define RTE_POWER_DISABLE_TURBO 6
 
 /* CPU Power Queries */
-#define CPU_POWER_QUERY_FREQ_LIST  7
-#define CPU_POWER_QUERY_FREQ       8
-#define CPU_POWER_QUERY_CAPS_LIST  9
-#define CPU_POWER_QUERY_CAPS       10
-
-/* --- Outgoing messages --- */
+#define RTE_POWER_QUERY_FREQ_LIST  7
+#define RTE_POWER_QUERY_FREQ       8
+#define RTE_POWER_QUERY_CAPS_LIST  9
+#define RTE_POWER_QUERY_CAPS       10
 
 /* Generic Power Command Response */
-#define CPU_POWER_CMD_ACK       1
-#define CPU_POWER_CMD_NACK      2
+#define RTE_POWER_CMD_ACK       1
+#define RTE_POWER_CMD_NACK      2
 
 /* CPU Power Query Responses */
-#define CPU_POWER_FREQ_LIST     3
-#define CPU_POWER_CAPS_LIST     4
+#define RTE_POWER_FREQ_LIST     3
+#define RTE_POWER_CAPS_LIST     4
 
-struct rte_power_timer_profile {
-	int busy_hours[HOURS];
-	int quiet_hours[HOURS];
-	int hours_to_use_traffic_profile[HOURS];
+struct rte_power_traffic_policy {
+	uint32_t min_packet_thresh;
+	uint32_t avg_max_packet_thresh;
+	uint32_t max_max_packet_thresh;
 };
 
-enum rte_power_workload_level {HIGH, MEDIUM, LOW};
+struct rte_power_timer_profile {
+	int busy_hours[RTE_POWER_HOURS_PER_DAY];
+	int quiet_hours[RTE_POWER_HOURS_PER_DAY];
+	int hours_to_use_traffic_profile[RTE_POWER_HOURS_PER_DAY];
+};
 
-enum rte_power_policy {
-	TRAFFIC,
-	TIME,
-	WORKLOAD,
-	BRANCH_RATIO
+enum rte_power_workload_level {
+	RTE_POWER_WL_HIGH,
+	RTE_POWER_WL_MEDIUM,
+	RTE_POWER_WL_LOW
 };
 
-struct rte_power_traffic_policy {
-	uint32_t min_packet_thresh;
-	uint32_t avg_max_packet_thresh;
-	uint32_t max_max_packet_thresh;
+enum rte_power_policy {
+	RTE_POWER_POLICY_TRAFFIC,
+	RTE_POWER_POLICY_TIME,
+	RTE_POWER_POLICY_WORKLOAD,
+	RTE_POWER_POLICY_BRANCH_RATIO
 };
 
 struct rte_power_turbo_status {
@@ -78,12 +80,12 @@ struct rte_power_channel_packet {
 	uint64_t resource_id; /**< core_num, device */
 	uint32_t unit;        /**< scale down/up/min/max */
 	uint32_t command;     /**< Power, IO, etc */
-	char vm_name[VM_MAX_NAME_SZ];
+	char vm_name[RTE_POWER_VM_MAX_NAME_SZ];
 
-	uint64_t vfid[MAX_VFS];
+	uint64_t vfid[RTE_POWER_MAX_VFS];
 	int nb_mac_to_monitor;
 	struct rte_power_traffic_policy traffic_policy;
-	uint8_t vcpu_to_control[MAX_VCPU_PER_VM];
+	uint8_t vcpu_to_control[RTE_POWER_MAX_VCPU_PER_VM];
 	uint8_t num_vcpu;
 	struct rte_power_timer_profile timer_policy;
 	bool core_type;
@@ -96,9 +98,9 @@ struct rte_power_channel_packet_freq_list {
 	uint64_t resource_id; /**< core_num, device */
 	uint32_t unit;        /**< scale down/up/min/max */
 	uint32_t command;     /**< Power, IO, etc */
-	char vm_name[VM_MAX_NAME_SZ];
+	char vm_name[RTE_POWER_VM_MAX_NAME_SZ];
 
-	uint32_t freq_list[MAX_VCPU_PER_VM];
+	uint32_t freq_list[RTE_POWER_MAX_VCPU_PER_VM];
 	uint8_t num_vcpu;
 };
 
@@ -106,10 +108,10 @@ struct rte_power_channel_packet_caps_list {
 	uint64_t resource_id; /**< core_num, device */
 	uint32_t unit;        /**< scale down/up/min/max */
 	uint32_t command;     /**< Power, IO, etc */
-	char vm_name[VM_MAX_NAME_SZ];
+	char vm_name[RTE_POWER_VM_MAX_NAME_SZ];
 
-	uint64_t turbo[MAX_VCPU_PER_VM];
-	uint64_t priority[MAX_VCPU_PER_VM];
+	uint64_t turbo[RTE_POWER_MAX_VCPU_PER_VM];
+	uint64_t priority[RTE_POWER_MAX_VCPU_PER_VM];
 	uint8_t num_vcpu;
 };
 
-- 
2.17.1


^ permalink raw reply	[flat|nested] 69+ messages in thread

* [dpdk-dev] [PATCH v2 5/6] power: add new header file to export list
  2021-01-08 14:30 ` [dpdk-dev] [PATCH 0/6] " David Hunt
                     ` (3 preceding siblings ...)
  2021-01-08 14:30   ` [dpdk-dev] [PATCH v2 4/6] power: rename defines David Hunt
@ 2021-01-08 14:30   ` David Hunt
  2021-01-08 14:30   ` [dpdk-dev] [PATCH v2 6/6] power: clean up includes David Hunt
  2021-01-13 11:08   ` [dpdk-dev] [PATCH 0/6] power: fix make build for power apps Burakov, Anatoly
  6 siblings, 0 replies; 69+ messages in thread
From: David Hunt @ 2021-01-08 14:30 UTC (permalink / raw)
  To: dev; +Cc: david.hunt, stable, Bruce Richardson

From: Bruce Richardson <bruce.richardson@intel.com>

Adjust meson.build so that 'ninja install' copies the new header
file into the installation directory.

Fixes: 210c383e247b ("power: packet format for vm power management")
Fixes: cd0d5547e873 ("power: vm communication channels in guest")
Cc: stable@dpdk.org

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: David Hunt <david.hunt@intel.com>
---
 lib/librte_power/meson.build | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/librte_power/meson.build b/lib/librte_power/meson.build
index 4b4cf1b90..541569528 100644
--- a/lib/librte_power/meson.build
+++ b/lib/librte_power/meson.build
@@ -10,5 +10,6 @@ sources = files('rte_power.c', 'power_acpi_cpufreq.c',
 		'rte_power_empty_poll.c',
 		'power_pstate_cpufreq.c',
 		'power_common.c')
-headers = files('rte_power.h','rte_power_empty_poll.h')
+headers = files('rte_power.h','rte_power_empty_poll.h',
+	'rte_power_guest_channel.h')
 deps += ['timer']
-- 
2.17.1


^ permalink raw reply	[flat|nested] 69+ messages in thread

* [dpdk-dev] [PATCH v2 6/6] power: clean up includes
  2021-01-08 14:30 ` [dpdk-dev] [PATCH 0/6] " David Hunt
                     ` (4 preceding siblings ...)
  2021-01-08 14:30   ` [dpdk-dev] [PATCH v2 5/6] power: add new header file to export list David Hunt
@ 2021-01-08 14:30   ` David Hunt
  2021-01-13 11:08   ` [dpdk-dev] [PATCH 0/6] power: fix make build for power apps Burakov, Anatoly
  6 siblings, 0 replies; 69+ messages in thread
From: David Hunt @ 2021-01-08 14:30 UTC (permalink / raw)
  To: dev; +Cc: david.hunt, stable, Bruce Richardson

From: Bruce Richardson <bruce.richardson@intel.com>

re-organise the including of the new public header file and
remove un-needed includes

Fixes: 210c383e247b ("power: packet format for vm power management")
Fixes: cd0d5547e873 ("power: vm communication channels in guest")
Cc: stable@dpdk.org

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: David Hunt <david.hunt@intel.com>
---
 examples/vm_power_manager/channel_manager.c              | 1 -
 examples/vm_power_manager/channel_monitor.c              | 1 -
 examples/vm_power_manager/channel_monitor.h              | 2 +-
 examples/vm_power_manager/guest_cli/vm_power_cli_guest.c | 1 -
 examples/vm_power_manager/guest_cli/vm_power_cli_guest.h | 2 --
 examples/vm_power_manager/vm_power_cli.c                 | 1 -
 lib/librte_power/guest_channel.c                         | 2 +-
 lib/librte_power/guest_channel.h                         | 2 --
 lib/librte_power/power_kvm_vm.c                          | 2 +-
 lib/librte_power/rte_power.h                             | 1 +
 lib/librte_power/rte_power_guest_channel.h               | 3 ---
 11 files changed, 4 insertions(+), 14 deletions(-)

diff --git a/examples/vm_power_manager/channel_manager.c b/examples/vm_power_manager/channel_manager.c
index c7d5bf5a8..0a28cb643 100644
--- a/examples/vm_power_manager/channel_manager.c
+++ b/examples/vm_power_manager/channel_manager.c
@@ -27,7 +27,6 @@
 #include <libvirt/libvirt.h>
 
 #include "channel_manager.h"
-#include "rte_power_guest_channel.h"
 #include "channel_monitor.h"
 #include "power_manager.h"
 
diff --git a/examples/vm_power_manager/channel_monitor.c b/examples/vm_power_manager/channel_monitor.c
index 06af3796f..306a78d3e 100644
--- a/examples/vm_power_manager/channel_monitor.c
+++ b/examples/vm_power_manager/channel_monitor.c
@@ -35,7 +35,6 @@
 
 #include <libvirt/libvirt.h>
 #include "channel_monitor.h"
-#include "rte_power_guest_channel.h"
 #include "channel_manager.h"
 #include "power_manager.h"
 #include "oob_monitor.h"
diff --git a/examples/vm_power_manager/channel_monitor.h b/examples/vm_power_manager/channel_monitor.h
index 5d3537b91..9184a8327 100644
--- a/examples/vm_power_manager/channel_monitor.h
+++ b/examples/vm_power_manager/channel_monitor.h
@@ -5,8 +5,8 @@
 #ifndef CHANNEL_MONITOR_H_
 #define CHANNEL_MONITOR_H_
 
+#include <rte_power.h>
 #include "channel_manager.h"
-#include "rte_power_guest_channel.h"
 
 struct core_share {
 	unsigned int pcpu;
diff --git a/examples/vm_power_manager/guest_cli/vm_power_cli_guest.c b/examples/vm_power_manager/guest_cli/vm_power_cli_guest.c
index 3fde38dd3..32a2808d3 100644
--- a/examples/vm_power_manager/guest_cli/vm_power_cli_guest.c
+++ b/examples/vm_power_manager/guest_cli/vm_power_cli_guest.c
@@ -19,7 +19,6 @@
 #include <rte_ethdev.h>
 
 #include <rte_power.h>
-#include <guest_channel.h>
 
 #include "vm_power_cli_guest.h"
 
diff --git a/examples/vm_power_manager/guest_cli/vm_power_cli_guest.h b/examples/vm_power_manager/guest_cli/vm_power_cli_guest.h
index 5d285ca9d..b578ec072 100644
--- a/examples/vm_power_manager/guest_cli/vm_power_cli_guest.h
+++ b/examples/vm_power_manager/guest_cli/vm_power_cli_guest.h
@@ -9,8 +9,6 @@
 extern "C" {
 #endif
 
-#include "rte_power_guest_channel.h"
-
 struct rte_power_channel_packet *get_policy(void);
 
 int set_policy_mac(int port, int idx);
diff --git a/examples/vm_power_manager/vm_power_cli.c b/examples/vm_power_manager/vm_power_cli.c
index f7e1b596e..1a55e553b 100644
--- a/examples/vm_power_manager/vm_power_cli.c
+++ b/examples/vm_power_manager/vm_power_cli.c
@@ -21,7 +21,6 @@
 #include "channel_manager.h"
 #include "channel_monitor.h"
 #include "power_manager.h"
-#include "rte_power_guest_channel.h"
 
 struct cmd_quit_result {
 	cmdline_fixed_string_t quit;
diff --git a/lib/librte_power/guest_channel.c b/lib/librte_power/guest_channel.c
index 039cb1872..2f7507a03 100644
--- a/lib/librte_power/guest_channel.c
+++ b/lib/librte_power/guest_channel.c
@@ -15,9 +15,9 @@
 
 
 #include <rte_log.h>
+#include <rte_power.h>
 
 #include "guest_channel.h"
-#include "rte_power_guest_channel.h"
 
 #define RTE_LOGTYPE_GUEST_CHANNEL RTE_LOGTYPE_USER1
 
diff --git a/lib/librte_power/guest_channel.h b/lib/librte_power/guest_channel.h
index 7d3a909d9..24f609df3 100644
--- a/lib/librte_power/guest_channel.h
+++ b/lib/librte_power/guest_channel.h
@@ -8,8 +8,6 @@
 extern "C" {
 #endif
 
-#include <rte_power_guest_channel.h>
-
 /**
  * Check if any Virtio-Serial VM end-points exist in path.
  *
diff --git a/lib/librte_power/power_kvm_vm.c b/lib/librte_power/power_kvm_vm.c
index 27f9937aa..ab7d4b8ce 100644
--- a/lib/librte_power/power_kvm_vm.c
+++ b/lib/librte_power/power_kvm_vm.c
@@ -6,8 +6,8 @@
 
 #include <rte_log.h>
 
-#include "guest_channel.h"
 #include "rte_power_guest_channel.h"
+#include "guest_channel.h"
 #include "power_kvm_vm.h"
 #include "power_common.h"
 
diff --git a/lib/librte_power/rte_power.h b/lib/librte_power/rte_power.h
index bbbde4dfb..c8086bf6b 100644
--- a/lib/librte_power/rte_power.h
+++ b/lib/librte_power/rte_power.h
@@ -14,6 +14,7 @@
 #include <rte_byteorder.h>
 #include <rte_log.h>
 #include <rte_string_fns.h>
+#include <rte_power_guest_channel.h>
 
 #ifdef __cplusplus
 extern "C" {
diff --git a/lib/librte_power/rte_power_guest_channel.h b/lib/librte_power/rte_power_guest_channel.h
index 8202314f7..bf41873ed 100644
--- a/lib/librte_power/rte_power_guest_channel.h
+++ b/lib/librte_power/rte_power_guest_channel.h
@@ -8,9 +8,6 @@
 extern "C" {
 #endif
 
-#include <stdint.h>
-#include <stdbool.h>
-
 #define RTE_POWER_MAX_VFS 10
 #define RTE_POWER_VM_MAX_NAME_SZ 32
 #define RTE_POWER_MAX_VCPU_PER_VM 8
-- 
2.17.1


^ permalink raw reply	[flat|nested] 69+ messages in thread

* Re: [dpdk-dev] [PATCH 0/6] power: fix make build for power apps
  2021-01-08 14:30 ` [dpdk-dev] [PATCH 0/6] " David Hunt
                     ` (5 preceding siblings ...)
  2021-01-08 14:30   ` [dpdk-dev] [PATCH v2 6/6] power: clean up includes David Hunt
@ 2021-01-13 11:08   ` Burakov, Anatoly
  2021-01-13 11:14     ` David Hunt
  6 siblings, 1 reply; 69+ messages in thread
From: Burakov, Anatoly @ 2021-01-13 11:08 UTC (permalink / raw)
  To: David Hunt, dev; +Cc: stable

On 08-Jan-21 2:30 PM, David Hunt wrote:
> The power example applications that uses the virtio-serial method of
> communication cannot currently be built with make, and can only be built
> using meson/ninja.
> 
> The guest channel message definitions and functions in guest_channel.h
> are needed by applications and need to be made public.
> 
> This worked pre-20.11, but now with all the meson/ninja changes, making
> these apps externally no longer works. To fix, we need to move the header
> file with the API definitions for the channel commands public, and rename
> the functions accordingly.
> 
> The main change is to rename channel_commands.h to
> rte_power_guest_channel.h so that it gets picked up by the installer and
> copied to /usr/local/include. Other changes include renaming #defines to
> have RTE_ at the beginning instead of CPU_. Finally we refactor the code
> to work with those changes.
> 
> ---
> v2 changes
>    - re-worked from monolithic patch to a 6 patch patchset for easier review
> 
> [PATCH v2 1/6] power: create guest channel public header file
> [PATCH v2 2/6] power: make channel msg functions public
> [PATCH v2 3/6] power: rename public structs
> [PATCH v2 4/6] power: rename defines
> [PATCH v2 5/6] power: add new header file to export list
> [PATCH v2 6/6] power: clean up includes
> 

Just a general question: wouldn't it be better to move this stuff 
entirely into sample app and not bother with keeping it in the library? 
There is precedent - ethtool app has a "library" and an "application" 
part, i think you should be able to move it out of the library and into 
the sample app entirely without too much trouble, as code looks to be 
fairly self-contained.

-- 
Thanks,
Anatoly

^ permalink raw reply	[flat|nested] 69+ messages in thread

* Re: [dpdk-dev] [PATCH 0/6] power: fix make build for power apps
  2021-01-13 11:08   ` [dpdk-dev] [PATCH 0/6] power: fix make build for power apps Burakov, Anatoly
@ 2021-01-13 11:14     ` David Hunt
  2021-01-13 11:18       ` Burakov, Anatoly
  0 siblings, 1 reply; 69+ messages in thread
From: David Hunt @ 2021-01-13 11:14 UTC (permalink / raw)
  To: Burakov, Anatoly, dev; +Cc: stable

Hi Anatoly,

On 13/1/2021 11:08 AM, Burakov, Anatoly wrote:
> On 08-Jan-21 2:30 PM, David Hunt wrote:
>> The power example applications that uses the virtio-serial method of
>> communication cannot currently be built with make, and can only be built
>> using meson/ninja.
>>
>> The guest channel message definitions and functions in guest_channel.h
>> are needed by applications and need to be made public.
>>
>> This worked pre-20.11, but now with all the meson/ninja changes, making
>> these apps externally no longer works. To fix, we need to move the 
>> header
>> file with the API definitions for the channel commands public, and 
>> rename
>> the functions accordingly.
>>
>> The main change is to rename channel_commands.h to
>> rte_power_guest_channel.h so that it gets picked up by the installer and
>> copied to /usr/local/include. Other changes include renaming #defines to
>> have RTE_ at the beginning instead of CPU_. Finally we refactor the code
>> to work with those changes.
>>
>> ---
>> v2 changes
>>    - re-worked from monolithic patch to a 6 patch patchset for easier 
>> review
>>
>> [PATCH v2 1/6] power: create guest channel public header file
>> [PATCH v2 2/6] power: make channel msg functions public
>> [PATCH v2 3/6] power: rename public structs
>> [PATCH v2 4/6] power: rename defines
>> [PATCH v2 5/6] power: add new header file to export list
>> [PATCH v2 6/6] power: clean up includes
>>
>
> Just a general question: wouldn't it be better to move this stuff 
> entirely into sample app and not bother with keeping it in the 
> library? There is precedent - ethtool app has a "library" and an 
> "application" part, i think you should be able to move it out of the 
> library and into the sample app entirely without too much trouble, as 
> code looks to be fairly self-contained.
>

Agreed, that's a great idea. I could have a common lib under 
examples/vm_power_manager, then two apps, vm_power_manager and 
guest_cli. That would keep everything nicely local, and not expose the 
channel API publicly. The only reason we were making it public was to 
allow "make" to work, so that's not a good enought reason, tbh. I'll 
throw a prototype together today.

Thanks,
Dave.





^ permalink raw reply	[flat|nested] 69+ messages in thread

* Re: [dpdk-dev] [PATCH 0/6] power: fix make build for power apps
  2021-01-13 11:14     ` David Hunt
@ 2021-01-13 11:18       ` Burakov, Anatoly
  2021-01-13 13:25         ` David Hunt
  0 siblings, 1 reply; 69+ messages in thread
From: Burakov, Anatoly @ 2021-01-13 11:18 UTC (permalink / raw)
  To: David Hunt, dev; +Cc: stable

On 13-Jan-21 11:14 AM, David Hunt wrote:
> Hi Anatoly,
> 
> On 13/1/2021 11:08 AM, Burakov, Anatoly wrote:
>> On 08-Jan-21 2:30 PM, David Hunt wrote:
>>> The power example applications that uses the virtio-serial method of
>>> communication cannot currently be built with make, and can only be built
>>> using meson/ninja.
>>>
>>> The guest channel message definitions and functions in guest_channel.h
>>> are needed by applications and need to be made public.
>>>
>>> This worked pre-20.11, but now with all the meson/ninja changes, making
>>> these apps externally no longer works. To fix, we need to move the 
>>> header
>>> file with the API definitions for the channel commands public, and 
>>> rename
>>> the functions accordingly.
>>>
>>> The main change is to rename channel_commands.h to
>>> rte_power_guest_channel.h so that it gets picked up by the installer and
>>> copied to /usr/local/include. Other changes include renaming #defines to
>>> have RTE_ at the beginning instead of CPU_. Finally we refactor the code
>>> to work with those changes.
>>>
>>> ---
>>> v2 changes
>>>    - re-worked from monolithic patch to a 6 patch patchset for easier 
>>> review
>>>
>>> [PATCH v2 1/6] power: create guest channel public header file
>>> [PATCH v2 2/6] power: make channel msg functions public
>>> [PATCH v2 3/6] power: rename public structs
>>> [PATCH v2 4/6] power: rename defines
>>> [PATCH v2 5/6] power: add new header file to export list
>>> [PATCH v2 6/6] power: clean up includes
>>>
>>
>> Just a general question: wouldn't it be better to move this stuff 
>> entirely into sample app and not bother with keeping it in the 
>> library? There is precedent - ethtool app has a "library" and an 
>> "application" part, i think you should be able to move it out of the 
>> library and into the sample app entirely without too much trouble, as 
>> code looks to be fairly self-contained.
>>
> 
> Agreed, that's a great idea. I could have a common lib under 
> examples/vm_power_manager, then two apps, vm_power_manager and 
> guest_cli. That would keep everything nicely local, and not expose the 
> channel API publicly. The only reason we were making it public was to 
> allow "make" to work, so that's not a good enought reason, tbh. I'll 
> throw a prototype together today.

Yep, IIRC Make works perfectly fine with ethtool, so i don't see why it 
wouldn't work for your sample app as well. Thanks!

> 
> Thanks,
> Dave.
> 
> 
> 
> 


-- 
Thanks,
Anatoly

^ permalink raw reply	[flat|nested] 69+ messages in thread

* Re: [dpdk-dev] [PATCH 0/6] power: fix make build for power apps
  2021-01-13 11:18       ` Burakov, Anatoly
@ 2021-01-13 13:25         ` David Hunt
  2021-01-13 17:30           ` Burakov, Anatoly
  0 siblings, 1 reply; 69+ messages in thread
From: David Hunt @ 2021-01-13 13:25 UTC (permalink / raw)
  To: Burakov, Anatoly, dev; +Cc: stable


On 13/1/2021 11:18 AM, Burakov, Anatoly wrote:
> On 13-Jan-21 11:14 AM, David Hunt wrote:
>> Hi Anatoly,
>>
>> On 13/1/2021 11:08 AM, Burakov, Anatoly wrote:
>>> On 08-Jan-21 2:30 PM, David Hunt wrote:
>>>> The power example applications that uses the virtio-serial method of
>>>> communication cannot currently be built with make, and can only be 
>>>> built
>>>> using meson/ninja.
>>>>
>>>> The guest channel message definitions and functions in guest_channel.h
>>>> are needed by applications and need to be made public.
>>>>
>>>> This worked pre-20.11, but now with all the meson/ninja changes, 
>>>> making
>>>> these apps externally no longer works. To fix, we need to move the 
>>>> header
>>>> file with the API definitions for the channel commands public, and 
>>>> rename
>>>> the functions accordingly.
>>>>
>>>> The main change is to rename channel_commands.h to
>>>> rte_power_guest_channel.h so that it gets picked up by the 
>>>> installer and
>>>> copied to /usr/local/include. Other changes include renaming 
>>>> #defines to
>>>> have RTE_ at the beginning instead of CPU_. Finally we refactor the 
>>>> code
>>>> to work with those changes.
>>>>
>>>> ---
>>>> v2 changes
>>>>    - re-worked from monolithic patch to a 6 patch patchset for 
>>>> easier review
>>>>
>>>> [PATCH v2 1/6] power: create guest channel public header file
>>>> [PATCH v2 2/6] power: make channel msg functions public
>>>> [PATCH v2 3/6] power: rename public structs
>>>> [PATCH v2 4/6] power: rename defines
>>>> [PATCH v2 5/6] power: add new header file to export list
>>>> [PATCH v2 6/6] power: clean up includes
>>>>
>>>
>>> Just a general question: wouldn't it be better to move this stuff 
>>> entirely into sample app and not bother with keeping it in the 
>>> library? There is precedent - ethtool app has a "library" and an 
>>> "application" part, i think you should be able to move it out of the 
>>> library and into the sample app entirely without too much trouble, 
>>> as code looks to be fairly self-contained.
>>>
>>
>> Agreed, that's a great idea. I could have a common lib under 
>> examples/vm_power_manager, then two apps, vm_power_manager and 
>> guest_cli. That would keep everything nicely local, and not expose 
>> the channel API publicly. The only reason we were making it public 
>> was to allow "make" to work, so that's not a good enought reason, 
>> tbh. I'll throw a prototype together today.
>
> Yep, IIRC Make works perfectly fine with ethtool, so i don't see why 
> it wouldn't work for your sample app as well. Thanks!


Hi Anatoly,

OK, so I was investigating this, and have come across a blocker on this 
method.

There are three methods for managing frequency, acpi, pstate and vm. 
It's the third method that's causing the problem with moving the channel 
functionality out into a sample library alongside vm_power_manger. VM's 
can call channel functions in the power library to affect frequency for 
their cores, and these functions use api function calls and several 
structures and #defines in their code, which is currently part of the 
power management library. These function declarations, structs and 
#defines ere needed in both the examples lib/apps and the power library 
itself, and the prototype changes I made ended up looking very much like 
the patch set that's already on the mailing list.

So, while I would have liked to have a solution along the lines of what 
you've proposed, it's not possible based on the dependencies on common 
structues and #defines.

Thanks for the suggestion, though.

Rgds,
Dave.






^ permalink raw reply	[flat|nested] 69+ messages in thread

* Re: [dpdk-dev] [PATCH 0/6] power: fix make build for power apps
  2021-01-13 13:25         ` David Hunt
@ 2021-01-13 17:30           ` Burakov, Anatoly
  0 siblings, 0 replies; 69+ messages in thread
From: Burakov, Anatoly @ 2021-01-13 17:30 UTC (permalink / raw)
  To: David Hunt, dev; +Cc: stable

On 13-Jan-21 1:25 PM, David Hunt wrote:
> 
> On 13/1/2021 11:18 AM, Burakov, Anatoly wrote:
>> On 13-Jan-21 11:14 AM, David Hunt wrote:
>>> Hi Anatoly,
>>>
>>> On 13/1/2021 11:08 AM, Burakov, Anatoly wrote:
>>>> On 08-Jan-21 2:30 PM, David Hunt wrote:
>>>>> The power example applications that uses the virtio-serial method of
>>>>> communication cannot currently be built with make, and can only be 
>>>>> built
>>>>> using meson/ninja.
>>>>>
>>>>> The guest channel message definitions and functions in guest_channel.h
>>>>> are needed by applications and need to be made public.
>>>>>
>>>>> This worked pre-20.11, but now with all the meson/ninja changes, 
>>>>> making
>>>>> these apps externally no longer works. To fix, we need to move the 
>>>>> header
>>>>> file with the API definitions for the channel commands public, and 
>>>>> rename
>>>>> the functions accordingly.
>>>>>
>>>>> The main change is to rename channel_commands.h to
>>>>> rte_power_guest_channel.h so that it gets picked up by the 
>>>>> installer and
>>>>> copied to /usr/local/include. Other changes include renaming 
>>>>> #defines to
>>>>> have RTE_ at the beginning instead of CPU_. Finally we refactor the 
>>>>> code
>>>>> to work with those changes.
>>>>>
>>>>> ---
>>>>> v2 changes
>>>>>    - re-worked from monolithic patch to a 6 patch patchset for 
>>>>> easier review
>>>>>
>>>>> [PATCH v2 1/6] power: create guest channel public header file
>>>>> [PATCH v2 2/6] power: make channel msg functions public
>>>>> [PATCH v2 3/6] power: rename public structs
>>>>> [PATCH v2 4/6] power: rename defines
>>>>> [PATCH v2 5/6] power: add new header file to export list
>>>>> [PATCH v2 6/6] power: clean up includes
>>>>>
>>>>
>>>> Just a general question: wouldn't it be better to move this stuff 
>>>> entirely into sample app and not bother with keeping it in the 
>>>> library? There is precedent - ethtool app has a "library" and an 
>>>> "application" part, i think you should be able to move it out of the 
>>>> library and into the sample app entirely without too much trouble, 
>>>> as code looks to be fairly self-contained.
>>>>
>>>
>>> Agreed, that's a great idea. I could have a common lib under 
>>> examples/vm_power_manager, then two apps, vm_power_manager and 
>>> guest_cli. That would keep everything nicely local, and not expose 
>>> the channel API publicly. The only reason we were making it public 
>>> was to allow "make" to work, so that's not a good enought reason, 
>>> tbh. I'll throw a prototype together today.
>>
>> Yep, IIRC Make works perfectly fine with ethtool, so i don't see why 
>> it wouldn't work for your sample app as well. Thanks!
> 
> 
> Hi Anatoly,
> 
> OK, so I was investigating this, and have come across a blocker on this 
> method.
> 
> There are three methods for managing frequency, acpi, pstate and vm. 
> It's the third method that's causing the problem with moving the channel 
> functionality out into a sample library alongside vm_power_manger. VM's 
> can call channel functions in the power library to affect frequency for 
> their cores, and these functions use api function calls and several 
> structures and #defines in their code, which is currently part of the 
> power management library. These function declarations, structs and 
> #defines ere needed in both the examples lib/apps and the power library 
> itself, and the prototype changes I made ended up looking very much like 
> the patch set that's already on the mailing list.
> 
> So, while I would have liked to have a solution along the lines of what 
> you've proposed, it's not possible based on the dependencies on common 
> structues and #defines.
> 
> Thanks for the suggestion, though.
> 
> Rgds,
> Dave.
> 

OK, i guess we can live with that. I wonder if there's another way to do 
this, but since i can't think of anything that doesn't involve serious 
API/ABI breakages, this is OK IMO.

-- 
Thanks,
Anatoly

^ permalink raw reply	[flat|nested] 69+ messages in thread

* Re: [dpdk-dev] [dpdk-stable] [PATCH v2 2/6] power: make channel msg functions public
  2021-01-08 14:30   ` [dpdk-dev] [PATCH v2 2/6] power: make channel msg functions public David Hunt
@ 2021-01-19 14:31     ` Thomas Monjalon
  2021-01-19 14:51       ` David Hunt
  0 siblings, 1 reply; 69+ messages in thread
From: Thomas Monjalon @ 2021-01-19 14:31 UTC (permalink / raw)
  To: Bruce Richardson, David Hunt; +Cc: dev, stable, anatoly.burakov

08/01/2021 15:30, David Hunt:
> From: Bruce Richardson <bruce.richardson@intel.com>
> 
> Move the 2 public functions into rte_power_guest_channel.h
[...]
> +/**
> + * Send a message contained in pkt over the Virtio-Serial to the host endpoint.
> + *
> + * @param pkt
> + *  Pointer to a populated struct channel_packet
> + *
> + * @param lcore_id
> + *  lcore_id.
> + *
> + * @return
> + *  - 0 on success.
> + *  - Negative on error.
> + */
> +int rte_power_guest_channel_send_msg(struct channel_packet *pkt,
> +			unsigned int lcore_id);
> +
> +/**
> + * Receive a message contained in pkt over the Virtio-Serial
> + * from the host endpoint.
> + *
> + * @param pkt
> + *  Pointer to channel_packet or
> + *  channel_packet_freq_list struct.
> + *
> + * @param pkt_len
> + *  Size of expected data packet.
> + *
> + * @param lcore_id
> + *  lcore_id.
> + *
> + * @return
> + *  - 0 on success.
> + *  - Negative on error.
> + */
> +__rte_experimental
> +int
> +rte_power_guest_channel_receive_msg(void *pkt,
> +		size_t pkt_len,
> +		unsigned int lcore_id);

Why only the second one is experimental?

Given the uncertainty of this API, I think it should be all experimental.



^ permalink raw reply	[flat|nested] 69+ messages in thread

* Re: [dpdk-dev] [dpdk-stable] [PATCH v2 2/6] power: make channel msg functions public
  2021-01-19 14:31     ` [dpdk-dev] [dpdk-stable] " Thomas Monjalon
@ 2021-01-19 14:51       ` David Hunt
  0 siblings, 0 replies; 69+ messages in thread
From: David Hunt @ 2021-01-19 14:51 UTC (permalink / raw)
  To: Thomas Monjalon, Bruce Richardson; +Cc: dev, stable, anatoly.burakov


On 19/1/2021 2:31 PM, Thomas Monjalon wrote:
> 08/01/2021 15:30, David Hunt:
>> From: Bruce Richardson <bruce.richardson@intel.com>
>>
>> Move the 2 public functions into rte_power_guest_channel.h
> [...]
>> +/**
>> + * Send a message contained in pkt over the Virtio-Serial to the host endpoint.
>> + *
>> + * @param pkt
>> + *  Pointer to a populated struct channel_packet
>> + *
>> + * @param lcore_id
>> + *  lcore_id.
>> + *
>> + * @return
>> + *  - 0 on success.
>> + *  - Negative on error.
>> + */
>> +int rte_power_guest_channel_send_msg(struct channel_packet *pkt,
>> +			unsigned int lcore_id);
>> +
>> +/**
>> + * Receive a message contained in pkt over the Virtio-Serial
>> + * from the host endpoint.
>> + *
>> + * @param pkt
>> + *  Pointer to channel_packet or
>> + *  channel_packet_freq_list struct.
>> + *
>> + * @param pkt_len
>> + *  Size of expected data packet.
>> + *
>> + * @param lcore_id
>> + *  lcore_id.
>> + *
>> + * @return
>> + *  - 0 on success.
>> + *  - Negative on error.
>> + */
>> +__rte_experimental
>> +int
>> +rte_power_guest_channel_receive_msg(void *pkt,
>> +		size_t pkt_len,
>> +		unsigned int lcore_id);
> Why only the second one is experimental?
>
> Given the uncertainty of this API, I think it should be all experimental.
>
Yes Thomas, both should be experimental. I'll fix that in the next version.

Thanks,
Dave.



^ permalink raw reply	[flat|nested] 69+ messages in thread

* [dpdk-dev] [PATCH v3 0/6] power: fix make build for power apps
  2021-01-08 14:30   ` [dpdk-dev] [PATCH v2 1/6] power: create guest channel public header file David Hunt
@ 2021-01-20 13:55     ` David Hunt
  2021-01-20 13:55       ` [dpdk-dev] [PATCH v3 1/6] power: create guest channel public header file David Hunt
                         ` (5 more replies)
  0 siblings, 6 replies; 69+ messages in thread
From: David Hunt @ 2021-01-20 13:55 UTC (permalink / raw)
  To: dev; +Cc: david.hunt, stable

The guest channel message definitions and functions in guest_channel.h
are needed by applications and need to be made public.

This worked pre-20.11, but now with all the meson/ninja changes, making
these apps externally no longer works. To fix, we need to move the
header file with the API definitions for the channel commands public,
and rename the functions accordingly.

The main change is to rename channel_commands.h to
rte_power_guest_channel.h so that it gets picked up by the installer
and copied to /usr/local/include. Other changes include renaming #defines
to have RTE_ at the beginning instead of CPU_. Finally we refactor the
code to work with those changes.

---
v2 changes
  - re-worked from monolithic patch to a 6 patch patchset for easier review
v3 changes
  - Ensure both functions added to the API are tagged as experimental



^ permalink raw reply	[flat|nested] 69+ messages in thread

* [dpdk-dev] [PATCH v3 1/6] power: create guest channel public header file
  2021-01-20 13:55     ` [dpdk-dev] [PATCH v3 0/6] power: fix make build for power apps David Hunt
@ 2021-01-20 13:55       ` David Hunt
  2021-01-20 15:09         ` Burakov, Anatoly
  2021-01-21 17:21         ` [dpdk-dev] [PATCH v4 0/6] power: fix make build for power apps David Hunt
  2021-01-20 13:55       ` [dpdk-dev] [PATCH v3 2/6] power: make channel msg functions public David Hunt
                         ` (4 subsequent siblings)
  5 siblings, 2 replies; 69+ messages in thread
From: David Hunt @ 2021-01-20 13:55 UTC (permalink / raw)
  To: dev; +Cc: david.hunt, stable, Bruce Richardson

From: Bruce Richardson <bruce.richardson@intel.com>

In preparation for making the header file public, we first rename
channel_commands.h as rte_power_guest_channel.h.

Fixes: 210c383e247b ("power: packet format for vm power management")
Fixes: cd0d5547e873 ("power: vm communication channels in guest")
Cc: stable@dpdk.org

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: David Hunt <david.hunt@intel.com>
---
 examples/vm_power_manager/channel_manager.c              | 2 +-
 examples/vm_power_manager/channel_monitor.c              | 2 +-
 examples/vm_power_manager/channel_monitor.h              | 2 +-
 examples/vm_power_manager/guest_cli/vm_power_cli_guest.h | 2 +-
 examples/vm_power_manager/vm_power_cli.c                 | 2 +-
 lib/librte_power/guest_channel.c                         | 2 +-
 lib/librte_power/guest_channel.h                         | 2 +-
 lib/librte_power/power_kvm_vm.c                          | 2 +-
 .../{channel_commands.h => rte_power_guest_channel.h}    | 9 ++++-----
 9 files changed, 12 insertions(+), 13 deletions(-)
 rename lib/librte_power/{channel_commands.h => rte_power_guest_channel.h} (94%)

diff --git a/examples/vm_power_manager/channel_manager.c b/examples/vm_power_manager/channel_manager.c
index a26315051..c7d5bf5a8 100644
--- a/examples/vm_power_manager/channel_manager.c
+++ b/examples/vm_power_manager/channel_manager.c
@@ -27,7 +27,7 @@
 #include <libvirt/libvirt.h>
 
 #include "channel_manager.h"
-#include "channel_commands.h"
+#include "rte_power_guest_channel.h"
 #include "channel_monitor.h"
 #include "power_manager.h"
 
diff --git a/examples/vm_power_manager/channel_monitor.c b/examples/vm_power_manager/channel_monitor.c
index 228f06803..08306105d 100644
--- a/examples/vm_power_manager/channel_monitor.c
+++ b/examples/vm_power_manager/channel_monitor.c
@@ -35,7 +35,7 @@
 
 #include <libvirt/libvirt.h>
 #include "channel_monitor.h"
-#include "channel_commands.h"
+#include "rte_power_guest_channel.h"
 #include "channel_manager.h"
 #include "power_manager.h"
 #include "oob_monitor.h"
diff --git a/examples/vm_power_manager/channel_monitor.h b/examples/vm_power_manager/channel_monitor.h
index 7362a80d2..4a526ff67 100644
--- a/examples/vm_power_manager/channel_monitor.h
+++ b/examples/vm_power_manager/channel_monitor.h
@@ -6,7 +6,7 @@
 #define CHANNEL_MONITOR_H_
 
 #include "channel_manager.h"
-#include "channel_commands.h"
+#include "rte_power_guest_channel.h"
 
 struct core_share {
 	unsigned int pcpu;
diff --git a/examples/vm_power_manager/guest_cli/vm_power_cli_guest.h b/examples/vm_power_manager/guest_cli/vm_power_cli_guest.h
index 6ad14a3de..2299d23dc 100644
--- a/examples/vm_power_manager/guest_cli/vm_power_cli_guest.h
+++ b/examples/vm_power_manager/guest_cli/vm_power_cli_guest.h
@@ -9,7 +9,7 @@
 extern "C" {
 #endif
 
-#include "channel_commands.h"
+#include "rte_power_guest_channel.h"
 
 struct channel_packet *get_policy(void);
 
diff --git a/examples/vm_power_manager/vm_power_cli.c b/examples/vm_power_manager/vm_power_cli.c
index ed0623a41..f7e1b596e 100644
--- a/examples/vm_power_manager/vm_power_cli.c
+++ b/examples/vm_power_manager/vm_power_cli.c
@@ -21,7 +21,7 @@
 #include "channel_manager.h"
 #include "channel_monitor.h"
 #include "power_manager.h"
-#include "channel_commands.h"
+#include "rte_power_guest_channel.h"
 
 struct cmd_quit_result {
 	cmdline_fixed_string_t quit;
diff --git a/lib/librte_power/guest_channel.c b/lib/librte_power/guest_channel.c
index 7b5926e5c..4cb5ae1dd 100644
--- a/lib/librte_power/guest_channel.c
+++ b/lib/librte_power/guest_channel.c
@@ -17,7 +17,7 @@
 #include <rte_log.h>
 
 #include "guest_channel.h"
-#include "channel_commands.h"
+#include "rte_power_guest_channel.h"
 
 #define RTE_LOGTYPE_GUEST_CHANNEL RTE_LOGTYPE_USER1
 
diff --git a/lib/librte_power/guest_channel.h b/lib/librte_power/guest_channel.h
index e15db46fc..d3d87f0ae 100644
--- a/lib/librte_power/guest_channel.h
+++ b/lib/librte_power/guest_channel.h
@@ -8,7 +8,7 @@
 extern "C" {
 #endif
 
-#include <channel_commands.h>
+#include <rte_power_guest_channel.h>
 
 /**
  * Check if any Virtio-Serial VM end-points exist in path.
diff --git a/lib/librte_power/power_kvm_vm.c b/lib/librte_power/power_kvm_vm.c
index 409c3e03a..649ebe85c 100644
--- a/lib/librte_power/power_kvm_vm.c
+++ b/lib/librte_power/power_kvm_vm.c
@@ -7,7 +7,7 @@
 #include <rte_log.h>
 
 #include "guest_channel.h"
-#include "channel_commands.h"
+#include "rte_power_guest_channel.h"
 #include "power_kvm_vm.h"
 #include "power_common.h"
 
diff --git a/lib/librte_power/channel_commands.h b/lib/librte_power/rte_power_guest_channel.h
similarity index 94%
rename from lib/librte_power/channel_commands.h
rename to lib/librte_power/rte_power_guest_channel.h
index adc8e5ca2..ef3b064a8 100644
--- a/lib/librte_power/channel_commands.h
+++ b/lib/librte_power/rte_power_guest_channel.h
@@ -1,9 +1,8 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2010-2014 Intel Corporation
+ * Copyright(c) 2010-2021 Intel Corporation
  */
-
-#ifndef CHANNEL_COMMANDS_H_
-#define CHANNEL_COMMANDS_H_
+#ifndef RTE_POWER_GUEST_CHANNEL_H
+#define RTE_POWER_GUEST_CHANNEL_H
 
 #ifdef __cplusplus
 extern "C" {
@@ -122,4 +121,4 @@ struct channel_packet_caps_list {
 }
 #endif
 
-#endif /* CHANNEL_COMMANDS_H_ */
+#endif /* RTE_POWER_GUEST_CHANNEL_H_ */
-- 
2.17.1


^ permalink raw reply	[flat|nested] 69+ messages in thread

* [dpdk-dev] [PATCH v3 2/6] power: make channel msg functions public
  2021-01-20 13:55     ` [dpdk-dev] [PATCH v3 0/6] power: fix make build for power apps David Hunt
  2021-01-20 13:55       ` [dpdk-dev] [PATCH v3 1/6] power: create guest channel public header file David Hunt
@ 2021-01-20 13:55       ` David Hunt
  2021-01-20 14:26         ` Burakov, Anatoly
  2021-01-20 13:55       ` [dpdk-dev] [PATCH v3 3/6] power: rename public structs David Hunt
                         ` (3 subsequent siblings)
  5 siblings, 1 reply; 69+ messages in thread
From: David Hunt @ 2021-01-20 13:55 UTC (permalink / raw)
  To: dev; +Cc: david.hunt, stable, Bruce Richardson

From: Bruce Richardson <bruce.richardson@intel.com>

Move the 2 public functions into rte_power_guest_channel.h

Fixes: 210c383e247b ("power: packet format for vm power management")
Fixes: cd0d5547e873 ("power: vm communication channels in guest")
Cc: stable@dpdk.org

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: David Hunt <david.hunt@intel.com>

---
changes in v3
* Mark both added functions as experimental
---
 lib/librte_power/guest_channel.h           | 40 +---------------------
 lib/librte_power/rte_power_guest_channel.h | 40 ++++++++++++++++++++++
 2 files changed, 41 insertions(+), 39 deletions(-)

diff --git a/lib/librte_power/guest_channel.h b/lib/librte_power/guest_channel.h
index d3d87f0ae..69020b030 100644
--- a/lib/librte_power/guest_channel.h
+++ b/lib/librte_power/guest_channel.h
@@ -65,21 +65,7 @@ void guest_channel_host_disconnect(unsigned int 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.
- *
- * @param pkt
- *  Pointer to a populated struct channel_packet
- *
- * @param lcore_id
- *  lcore_id.
- *
- * @return
- *  - 0 on success.
- *  - Negative on error.
- */
-int rte_power_guest_channel_send_msg(struct channel_packet *pkt,
-			unsigned int lcore_id);
+
 
 /**
  * Read a message contained in pkt over the Virtio-Serial
@@ -103,30 +89,6 @@ int power_guest_channel_read_msg(void *pkt,
 		size_t pkt_len,
 		unsigned int lcore_id);
 
-/**
- * Receive a message contained in pkt over the Virtio-Serial
- * from the host endpoint.
- *
- * @param pkt
- *  Pointer to channel_packet or
- *  channel_packet_freq_list struct.
- *
- * @param pkt_len
- *  Size of expected data packet.
- *
- * @param lcore_id
- *  lcore_id.
- *
- * @return
- *  - 0 on success.
- *  - Negative on error.
- */
-__rte_experimental
-int
-rte_power_guest_channel_receive_msg(void *pkt,
-		size_t pkt_len,
-		unsigned int lcore_id);
-
 
 #ifdef __cplusplus
 }
diff --git a/lib/librte_power/rte_power_guest_channel.h b/lib/librte_power/rte_power_guest_channel.h
index ef3b064a8..26469b6c8 100644
--- a/lib/librte_power/rte_power_guest_channel.h
+++ b/lib/librte_power/rte_power_guest_channel.h
@@ -116,6 +116,46 @@ struct channel_packet_caps_list {
 	uint8_t num_vcpu;
 };
 
+/**
+ * Send a message contained in pkt over the Virtio-Serial to the host endpoint.
+ *
+ * @param pkt
+ *  Pointer to a populated struct channel_packet
+ *
+ * @param lcore_id
+ *  lcore_id.
+ *
+ * @return
+ *  - 0 on success.
+ *  - Negative on error.
+ */
+__rte_experimental
+int rte_power_guest_channel_send_msg(struct channel_packet *pkt,
+			unsigned int lcore_id);
+
+/**
+ * Receive a message contained in pkt over the Virtio-Serial
+ * from the host endpoint.
+ *
+ * @param pkt
+ *  Pointer to channel_packet or
+ *  channel_packet_freq_list struct.
+ *
+ * @param pkt_len
+ *  Size of expected data packet.
+ *
+ * @param lcore_id
+ *  lcore_id.
+ *
+ * @return
+ *  - 0 on success.
+ *  - Negative on error.
+ */
+__rte_experimental
+int rte_power_guest_channel_receive_msg(void *pkt,
+		size_t pkt_len,
+		unsigned int lcore_id);
+
 
 #ifdef __cplusplus
 }
-- 
2.17.1


^ permalink raw reply	[flat|nested] 69+ messages in thread

* [dpdk-dev] [PATCH v3 3/6] power: rename public structs
  2021-01-20 13:55     ` [dpdk-dev] [PATCH v3 0/6] power: fix make build for power apps David Hunt
  2021-01-20 13:55       ` [dpdk-dev] [PATCH v3 1/6] power: create guest channel public header file David Hunt
  2021-01-20 13:55       ` [dpdk-dev] [PATCH v3 2/6] power: make channel msg functions public David Hunt
@ 2021-01-20 13:55       ` David Hunt
  2021-01-20 14:27         ` Burakov, Anatoly
  2021-01-20 13:55       ` [dpdk-dev] [PATCH v3 4/6] power: rename defines David Hunt
                         ` (2 subsequent siblings)
  5 siblings, 1 reply; 69+ messages in thread
From: David Hunt @ 2021-01-20 13:55 UTC (permalink / raw)
  To: dev; +Cc: david.hunt, stable, Bruce Richardson

From: Bruce Richardson <bruce.richardson@intel.com>

rename the public structs to have an rte_power_ prefix.

Fixes: 210c383e247b ("power: packet format for vm power management")
Fixes: cd0d5547e873 ("power: vm communication channels in guest")
Cc: stable@dpdk.org

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: David Hunt <david.hunt@intel.com>
---
---
 examples/vm_power_manager/channel_monitor.c   | 33 ++++++------
 examples/vm_power_manager/channel_monitor.h   |  2 +-
 examples/vm_power_manager/guest_cli/main.c    |  2 +-
 .../guest_cli/vm_power_cli_guest.c            | 40 ++++++++-------
 .../guest_cli/vm_power_cli_guest.h            |  4 +-
 lib/librte_power/guest_channel.c              |  7 +--
 lib/librte_power/guest_channel.h              |  7 +--
 lib/librte_power/power_kvm_vm.c               |  2 +-
 lib/librte_power/rte_power_guest_channel.h    | 51 +++++++++----------
 9 files changed, 75 insertions(+), 73 deletions(-)

diff --git a/examples/vm_power_manager/channel_monitor.c b/examples/vm_power_manager/channel_monitor.c
index 08306105d..5d5383494 100644
--- a/examples/vm_power_manager/channel_monitor.c
+++ b/examples/vm_power_manager/channel_monitor.c
@@ -108,7 +108,7 @@ str_to_ether_addr(const char *a, struct rte_ether_addr *ether_addr)
 }
 
 static int
-set_policy_mac(struct channel_packet *pkt, int idx, char *mac)
+set_policy_mac(struct rte_power_channel_packet *pkt, int idx, char *mac)
 {
 	union PFID pfid;
 	int ret;
@@ -165,7 +165,7 @@ get_resource_id_from_vmname(const char *vm_name)
 }
 
 static int
-parse_json_to_pkt(json_t *element, struct channel_packet *pkt,
+parse_json_to_pkt(json_t *element, struct rte_power_channel_packet *pkt,
 					const char *vm_name)
 {
 	const char *key;
@@ -173,7 +173,7 @@ parse_json_to_pkt(json_t *element, struct channel_packet *pkt,
 	int ret;
 	int resource_id;
 
-	memset(pkt, 0, sizeof(struct channel_packet));
+	memset(pkt, 0, sizeof(struct rte_power_channel_packet));
 
 	pkt->nb_mac_to_monitor = 0;
 	pkt->t_boost_status.tbEnabled = false;
@@ -463,7 +463,7 @@ get_pfid(struct policy *pol)
 }
 
 static int
-update_policy(struct channel_packet *pkt)
+update_policy(struct rte_power_channel_packet *pkt)
 {
 
 	unsigned int updated = 0;
@@ -512,7 +512,7 @@ update_policy(struct channel_packet *pkt)
 }
 
 static int
-remove_policy(struct channel_packet *pkt __rte_unused)
+remove_policy(struct rte_power_channel_packet *pkt __rte_unused)
 {
 	unsigned int i;
 
@@ -673,7 +673,7 @@ static void
 apply_policy(struct policy *pol)
 {
 
-	struct channel_packet *pkt = &pol->pkt;
+	struct rte_power_channel_packet *pkt = &pol->pkt;
 
 	/*Check policy to use*/
 	if (pkt->policy_to_use == TRAFFIC)
@@ -715,12 +715,12 @@ write_binary_packet(void *buffer,
 }
 
 static int
-send_freq(struct channel_packet *pkt,
+send_freq(struct rte_power_channel_packet *pkt,
 		struct channel_info *chan_info,
 		bool freq_list)
 {
 	unsigned int vcore_id = pkt->resource_id;
-	struct channel_packet_freq_list channel_pkt_freq_list;
+	struct rte_power_channel_packet_freq_list channel_pkt_freq_list;
 	struct vm_info info;
 
 	if (get_info_vm(pkt->vm_name, &info) != 0)
@@ -751,12 +751,12 @@ send_freq(struct channel_packet *pkt,
 }
 
 static int
-send_capabilities(struct channel_packet *pkt,
+send_capabilities(struct rte_power_channel_packet *pkt,
 		struct channel_info *chan_info,
 		bool list_requested)
 {
 	unsigned int vcore_id = pkt->resource_id;
-	struct channel_packet_caps_list channel_pkt_caps_list;
+	struct rte_power_channel_packet_caps_list channel_pkt_caps_list;
 	struct vm_info info;
 	struct rte_power_core_capabilities caps;
 	int ret;
@@ -805,18 +805,19 @@ send_capabilities(struct channel_packet *pkt,
 }
 
 static int
-send_ack_for_received_cmd(struct channel_packet *pkt,
+send_ack_for_received_cmd(struct rte_power_channel_packet *pkt,
 		struct channel_info *chan_info,
 		uint32_t command)
 {
 	pkt->command = command;
 	return write_binary_packet(pkt,
-			sizeof(struct channel_packet),
+			sizeof(struct rte_power_channel_packet),
 			chan_info);
 }
 
 static int
-process_request(struct channel_packet *pkt, struct channel_info *chan_info)
+process_request(struct rte_power_channel_packet *pkt,
+		struct channel_info *chan_info)
 {
 	int ret;
 
@@ -988,7 +989,7 @@ channel_monitor_init(void)
 static void
 read_binary_packet(struct channel_info *chan_info)
 {
-	struct channel_packet pkt;
+	struct rte_power_channel_packet pkt;
 	void *buffer = &pkt;
 	int buffer_len = sizeof(pkt);
 	int n_bytes, err = 0;
@@ -1019,7 +1020,7 @@ read_binary_packet(struct channel_info *chan_info)
 static void
 read_json_packet(struct channel_info *chan_info)
 {
-	struct channel_packet pkt;
+	struct rte_power_channel_packet pkt;
 	int n_bytes, ret;
 	json_t *root;
 	json_error_t error;
@@ -1063,7 +1064,7 @@ read_json_packet(struct channel_info *chan_info)
 			/*
 			 * Because our data is now in the json
 			 * object, we can overwrite the pkt
-			 * with a channel_packet struct, using
+			 * with a rte_power_channel_packet struct, using
 			 * parse_json_to_pkt()
 			 */
 			ret = parse_json_to_pkt(root, &pkt, resource_name);
diff --git a/examples/vm_power_manager/channel_monitor.h b/examples/vm_power_manager/channel_monitor.h
index 4a526ff67..0ca6207ad 100644
--- a/examples/vm_power_manager/channel_monitor.h
+++ b/examples/vm_power_manager/channel_monitor.h
@@ -18,7 +18,7 @@ struct core_share {
 };
 
 struct policy {
-	struct channel_packet pkt;
+	struct rte_power_channel_packet pkt;
 	uint32_t pfid[MAX_VFS];
 	uint32_t port[MAX_VFS];
 	unsigned int enabled;
diff --git a/examples/vm_power_manager/guest_cli/main.c b/examples/vm_power_manager/guest_cli/main.c
index f63b3c988..fc7a8c30a 100644
--- a/examples/vm_power_manager/guest_cli/main.c
+++ b/examples/vm_power_manager/guest_cli/main.c
@@ -48,7 +48,7 @@ parse_args(int argc, char **argv)
 		{ "policy", required_argument, 0, 'o'},
 		{NULL, 0, 0, 0}
 	};
-	struct channel_packet *policy;
+	struct rte_power_channel_packet *policy;
 	unsigned short int hours[MAX_HOURS];
 	unsigned short int cores[MAX_VCPU_PER_VM];
 	unsigned short int ports[MAX_VCPU_PER_VM];
diff --git a/examples/vm_power_manager/guest_cli/vm_power_cli_guest.c b/examples/vm_power_manager/guest_cli/vm_power_cli_guest.c
index cf1636e78..b7c8f850e 100644
--- a/examples/vm_power_manager/guest_cli/vm_power_cli_guest.c
+++ b/examples/vm_power_manager/guest_cli/vm_power_cli_guest.c
@@ -38,9 +38,9 @@ union PFID {
 	uint64_t pfid;
 };
 
-static struct channel_packet policy;
+static struct rte_power_channel_packet policy;
 
-struct channel_packet *
+struct rte_power_channel_packet *
 get_policy(void)
 {
 	return &policy;
@@ -49,7 +49,7 @@ get_policy(void)
 int
 set_policy_mac(int port, int idx)
 {
-	struct channel_packet *policy;
+	struct rte_power_channel_packet *policy;
 	union PFID pfid;
 	int ret;
 
@@ -73,7 +73,7 @@ set_policy_mac(int port, int idx)
 }
 
 int
-set_policy_defaults(struct channel_packet *pkt)
+set_policy_defaults(struct rte_power_channel_packet *pkt)
 {
 	int ret;
 
@@ -145,7 +145,7 @@ struct cmd_freq_list_result {
 };
 
 static int
-query_data(struct channel_packet *pkt, unsigned int lcore_id)
+query_data(struct rte_power_channel_packet *pkt, unsigned int lcore_id)
 {
 	int ret;
 	ret = rte_power_guest_channel_send_msg(pkt, lcore_id);
@@ -157,13 +157,13 @@ query_data(struct channel_packet *pkt, unsigned int lcore_id)
 }
 
 static int
-receive_freq_list(struct channel_packet_freq_list *pkt_freq_list,
+receive_freq_list(struct rte_power_channel_packet_freq_list *pkt_freq_list,
 		unsigned int lcore_id)
 {
 	int ret;
 
 	ret = rte_power_guest_channel_receive_msg(pkt_freq_list,
-			sizeof(struct channel_packet_freq_list),
+			sizeof(struct rte_power_channel_packet_freq_list),
 			lcore_id);
 	if (ret < 0) {
 		RTE_LOG(ERR, GUEST_CLI, "Error receiving message.\n");
@@ -183,14 +183,15 @@ cmd_query_freq_list_parsed(void *parsed_result,
 {
 	struct cmd_freq_list_result *res = parsed_result;
 	unsigned int lcore_id;
-	struct channel_packet_freq_list pkt_freq_list;
-	struct channel_packet pkt;
+	struct rte_power_channel_packet_freq_list pkt_freq_list;
+	struct rte_power_channel_packet pkt;
 	bool query_list = false;
 	int ret;
 	char *ep;
 
-	memset(&pkt, 0, sizeof(struct channel_packet));
-	memset(&pkt_freq_list, 0, sizeof(struct channel_packet_freq_list));
+	memset(&pkt, 0, sizeof(struct rte_power_channel_packet));
+	memset(&pkt_freq_list, 0,
+			sizeof(struct rte_power_channel_packet_freq_list));
 
 	if (!strcmp(res->cpu_num, "all")) {
 
@@ -267,13 +268,13 @@ struct cmd_query_caps_result {
 };
 
 static int
-receive_capabilities(struct channel_packet_caps_list *pkt_caps_list,
+receive_capabilities(struct rte_power_channel_packet_caps_list *pkt_caps_list,
 		unsigned int lcore_id)
 {
 	int ret;
 
 	ret = rte_power_guest_channel_receive_msg(pkt_caps_list,
-		sizeof(struct channel_packet_caps_list),
+		sizeof(struct rte_power_channel_packet_caps_list),
 		lcore_id);
 	if (ret < 0) {
 		RTE_LOG(ERR, GUEST_CLI, "Error receiving message.\n");
@@ -293,14 +294,15 @@ cmd_query_caps_list_parsed(void *parsed_result,
 {
 	struct cmd_query_caps_result *res = parsed_result;
 	unsigned int lcore_id;
-	struct channel_packet_caps_list pkt_caps_list;
-	struct channel_packet pkt;
+	struct rte_power_channel_packet_caps_list pkt_caps_list;
+	struct rte_power_channel_packet pkt;
 	bool query_list = false;
 	int ret;
 	char *ep;
 
-	memset(&pkt, 0, sizeof(struct channel_packet));
-	memset(&pkt_caps_list, 0, sizeof(struct channel_packet_caps_list));
+	memset(&pkt, 0, sizeof(struct rte_power_channel_packet));
+	memset(&pkt_caps_list, 0,
+			sizeof(struct rte_power_channel_packet_caps_list));
 
 	if (!strcmp(res->cpu_num, "all")) {
 
@@ -380,7 +382,7 @@ cmdline_parse_inst_t cmd_query_caps_list = {
 static int
 check_response_cmd(unsigned int lcore_id, int *result)
 {
-	struct channel_packet pkt;
+	struct rte_power_channel_packet pkt;
 	int ret;
 
 	ret = rte_power_guest_channel_receive_msg(&pkt, sizeof pkt, lcore_id);
@@ -473,7 +475,7 @@ struct cmd_send_policy_result {
 };
 
 static inline int
-send_policy(struct channel_packet *pkt, struct cmdline *cl)
+send_policy(struct rte_power_channel_packet *pkt, struct cmdline *cl)
 {
 	int ret;
 
diff --git a/examples/vm_power_manager/guest_cli/vm_power_cli_guest.h b/examples/vm_power_manager/guest_cli/vm_power_cli_guest.h
index 2299d23dc..5d285ca9d 100644
--- a/examples/vm_power_manager/guest_cli/vm_power_cli_guest.h
+++ b/examples/vm_power_manager/guest_cli/vm_power_cli_guest.h
@@ -11,11 +11,11 @@ extern "C" {
 
 #include "rte_power_guest_channel.h"
 
-struct channel_packet *get_policy(void);
+struct rte_power_channel_packet *get_policy(void);
 
 int set_policy_mac(int port, int idx);
 
-int set_policy_defaults(struct channel_packet *pkt);
+int set_policy_defaults(struct rte_power_channel_packet *pkt);
 
 void run_cli(__rte_unused void *arg);
 
diff --git a/lib/librte_power/guest_channel.c b/lib/librte_power/guest_channel.c
index 4cb5ae1dd..9eb2f6330 100644
--- a/lib/librte_power/guest_channel.c
+++ b/lib/librte_power/guest_channel.c
@@ -55,7 +55,7 @@ int
 guest_channel_host_connect(const char *path, unsigned int lcore_id)
 {
 	int flags, ret;
-	struct channel_packet pkt;
+	struct rte_power_channel_packet pkt;
 	char fd_path[PATH_MAX];
 	int fd = -1;
 
@@ -119,7 +119,8 @@ guest_channel_host_connect(const char *path, unsigned int lcore_id)
 }
 
 int
-guest_channel_send_msg(struct channel_packet *pkt, unsigned int lcore_id)
+guest_channel_send_msg(struct rte_power_channel_packet *pkt,
+		unsigned int lcore_id)
 {
 	int ret, buffer_len = sizeof(*pkt);
 	void *buffer = pkt;
@@ -149,7 +150,7 @@ guest_channel_send_msg(struct channel_packet *pkt, unsigned int lcore_id)
 	return 0;
 }
 
-int rte_power_guest_channel_send_msg(struct channel_packet *pkt,
+int rte_power_guest_channel_send_msg(struct rte_power_channel_packet *pkt,
 			unsigned int lcore_id)
 {
 	return guest_channel_send_msg(pkt, lcore_id);
diff --git a/lib/librte_power/guest_channel.h b/lib/librte_power/guest_channel.h
index 69020b030..7d3a909d9 100644
--- a/lib/librte_power/guest_channel.h
+++ b/lib/librte_power/guest_channel.h
@@ -63,7 +63,8 @@ void guest_channel_host_disconnect(unsigned int lcore_id);
  *  - Negative on channel not connected.
  *  - errno on write to channel error.
  */
-int guest_channel_send_msg(struct channel_packet *pkt, unsigned int lcore_id);
+int guest_channel_send_msg(struct rte_power_channel_packet *pkt,
+		unsigned int lcore_id);
 
 
 
@@ -72,8 +73,8 @@ int guest_channel_send_msg(struct channel_packet *pkt, unsigned int lcore_id);
  * from the host endpoint.
  *
  * @param pkt
- *  Pointer to channel_packet or
- *  channel_packet_freq_list struct.
+ *  Pointer to rte_power_channel_packet or
+ *  rte_power_channel_packet_freq_list struct.
  *
  * @param pkt_len
  *  Size of expected data packet.
diff --git a/lib/librte_power/power_kvm_vm.c b/lib/librte_power/power_kvm_vm.c
index 649ebe85c..9ae438489 100644
--- a/lib/librte_power/power_kvm_vm.c
+++ b/lib/librte_power/power_kvm_vm.c
@@ -13,7 +13,7 @@
 
 #define FD_PATH "/dev/virtio-ports/virtio.serial.port.poweragent"
 
-static struct channel_packet pkt[RTE_MAX_LCORE];
+static struct rte_power_channel_packet pkt[RTE_MAX_LCORE];
 
 int
 power_kvm_vm_check_supported(void)
diff --git a/lib/librte_power/rte_power_guest_channel.h b/lib/librte_power/rte_power_guest_channel.h
index 26469b6c8..f8b206741 100644
--- a/lib/librte_power/rte_power_guest_channel.h
+++ b/lib/librte_power/rte_power_guest_channel.h
@@ -11,7 +11,10 @@ extern "C" {
 #include <stdint.h>
 #include <stdbool.h>
 
-/* --- Incoming messages --- */
+#define MAX_VFS 10
+#define VM_MAX_NAME_SZ 32
+#define MAX_VCPU_PER_VM         8
+#define HOURS 24
 
 /* Valid Commands */
 #define CPU_POWER               1
@@ -19,6 +22,9 @@ extern "C" {
 #define PKT_POLICY              3
 #define PKT_POLICY_REMOVE       4
 
+#define CORE_TYPE_VIRTUAL 0
+#define CORE_TYPE_PHYSICAL 1
+
 /* CPU Power Command Scaling */
 #define CPU_POWER_SCALE_UP      1
 #define CPU_POWER_SCALE_DOWN    2
@@ -43,41 +49,32 @@ extern "C" {
 #define CPU_POWER_FREQ_LIST     3
 #define CPU_POWER_CAPS_LIST     4
 
-#define HOURS 24
-
-#define MAX_VFS 10
-#define VM_MAX_NAME_SZ 32
-
-#define MAX_VCPU_PER_VM         8
-
-struct t_boost_status {
-	bool tbEnabled;
-};
-
-struct timer_profile {
+struct rte_power_timer_profile {
 	int busy_hours[HOURS];
 	int quiet_hours[HOURS];
 	int hours_to_use_traffic_profile[HOURS];
 };
 
-enum workload {HIGH, MEDIUM, LOW};
-enum policy_to_use {
+enum rte_power_workload_level {HIGH, MEDIUM, LOW};
+
+enum rte_power_policy {
 	TRAFFIC,
 	TIME,
 	WORKLOAD,
 	BRANCH_RATIO
 };
 
-struct traffic {
+struct rte_power_traffic_policy {
 	uint32_t min_packet_thresh;
 	uint32_t avg_max_packet_thresh;
 	uint32_t max_max_packet_thresh;
 };
 
-#define CORE_TYPE_VIRTUAL 0
-#define CORE_TYPE_PHYSICAL 1
+struct rte_power_turbo_status {
+	bool tbEnabled;
+};
 
-struct channel_packet {
+struct rte_power_channel_packet {
 	uint64_t resource_id; /**< core_num, device */
 	uint32_t unit;        /**< scale down/up/min/max */
 	uint32_t command;     /**< Power, IO, etc */
@@ -85,17 +82,17 @@ struct channel_packet {
 
 	uint64_t vfid[MAX_VFS];
 	int nb_mac_to_monitor;
-	struct traffic traffic_policy;
+	struct rte_power_traffic_policy traffic_policy;
 	uint8_t vcpu_to_control[MAX_VCPU_PER_VM];
 	uint8_t num_vcpu;
-	struct timer_profile timer_policy;
+	struct rte_power_timer_profile timer_policy;
 	bool core_type;
-	enum workload workload;
-	enum policy_to_use policy_to_use;
-	struct t_boost_status t_boost_status;
+	enum rte_power_workload_level workload;
+	enum rte_power_policy policy_to_use;
+	struct rte_power_turbo_status t_boost_status;
 };
 
-struct channel_packet_freq_list {
+struct rte_power_channel_packet_freq_list {
 	uint64_t resource_id; /**< core_num, device */
 	uint32_t unit;        /**< scale down/up/min/max */
 	uint32_t command;     /**< Power, IO, etc */
@@ -105,7 +102,7 @@ struct channel_packet_freq_list {
 	uint8_t num_vcpu;
 };
 
-struct channel_packet_caps_list {
+struct rte_power_channel_packet_caps_list {
 	uint64_t resource_id; /**< core_num, device */
 	uint32_t unit;        /**< scale down/up/min/max */
 	uint32_t command;     /**< Power, IO, etc */
@@ -130,7 +127,7 @@ struct channel_packet_caps_list {
  *  - Negative on error.
  */
 __rte_experimental
-int rte_power_guest_channel_send_msg(struct channel_packet *pkt,
+int rte_power_guest_channel_send_msg(struct rte_power_channel_packet *pkt,
 			unsigned int lcore_id);
 
 /**
-- 
2.17.1


^ permalink raw reply	[flat|nested] 69+ messages in thread

* [dpdk-dev] [PATCH v3 4/6] power: rename defines
  2021-01-20 13:55     ` [dpdk-dev] [PATCH v3 0/6] power: fix make build for power apps David Hunt
                         ` (2 preceding siblings ...)
  2021-01-20 13:55       ` [dpdk-dev] [PATCH v3 3/6] power: rename public structs David Hunt
@ 2021-01-20 13:55       ` David Hunt
  2021-01-20 13:55       ` [dpdk-dev] [PATCH v3 5/6] power: add new header file to export list David Hunt
  2021-01-20 13:55       ` [dpdk-dev] [PATCH v3 6/6] power: clean up includes David Hunt
  5 siblings, 0 replies; 69+ messages in thread
From: David Hunt @ 2021-01-20 13:55 UTC (permalink / raw)
  To: dev; +Cc: david.hunt, stable, Bruce Richardson

From: Bruce Richardson <bruce.richardson@intel.com>

Rename the #defines to have an RTE_POWER_ prefix

Fixes: 210c383e247b ("power: packet format for vm power management")
Fixes: cd0d5547e873 ("power: vm communication channels in guest")
Cc: stable@dpdk.org

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: David Hunt <david.hunt@intel.com>
---
 examples/vm_power_manager/channel_monitor.c   | 116 +++++++++---------
 examples/vm_power_manager/channel_monitor.h   |   6 +-
 examples/vm_power_manager/guest_cli/main.c    |  29 +++--
 .../guest_cli/vm_power_cli_guest.c            |  28 ++---
 examples/vm_power_manager/main.c              |   2 +-
 lib/librte_power/guest_channel.c              |   2 +-
 lib/librte_power/power_kvm_vm.c               |  14 +--
 lib/librte_power/rte_power_guest_channel.h    |  98 +++++++--------
 8 files changed, 155 insertions(+), 140 deletions(-)

diff --git a/examples/vm_power_manager/channel_monitor.c b/examples/vm_power_manager/channel_monitor.c
index 5d5383494..06af3796f 100644
--- a/examples/vm_power_manager/channel_monitor.c
+++ b/examples/vm_power_manager/channel_monitor.c
@@ -177,10 +177,10 @@ parse_json_to_pkt(json_t *element, struct rte_power_channel_packet *pkt,
 
 	pkt->nb_mac_to_monitor = 0;
 	pkt->t_boost_status.tbEnabled = false;
-	pkt->workload = LOW;
-	pkt->policy_to_use = TIME;
-	pkt->command = PKT_POLICY;
-	pkt->core_type = CORE_TYPE_PHYSICAL;
+	pkt->workload = RTE_POWER_WL_LOW;
+	pkt->policy_to_use = RTE_POWER_POLICY_TIME;
+	pkt->command = RTE_POWER_PKT_POLICY;
+	pkt->core_type = RTE_POWER_CORE_TYPE_PHYSICAL;
 
 	if (vm_name == NULL) {
 		RTE_LOG(ERR, CHANNEL_MONITOR,
@@ -203,11 +203,11 @@ parse_json_to_pkt(json_t *element, struct rte_power_channel_packet *pkt,
 			char command[32];
 			strlcpy(command, json_string_value(value), 32);
 			if (!strcmp(command, "power")) {
-				pkt->command = CPU_POWER;
+				pkt->command = RTE_POWER_CPU_POWER;
 			} else if (!strcmp(command, "create")) {
-				pkt->command = PKT_POLICY;
+				pkt->command = RTE_POWER_PKT_POLICY;
 			} else if (!strcmp(command, "destroy")) {
-				pkt->command = PKT_POLICY_REMOVE;
+				pkt->command = RTE_POWER_PKT_POLICY_REMOVE;
 			} else {
 				RTE_LOG(ERR, CHANNEL_MONITOR,
 					"Invalid command received in JSON\n");
@@ -217,13 +217,17 @@ parse_json_to_pkt(json_t *element, struct rte_power_channel_packet *pkt,
 			char command[32];
 			strlcpy(command, json_string_value(value), 32);
 			if (!strcmp(command, "TIME")) {
-				pkt->policy_to_use = TIME;
+				pkt->policy_to_use =
+						RTE_POWER_POLICY_TIME;
 			} else if (!strcmp(command, "TRAFFIC")) {
-				pkt->policy_to_use = TRAFFIC;
+				pkt->policy_to_use =
+						RTE_POWER_POLICY_TRAFFIC;
 			} else if (!strcmp(command, "WORKLOAD")) {
-				pkt->policy_to_use = WORKLOAD;
+				pkt->policy_to_use =
+						RTE_POWER_POLICY_WORKLOAD;
 			} else if (!strcmp(command, "BRANCH_RATIO")) {
-				pkt->policy_to_use = BRANCH_RATIO;
+				pkt->policy_to_use =
+						RTE_POWER_POLICY_BRANCH_RATIO;
 			} else {
 				RTE_LOG(ERR, CHANNEL_MONITOR,
 					"Wrong policy_type received in JSON\n");
@@ -233,11 +237,11 @@ parse_json_to_pkt(json_t *element, struct rte_power_channel_packet *pkt,
 			char command[32];
 			strlcpy(command, json_string_value(value), 32);
 			if (!strcmp(command, "HIGH")) {
-				pkt->workload = HIGH;
+				pkt->workload = RTE_POWER_WL_HIGH;
 			} else if (!strcmp(command, "MEDIUM")) {
-				pkt->workload = MEDIUM;
+				pkt->workload = RTE_POWER_WL_MEDIUM;
 			} else if (!strcmp(command, "LOW")) {
-				pkt->workload = LOW;
+				pkt->workload = RTE_POWER_WL_LOW;
 			} else {
 				RTE_LOG(ERR, CHANNEL_MONITOR,
 					"Wrong workload received in JSON\n");
@@ -283,17 +287,17 @@ parse_json_to_pkt(json_t *element, struct rte_power_channel_packet *pkt,
 			char unit[32];
 			strlcpy(unit, json_string_value(value), 32);
 			if (!strcmp(unit, "SCALE_UP")) {
-				pkt->unit = CPU_POWER_SCALE_UP;
+				pkt->unit = RTE_POWER_SCALE_UP;
 			} else if (!strcmp(unit, "SCALE_DOWN")) {
-				pkt->unit = CPU_POWER_SCALE_DOWN;
+				pkt->unit = RTE_POWER_SCALE_DOWN;
 			} else if (!strcmp(unit, "SCALE_MAX")) {
-				pkt->unit = CPU_POWER_SCALE_MAX;
+				pkt->unit = RTE_POWER_SCALE_MAX;
 			} else if (!strcmp(unit, "SCALE_MIN")) {
-				pkt->unit = CPU_POWER_SCALE_MIN;
+				pkt->unit = RTE_POWER_SCALE_MIN;
 			} else if (!strcmp(unit, "ENABLE_TURBO")) {
-				pkt->unit = CPU_POWER_ENABLE_TURBO;
+				pkt->unit = RTE_POWER_ENABLE_TURBO;
 			} else if (!strcmp(unit, "DISABLE_TURBO")) {
-				pkt->unit = CPU_POWER_DISABLE_TURBO;
+				pkt->unit = RTE_POWER_DISABLE_TURBO;
 			} else {
 				RTE_LOG(ERR, CHANNEL_MONITOR,
 					"Invalid command received in JSON\n");
@@ -312,7 +316,7 @@ parse_json_to_pkt(json_t *element, struct rte_power_channel_packet *pkt,
 				vm_name);
 			return -1;
 		}
-		strlcpy(pkt->vm_name, vm_name, VM_MAX_NAME_SZ);
+		strlcpy(pkt->vm_name, vm_name, RTE_POWER_VM_MAX_NAME_SZ);
 		pkt->resource_id = resource_id;
 	}
 	return 0;
@@ -367,7 +371,7 @@ pcpu_monitor(struct policy *pol, struct core_info *ci, int pcpu, int count)
 {
 	int ret = 0;
 
-	if (pol->pkt.policy_to_use == BRANCH_RATIO) {
+	if (pol->pkt.policy_to_use == RTE_POWER_POLICY_BRANCH_RATIO) {
 		ci->cd[pcpu].oob_enabled = 1;
 		ret = add_core_to_monitor(pcpu);
 		if (ret == 0)
@@ -407,7 +411,7 @@ get_pcpu_to_control(struct policy *pol)
 	 * differenciate between them when adding them to the branch monitor.
 	 * Virtual cores need to be converted to physical cores.
 	 */
-	if (pol->pkt.core_type == CORE_TYPE_VIRTUAL) {
+	if (pol->pkt.core_type == RTE_POWER_CORE_TYPE_VIRTUAL) {
 		/*
 		 * If the cores in the policy are virtual, we need to map them
 		 * to physical core. We look up the vm info and use that for
@@ -479,7 +483,8 @@ update_policy(struct rte_power_channel_packet *pkt)
 			policies[i].pkt = *pkt;
 			get_pcpu_to_control(&policies[i]);
 			/* Check Eth dev only for Traffic policy */
-			if (policies[i].pkt.policy_to_use == TRAFFIC) {
+			if (policies[i].pkt.policy_to_use ==
+					RTE_POWER_POLICY_TRAFFIC) {
 				if (get_pfid(&policies[i]) < 0) {
 					updated = 1;
 					break;
@@ -496,7 +501,8 @@ update_policy(struct rte_power_channel_packet *pkt)
 				policies[i].pkt = *pkt;
 				get_pcpu_to_control(&policies[i]);
 				/* Check Eth dev only for Traffic policy */
-				if (policies[i].pkt.policy_to_use == TRAFFIC) {
+				if (policies[i].pkt.policy_to_use ==
+						RTE_POWER_POLICY_TRAFFIC) {
 					if (get_pfid(&policies[i]) < 0) {
 						updated = 1;
 						break;
@@ -615,7 +621,7 @@ apply_time_profile(struct policy *pol)
 	/* Format the date and time, down to a single second. */
 	strftime(time_string, sizeof(time_string), "%Y-%m-%d %H:%M:%S", ptm);
 
-	for (x = 0; x < HOURS; x++) {
+	for (x = 0; x < RTE_POWER_HOURS_PER_DAY; x++) {
 
 		if (ptm->tm_hour == pol->pkt.timer_policy.busy_hours[x]) {
 			for (count = 0; count < pol->pkt.num_vcpu; count++) {
@@ -648,19 +654,19 @@ apply_workload_profile(struct policy *pol)
 
 	int count;
 
-	if (pol->pkt.workload == HIGH) {
+	if (pol->pkt.workload == RTE_POWER_WL_HIGH) {
 		for (count = 0; count < pol->pkt.num_vcpu; count++) {
 			if (pol->core_share[count].status != 1)
 				power_manager_scale_core_max(
 						pol->core_share[count].pcpu);
 		}
-	} else if (pol->pkt.workload == MEDIUM) {
+	} else if (pol->pkt.workload == RTE_POWER_WL_MEDIUM) {
 		for (count = 0; count < pol->pkt.num_vcpu; count++) {
 			if (pol->core_share[count].status != 1)
 				power_manager_scale_core_med(
 						pol->core_share[count].pcpu);
 		}
-	} else if (pol->pkt.workload == LOW) {
+	} else if (pol->pkt.workload == RTE_POWER_WL_LOW) {
 		for (count = 0; count < pol->pkt.num_vcpu; count++) {
 			if (pol->core_share[count].status != 1)
 				power_manager_scale_core_min(
@@ -676,11 +682,11 @@ apply_policy(struct policy *pol)
 	struct rte_power_channel_packet *pkt = &pol->pkt;
 
 	/*Check policy to use*/
-	if (pkt->policy_to_use == TRAFFIC)
+	if (pkt->policy_to_use == RTE_POWER_POLICY_TRAFFIC)
 		apply_traffic_profile(pol);
-	else if (pkt->policy_to_use == TIME)
+	else if (pkt->policy_to_use == RTE_POWER_POLICY_TIME)
 		apply_time_profile(pol);
-	else if (pkt->policy_to_use == WORKLOAD)
+	else if (pkt->policy_to_use == RTE_POWER_POLICY_WORKLOAD)
 		apply_workload_profile(pol);
 }
 
@@ -726,13 +732,13 @@ send_freq(struct rte_power_channel_packet *pkt,
 	if (get_info_vm(pkt->vm_name, &info) != 0)
 		return -1;
 
-	if (!freq_list && vcore_id >= MAX_VCPU_PER_VM)
+	if (!freq_list && vcore_id >= RTE_POWER_MAX_VCPU_PER_VM)
 		return -1;
 
 	if (!info.allow_query)
 		return -1;
 
-	channel_pkt_freq_list.command = CPU_POWER_FREQ_LIST;
+	channel_pkt_freq_list.command = RTE_POWER_FREQ_LIST;
 	channel_pkt_freq_list.num_vcpu = info.num_vcpus;
 
 	if (freq_list) {
@@ -764,13 +770,13 @@ send_capabilities(struct rte_power_channel_packet *pkt,
 	if (get_info_vm(pkt->vm_name, &info) != 0)
 		return -1;
 
-	if (!list_requested && vcore_id >= MAX_VCPU_PER_VM)
+	if (!list_requested && vcore_id >= RTE_POWER_MAX_VCPU_PER_VM)
 		return -1;
 
 	if (!info.allow_query)
 		return -1;
 
-	channel_pkt_caps_list.command = CPU_POWER_CAPS_LIST;
+	channel_pkt_caps_list.command = RTE_POWER_CAPS_LIST;
 	channel_pkt_caps_list.num_vcpu = info.num_vcpus;
 
 	if (list_requested) {
@@ -828,10 +834,10 @@ process_request(struct rte_power_channel_packet *pkt,
 			CHANNEL_MGR_CHANNEL_PROCESSING) == 0)
 		return -1;
 
-	if (pkt->command == CPU_POWER) {
+	if (pkt->command == RTE_POWER_CPU_POWER) {
 		unsigned int core_num;
 
-		if (pkt->core_type == CORE_TYPE_VIRTUAL)
+		if (pkt->core_type == RTE_POWER_CORE_TYPE_VIRTUAL)
 			core_num = get_pcpu(chan_info, pkt->resource_id);
 		else
 			core_num = pkt->resource_id;
@@ -843,22 +849,22 @@ process_request(struct rte_power_channel_packet *pkt,
 		bool valid_unit = true;
 
 		switch (pkt->unit) {
-		case(CPU_POWER_SCALE_MIN):
+		case(RTE_POWER_SCALE_MIN):
 			scale_res = power_manager_scale_core_min(core_num);
 			break;
-		case(CPU_POWER_SCALE_MAX):
+		case(RTE_POWER_SCALE_MAX):
 			scale_res = power_manager_scale_core_max(core_num);
 			break;
-		case(CPU_POWER_SCALE_DOWN):
+		case(RTE_POWER_SCALE_DOWN):
 			scale_res = power_manager_scale_core_down(core_num);
 			break;
-		case(CPU_POWER_SCALE_UP):
+		case(RTE_POWER_SCALE_UP):
 			scale_res = power_manager_scale_core_up(core_num);
 			break;
-		case(CPU_POWER_ENABLE_TURBO):
+		case(RTE_POWER_ENABLE_TURBO):
 			scale_res = power_manager_enable_turbo_core(core_num);
 			break;
-		case(CPU_POWER_DISABLE_TURBO):
+		case(RTE_POWER_DISABLE_TURBO):
 			scale_res = power_manager_disable_turbo_core(core_num);
 			break;
 		default:
@@ -870,8 +876,8 @@ process_request(struct rte_power_channel_packet *pkt,
 			ret = send_ack_for_received_cmd(pkt,
 					chan_info,
 					scale_res >= 0 ?
-						CPU_POWER_CMD_ACK :
-						CPU_POWER_CMD_NACK);
+						RTE_POWER_CMD_ACK :
+						RTE_POWER_CMD_NACK);
 			if (ret < 0)
 				RTE_LOG(ERR, CHANNEL_MONITOR, "Error during sending ack command.\n");
 		} else
@@ -879,19 +885,19 @@ process_request(struct rte_power_channel_packet *pkt,
 
 	}
 
-	if (pkt->command == PKT_POLICY) {
+	if (pkt->command == RTE_POWER_PKT_POLICY) {
 		RTE_LOG(INFO, CHANNEL_MONITOR, "Processing policy request %s\n",
 				pkt->vm_name);
 		int ret = send_ack_for_received_cmd(pkt,
 				chan_info,
-				CPU_POWER_CMD_ACK);
+				RTE_POWER_CMD_ACK);
 		if (ret < 0)
 			RTE_LOG(ERR, CHANNEL_MONITOR, "Error during sending ack command.\n");
 		update_policy(pkt);
 		policy_is_set = 1;
 	}
 
-	if (pkt->command == PKT_POLICY_REMOVE) {
+	if (pkt->command == RTE_POWER_PKT_POLICY_REMOVE) {
 		ret = remove_policy(pkt);
 		if (ret == 0)
 			RTE_LOG(INFO, CHANNEL_MONITOR,
@@ -901,26 +907,26 @@ process_request(struct rte_power_channel_packet *pkt,
 				 "Policy %s does not exist\n", pkt->vm_name);
 	}
 
-	if (pkt->command == CPU_POWER_QUERY_FREQ_LIST ||
-		pkt->command == CPU_POWER_QUERY_FREQ) {
+	if (pkt->command == RTE_POWER_QUERY_FREQ_LIST ||
+		pkt->command == RTE_POWER_QUERY_FREQ) {
 
 		RTE_LOG(INFO, CHANNEL_MONITOR,
 			"Frequency for %s requested.\n", pkt->vm_name);
 		int ret = send_freq(pkt,
 				chan_info,
-				pkt->command == CPU_POWER_QUERY_FREQ_LIST);
+				pkt->command == RTE_POWER_QUERY_FREQ_LIST);
 		if (ret < 0)
 			RTE_LOG(ERR, CHANNEL_MONITOR, "Error during frequency sending.\n");
 	}
 
-	if (pkt->command == CPU_POWER_QUERY_CAPS_LIST ||
-		pkt->command == CPU_POWER_QUERY_CAPS) {
+	if (pkt->command == RTE_POWER_QUERY_CAPS_LIST ||
+		pkt->command == RTE_POWER_QUERY_CAPS) {
 
 		RTE_LOG(INFO, CHANNEL_MONITOR,
 			"Capabilities for %s requested.\n", pkt->vm_name);
 		int ret = send_capabilities(pkt,
 				chan_info,
-				pkt->command == CPU_POWER_QUERY_CAPS_LIST);
+				pkt->command == RTE_POWER_QUERY_CAPS_LIST);
 		if (ret < 0)
 			RTE_LOG(ERR, CHANNEL_MONITOR, "Error during sending capabilities.\n");
 	}
diff --git a/examples/vm_power_manager/channel_monitor.h b/examples/vm_power_manager/channel_monitor.h
index 0ca6207ad..5d3537b91 100644
--- a/examples/vm_power_manager/channel_monitor.h
+++ b/examples/vm_power_manager/channel_monitor.h
@@ -19,10 +19,10 @@ struct core_share {
 
 struct policy {
 	struct rte_power_channel_packet pkt;
-	uint32_t pfid[MAX_VFS];
-	uint32_t port[MAX_VFS];
+	uint32_t pfid[RTE_POWER_MAX_VFS];
+	uint32_t port[RTE_POWER_MAX_VFS];
 	unsigned int enabled;
-	struct core_share core_share[MAX_VCPU_PER_VM];
+	struct core_share core_share[RTE_POWER_MAX_VCPU_PER_VM];
 };
 
 #ifdef __cplusplus
diff --git a/examples/vm_power_manager/guest_cli/main.c b/examples/vm_power_manager/guest_cli/main.c
index fc7a8c30a..4e17f7fb9 100644
--- a/examples/vm_power_manager/guest_cli/main.c
+++ b/examples/vm_power_manager/guest_cli/main.c
@@ -50,8 +50,8 @@ parse_args(int argc, char **argv)
 	};
 	struct rte_power_channel_packet *policy;
 	unsigned short int hours[MAX_HOURS];
-	unsigned short int cores[MAX_VCPU_PER_VM];
-	unsigned short int ports[MAX_VCPU_PER_VM];
+	unsigned short int cores[RTE_POWER_MAX_VCPU_PER_VM];
+	unsigned short int ports[RTE_POWER_MAX_VCPU_PER_VM];
 	int i, cnt, idx;
 
 	policy = get_policy();
@@ -69,7 +69,8 @@ parse_args(int argc, char **argv)
 		switch (opt) {
 		/* portmask */
 		case 'n':
-			strlcpy(policy->vm_name, optarg, VM_MAX_NAME_SZ);
+			strlcpy(policy->vm_name, optarg,
+					RTE_POWER_VM_MAX_NAME_SZ);
 			printf("Setting VM Name to [%s]\n", policy->vm_name);
 			break;
 		case 'b':
@@ -97,14 +98,15 @@ parse_args(int argc, char **argv)
 			}
 			break;
 		case 'l':
-			cnt = parse_set(optarg, cores, MAX_VCPU_PER_VM);
+			cnt = parse_set(optarg, cores,
+					RTE_POWER_MAX_VCPU_PER_VM);
 			if (cnt < 0) {
 				printf("Invalid value passed to vcpu-list - [%s]\n",
 						optarg);
 				break;
 			}
 			idx = 0;
-			for (i = 0; i < MAX_VCPU_PER_VM; i++) {
+			for (i = 0; i < RTE_POWER_MAX_VCPU_PER_VM; i++) {
 				if (cores[i]) {
 					printf("***Using core %d\n", i);
 					policy->vcpu_to_control[idx++] = i;
@@ -114,14 +116,15 @@ parse_args(int argc, char **argv)
 			printf("Total cores: %d\n", idx);
 			break;
 		case 'p':
-			cnt = parse_set(optarg, ports, MAX_VCPU_PER_VM);
+			cnt = parse_set(optarg, ports,
+					RTE_POWER_MAX_VCPU_PER_VM);
 			if (cnt < 0) {
 				printf("Invalid value passed to port-list - [%s]\n",
 						optarg);
 				break;
 			}
 			idx = 0;
-			for (i = 0; i < MAX_VCPU_PER_VM; i++) {
+			for (i = 0; i < RTE_POWER_MAX_VCPU_PER_VM; i++) {
 				if (ports[i]) {
 					printf("***Using port %d\n", i);
 					if (set_policy_mac(i, idx++) != 0) {
@@ -135,13 +138,17 @@ parse_args(int argc, char **argv)
 			break;
 		case 'o':
 			if (!strcmp(optarg, "TRAFFIC"))
-				policy->policy_to_use = TRAFFIC;
+				policy->policy_to_use =
+						RTE_POWER_POLICY_TRAFFIC;
 			else if (!strcmp(optarg, "TIME"))
-				policy->policy_to_use = TIME;
+				policy->policy_to_use =
+						RTE_POWER_POLICY_TIME;
 			else if (!strcmp(optarg, "WORKLOAD"))
-				policy->policy_to_use = WORKLOAD;
+				policy->policy_to_use =
+						RTE_POWER_POLICY_WORKLOAD;
 			else if (!strcmp(optarg, "BRANCH_RATIO"))
-				policy->policy_to_use = BRANCH_RATIO;
+				policy->policy_to_use =
+						RTE_POWER_POLICY_BRANCH_RATIO;
 			else {
 				printf("Invalid policy specified: %s\n",
 						optarg);
diff --git a/examples/vm_power_manager/guest_cli/vm_power_cli_guest.c b/examples/vm_power_manager/guest_cli/vm_power_cli_guest.c
index b7c8f850e..3fde38dd3 100644
--- a/examples/vm_power_manager/guest_cli/vm_power_cli_guest.c
+++ b/examples/vm_power_manager/guest_cli/vm_power_cli_guest.c
@@ -103,10 +103,10 @@ set_policy_defaults(struct rte_power_channel_packet *pkt)
 	pkt->timer_policy.hours_to_use_traffic_profile[0] = 8;
 	pkt->timer_policy.hours_to_use_traffic_profile[1] = 10;
 
-	pkt->core_type = CORE_TYPE_VIRTUAL;
-	pkt->workload = LOW;
-	pkt->policy_to_use = TIME;
-	pkt->command = PKT_POLICY;
+	pkt->core_type = RTE_POWER_CORE_TYPE_VIRTUAL;
+	pkt->workload = RTE_POWER_WL_LOW;
+	pkt->policy_to_use = RTE_POWER_POLICY_TIME;
+	pkt->command = RTE_POWER_PKT_POLICY;
 	strlcpy(pkt->vm_name, "ubuntu2", sizeof(pkt->vm_name));
 
 	return 0;
@@ -169,7 +169,7 @@ receive_freq_list(struct rte_power_channel_packet_freq_list *pkt_freq_list,
 		RTE_LOG(ERR, GUEST_CLI, "Error receiving message.\n");
 		return -1;
 	}
-	if (pkt_freq_list->command != CPU_POWER_FREQ_LIST) {
+	if (pkt_freq_list->command != RTE_POWER_FREQ_LIST) {
 		RTE_LOG(ERR, GUEST_CLI, "Unexpected message received.\n");
 		return -1;
 	}
@@ -204,18 +204,18 @@ cmd_query_freq_list_parsed(void *parsed_result,
 			return;
 		}
 
-		pkt.command = CPU_POWER_QUERY_FREQ_LIST;
+		pkt.command = RTE_POWER_QUERY_FREQ_LIST;
 		strlcpy(pkt.vm_name, policy.vm_name, sizeof(pkt.vm_name));
 		query_list = true;
 	} else {
 		errno = 0;
 		lcore_id = (unsigned int)strtol(res->cpu_num, &ep, 10);
-		if (errno != 0 || lcore_id >= MAX_VCPU_PER_VM ||
+		if (errno != 0 || lcore_id >= RTE_POWER_MAX_VCPU_PER_VM ||
 			ep == res->cpu_num) {
 			cmdline_printf(cl, "Invalid parameter provided.\n");
 			return;
 		}
-		pkt.command = CPU_POWER_QUERY_FREQ;
+		pkt.command = RTE_POWER_QUERY_FREQ;
 		strlcpy(pkt.vm_name, policy.vm_name, sizeof(pkt.vm_name));
 		pkt.resource_id = lcore_id;
 	}
@@ -280,7 +280,7 @@ receive_capabilities(struct rte_power_channel_packet_caps_list *pkt_caps_list,
 		RTE_LOG(ERR, GUEST_CLI, "Error receiving message.\n");
 		return -1;
 	}
-	if (pkt_caps_list->command != CPU_POWER_CAPS_LIST) {
+	if (pkt_caps_list->command != RTE_POWER_CAPS_LIST) {
 		RTE_LOG(ERR, GUEST_CLI, "Unexpected message received.\n");
 		return -1;
 	}
@@ -315,18 +315,18 @@ cmd_query_caps_list_parsed(void *parsed_result,
 			return;
 		}
 
-		pkt.command = CPU_POWER_QUERY_CAPS_LIST;
+		pkt.command = RTE_POWER_QUERY_CAPS_LIST;
 		strlcpy(pkt.vm_name, policy.vm_name, sizeof(pkt.vm_name));
 		query_list = true;
 	} else {
 		errno = 0;
 		lcore_id = (unsigned int)strtol(res->cpu_num, &ep, 10);
-		if (errno != 0 || lcore_id >= MAX_VCPU_PER_VM ||
+		if (errno != 0 || lcore_id >= RTE_POWER_MAX_VCPU_PER_VM ||
 			ep == res->cpu_num) {
 			cmdline_printf(cl, "Invalid parameter provided.\n");
 			return;
 		}
-		pkt.command = CPU_POWER_QUERY_CAPS;
+		pkt.command = RTE_POWER_QUERY_CAPS;
 		strlcpy(pkt.vm_name, policy.vm_name, sizeof(pkt.vm_name));
 		pkt.resource_id = lcore_id;
 	}
@@ -390,10 +390,10 @@ check_response_cmd(unsigned int lcore_id, int *result)
 		return -1;
 
 	switch (pkt.command) {
-	case(CPU_POWER_CMD_ACK):
+	case(RTE_POWER_CMD_ACK):
 		*result = 1;
 		break;
-	case(CPU_POWER_CMD_NACK):
+	case(RTE_POWER_CMD_NACK):
 		*result = 0;
 		break;
 	default:
diff --git a/examples/vm_power_manager/main.c b/examples/vm_power_manager/main.c
index 75d5b5364..799d7b9bc 100644
--- a/examples/vm_power_manager/main.c
+++ b/examples/vm_power_manager/main.c
@@ -394,7 +394,7 @@ main(int argc, char **argv)
 					"Cannot init port %"PRIu8 "\n",
 					portid);
 
-			for (w = 0; w < MAX_VFS; w++) {
+			for (w = 0; w < RTE_POWER_MAX_VFS; w++) {
 				eth.addr_bytes[5] = w + 0xf0;
 
 				ret = -ENOTSUP;
diff --git a/lib/librte_power/guest_channel.c b/lib/librte_power/guest_channel.c
index 9eb2f6330..039cb1872 100644
--- a/lib/librte_power/guest_channel.c
+++ b/lib/librte_power/guest_channel.c
@@ -100,7 +100,7 @@ guest_channel_host_connect(const char *path, unsigned int lcore_id)
 	/* Send a test packet, this command is ignored by the host, but a successful
 	 * send indicates that the host endpoint is monitoring.
 	 */
-	pkt.command = CPU_POWER_CONNECT;
+	pkt.command = RTE_POWER_CPU_POWER_CONNECT;
 	global_fds[lcore_id] = fd;
 	ret = guest_channel_send_msg(&pkt, lcore_id);
 	if (ret != 0) {
diff --git a/lib/librte_power/power_kvm_vm.c b/lib/librte_power/power_kvm_vm.c
index 9ae438489..27f9937aa 100644
--- a/lib/librte_power/power_kvm_vm.c
+++ b/lib/librte_power/power_kvm_vm.c
@@ -29,7 +29,7 @@ power_kvm_vm_init(unsigned int lcore_id)
 				lcore_id, RTE_MAX_LCORE-1);
 		return -1;
 	}
-	pkt[lcore_id].command = CPU_POWER;
+	pkt[lcore_id].command = RTE_POWER_CPU_POWER;
 	pkt[lcore_id].resource_id = lcore_id;
 	return guest_channel_host_connect(FD_PATH, lcore_id);
 }
@@ -90,25 +90,25 @@ send_msg(unsigned int lcore_id, uint32_t scale_direction)
 int
 power_kvm_vm_freq_up(unsigned int lcore_id)
 {
-	return send_msg(lcore_id, CPU_POWER_SCALE_UP);
+	return send_msg(lcore_id, RTE_POWER_SCALE_UP);
 }
 
 int
 power_kvm_vm_freq_down(unsigned int lcore_id)
 {
-	return send_msg(lcore_id, CPU_POWER_SCALE_DOWN);
+	return send_msg(lcore_id, RTE_POWER_SCALE_DOWN);
 }
 
 int
 power_kvm_vm_freq_max(unsigned int lcore_id)
 {
-	return send_msg(lcore_id, CPU_POWER_SCALE_MAX);
+	return send_msg(lcore_id, RTE_POWER_SCALE_MAX);
 }
 
 int
 power_kvm_vm_freq_min(unsigned int lcore_id)
 {
-	return send_msg(lcore_id, CPU_POWER_SCALE_MIN);
+	return send_msg(lcore_id, RTE_POWER_SCALE_MIN);
 }
 
 int
@@ -121,13 +121,13 @@ power_kvm_vm_turbo_status(__rte_unused unsigned int lcore_id)
 int
 power_kvm_vm_enable_turbo(unsigned int lcore_id)
 {
-	return send_msg(lcore_id, CPU_POWER_ENABLE_TURBO);
+	return send_msg(lcore_id, RTE_POWER_ENABLE_TURBO);
 }
 
 int
 power_kvm_vm_disable_turbo(unsigned int lcore_id)
 {
-	return send_msg(lcore_id, CPU_POWER_DISABLE_TURBO);
+	return send_msg(lcore_id, RTE_POWER_DISABLE_TURBO);
 }
 
 struct rte_power_core_capabilities;
diff --git a/lib/librte_power/rte_power_guest_channel.h b/lib/librte_power/rte_power_guest_channel.h
index f8b206741..0e7082c51 100644
--- a/lib/librte_power/rte_power_guest_channel.h
+++ b/lib/librte_power/rte_power_guest_channel.h
@@ -11,63 +11,65 @@ extern "C" {
 #include <stdint.h>
 #include <stdbool.h>
 
-#define MAX_VFS 10
-#define VM_MAX_NAME_SZ 32
-#define MAX_VCPU_PER_VM         8
-#define HOURS 24
+#define RTE_POWER_MAX_VFS 10
+#define RTE_POWER_VM_MAX_NAME_SZ 32
+#define RTE_POWER_MAX_VCPU_PER_VM 8
+#define RTE_POWER_HOURS_PER_DAY 24
 
 /* Valid Commands */
-#define CPU_POWER               1
-#define CPU_POWER_CONNECT       2
-#define PKT_POLICY              3
-#define PKT_POLICY_REMOVE       4
+#define RTE_POWER_CPU_POWER               1
+#define RTE_POWER_CPU_POWER_CONNECT       2
+#define RTE_POWER_PKT_POLICY              3
+#define RTE_POWER_PKT_POLICY_REMOVE       4
 
-#define CORE_TYPE_VIRTUAL 0
-#define CORE_TYPE_PHYSICAL 1
+#define RTE_POWER_CORE_TYPE_VIRTUAL 0
+#define RTE_POWER_CORE_TYPE_PHYSICAL 1
 
 /* CPU Power Command Scaling */
-#define CPU_POWER_SCALE_UP      1
-#define CPU_POWER_SCALE_DOWN    2
-#define CPU_POWER_SCALE_MAX     3
-#define CPU_POWER_SCALE_MIN     4
-#define CPU_POWER_ENABLE_TURBO  5
-#define CPU_POWER_DISABLE_TURBO 6
+#define RTE_POWER_SCALE_UP      1
+#define RTE_POWER_SCALE_DOWN    2
+#define RTE_POWER_SCALE_MAX     3
+#define RTE_POWER_SCALE_MIN     4
+#define RTE_POWER_ENABLE_TURBO  5
+#define RTE_POWER_DISABLE_TURBO 6
 
 /* CPU Power Queries */
-#define CPU_POWER_QUERY_FREQ_LIST  7
-#define CPU_POWER_QUERY_FREQ       8
-#define CPU_POWER_QUERY_CAPS_LIST  9
-#define CPU_POWER_QUERY_CAPS       10
-
-/* --- Outgoing messages --- */
+#define RTE_POWER_QUERY_FREQ_LIST  7
+#define RTE_POWER_QUERY_FREQ       8
+#define RTE_POWER_QUERY_CAPS_LIST  9
+#define RTE_POWER_QUERY_CAPS       10
 
 /* Generic Power Command Response */
-#define CPU_POWER_CMD_ACK       1
-#define CPU_POWER_CMD_NACK      2
+#define RTE_POWER_CMD_ACK       1
+#define RTE_POWER_CMD_NACK      2
 
 /* CPU Power Query Responses */
-#define CPU_POWER_FREQ_LIST     3
-#define CPU_POWER_CAPS_LIST     4
+#define RTE_POWER_FREQ_LIST     3
+#define RTE_POWER_CAPS_LIST     4
 
-struct rte_power_timer_profile {
-	int busy_hours[HOURS];
-	int quiet_hours[HOURS];
-	int hours_to_use_traffic_profile[HOURS];
+struct rte_power_traffic_policy {
+	uint32_t min_packet_thresh;
+	uint32_t avg_max_packet_thresh;
+	uint32_t max_max_packet_thresh;
 };
 
-enum rte_power_workload_level {HIGH, MEDIUM, LOW};
+struct rte_power_timer_profile {
+	int busy_hours[RTE_POWER_HOURS_PER_DAY];
+	int quiet_hours[RTE_POWER_HOURS_PER_DAY];
+	int hours_to_use_traffic_profile[RTE_POWER_HOURS_PER_DAY];
+};
 
-enum rte_power_policy {
-	TRAFFIC,
-	TIME,
-	WORKLOAD,
-	BRANCH_RATIO
+enum rte_power_workload_level {
+	RTE_POWER_WL_HIGH,
+	RTE_POWER_WL_MEDIUM,
+	RTE_POWER_WL_LOW
 };
 
-struct rte_power_traffic_policy {
-	uint32_t min_packet_thresh;
-	uint32_t avg_max_packet_thresh;
-	uint32_t max_max_packet_thresh;
+enum rte_power_policy {
+	RTE_POWER_POLICY_TRAFFIC,
+	RTE_POWER_POLICY_TIME,
+	RTE_POWER_POLICY_WORKLOAD,
+	RTE_POWER_POLICY_BRANCH_RATIO
 };
 
 struct rte_power_turbo_status {
@@ -78,12 +80,12 @@ struct rte_power_channel_packet {
 	uint64_t resource_id; /**< core_num, device */
 	uint32_t unit;        /**< scale down/up/min/max */
 	uint32_t command;     /**< Power, IO, etc */
-	char vm_name[VM_MAX_NAME_SZ];
+	char vm_name[RTE_POWER_VM_MAX_NAME_SZ];
 
-	uint64_t vfid[MAX_VFS];
+	uint64_t vfid[RTE_POWER_MAX_VFS];
 	int nb_mac_to_monitor;
 	struct rte_power_traffic_policy traffic_policy;
-	uint8_t vcpu_to_control[MAX_VCPU_PER_VM];
+	uint8_t vcpu_to_control[RTE_POWER_MAX_VCPU_PER_VM];
 	uint8_t num_vcpu;
 	struct rte_power_timer_profile timer_policy;
 	bool core_type;
@@ -96,9 +98,9 @@ struct rte_power_channel_packet_freq_list {
 	uint64_t resource_id; /**< core_num, device */
 	uint32_t unit;        /**< scale down/up/min/max */
 	uint32_t command;     /**< Power, IO, etc */
-	char vm_name[VM_MAX_NAME_SZ];
+	char vm_name[RTE_POWER_VM_MAX_NAME_SZ];
 
-	uint32_t freq_list[MAX_VCPU_PER_VM];
+	uint32_t freq_list[RTE_POWER_MAX_VCPU_PER_VM];
 	uint8_t num_vcpu;
 };
 
@@ -106,10 +108,10 @@ struct rte_power_channel_packet_caps_list {
 	uint64_t resource_id; /**< core_num, device */
 	uint32_t unit;        /**< scale down/up/min/max */
 	uint32_t command;     /**< Power, IO, etc */
-	char vm_name[VM_MAX_NAME_SZ];
+	char vm_name[RTE_POWER_VM_MAX_NAME_SZ];
 
-	uint64_t turbo[MAX_VCPU_PER_VM];
-	uint64_t priority[MAX_VCPU_PER_VM];
+	uint64_t turbo[RTE_POWER_MAX_VCPU_PER_VM];
+	uint64_t priority[RTE_POWER_MAX_VCPU_PER_VM];
 	uint8_t num_vcpu;
 };
 
-- 
2.17.1


^ permalink raw reply	[flat|nested] 69+ messages in thread

* [dpdk-dev] [PATCH v3 5/6] power: add new header file to export list
  2021-01-20 13:55     ` [dpdk-dev] [PATCH v3 0/6] power: fix make build for power apps David Hunt
                         ` (3 preceding siblings ...)
  2021-01-20 13:55       ` [dpdk-dev] [PATCH v3 4/6] power: rename defines David Hunt
@ 2021-01-20 13:55       ` David Hunt
  2021-01-20 14:28         ` Burakov, Anatoly
  2021-01-20 13:55       ` [dpdk-dev] [PATCH v3 6/6] power: clean up includes David Hunt
  5 siblings, 1 reply; 69+ messages in thread
From: David Hunt @ 2021-01-20 13:55 UTC (permalink / raw)
  To: dev; +Cc: david.hunt, stable, Bruce Richardson

From: Bruce Richardson <bruce.richardson@intel.com>

Adjust meson.build so that 'ninja install' copies the new header
file into the installation directory.

Fixes: 210c383e247b ("power: packet format for vm power management")
Fixes: cd0d5547e873 ("power: vm communication channels in guest")
Cc: stable@dpdk.org

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: David Hunt <david.hunt@intel.com>
---
 lib/librte_power/meson.build | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/librte_power/meson.build b/lib/librte_power/meson.build
index 4b4cf1b90..541569528 100644
--- a/lib/librte_power/meson.build
+++ b/lib/librte_power/meson.build
@@ -10,5 +10,6 @@ sources = files('rte_power.c', 'power_acpi_cpufreq.c',
 		'rte_power_empty_poll.c',
 		'power_pstate_cpufreq.c',
 		'power_common.c')
-headers = files('rte_power.h','rte_power_empty_poll.h')
+headers = files('rte_power.h','rte_power_empty_poll.h',
+	'rte_power_guest_channel.h')
 deps += ['timer']
-- 
2.17.1


^ permalink raw reply	[flat|nested] 69+ messages in thread

* [dpdk-dev] [PATCH v3 6/6] power: clean up includes
  2021-01-20 13:55     ` [dpdk-dev] [PATCH v3 0/6] power: fix make build for power apps David Hunt
                         ` (4 preceding siblings ...)
  2021-01-20 13:55       ` [dpdk-dev] [PATCH v3 5/6] power: add new header file to export list David Hunt
@ 2021-01-20 13:55       ` David Hunt
  5 siblings, 0 replies; 69+ messages in thread
From: David Hunt @ 2021-01-20 13:55 UTC (permalink / raw)
  To: dev; +Cc: david.hunt, stable, Bruce Richardson

From: Bruce Richardson <bruce.richardson@intel.com>

re-organise the including of the new public header file and
remove un-needed includes

Fixes: 210c383e247b ("power: packet format for vm power management")
Fixes: cd0d5547e873 ("power: vm communication channels in guest")
Cc: stable@dpdk.org

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: David Hunt <david.hunt@intel.com>
---
 examples/vm_power_manager/channel_manager.c              | 1 -
 examples/vm_power_manager/channel_monitor.c              | 1 -
 examples/vm_power_manager/channel_monitor.h              | 2 +-
 examples/vm_power_manager/guest_cli/vm_power_cli_guest.c | 1 -
 examples/vm_power_manager/guest_cli/vm_power_cli_guest.h | 2 --
 examples/vm_power_manager/vm_power_cli.c                 | 1 -
 lib/librte_power/guest_channel.c                         | 2 +-
 lib/librte_power/guest_channel.h                         | 2 --
 lib/librte_power/power_kvm_vm.c                          | 2 +-
 lib/librte_power/rte_power.h                             | 1 +
 lib/librte_power/rte_power_guest_channel.h               | 3 ---
 11 files changed, 4 insertions(+), 14 deletions(-)

diff --git a/examples/vm_power_manager/channel_manager.c b/examples/vm_power_manager/channel_manager.c
index c7d5bf5a8..0a28cb643 100644
--- a/examples/vm_power_manager/channel_manager.c
+++ b/examples/vm_power_manager/channel_manager.c
@@ -27,7 +27,6 @@
 #include <libvirt/libvirt.h>
 
 #include "channel_manager.h"
-#include "rte_power_guest_channel.h"
 #include "channel_monitor.h"
 #include "power_manager.h"
 
diff --git a/examples/vm_power_manager/channel_monitor.c b/examples/vm_power_manager/channel_monitor.c
index 06af3796f..306a78d3e 100644
--- a/examples/vm_power_manager/channel_monitor.c
+++ b/examples/vm_power_manager/channel_monitor.c
@@ -35,7 +35,6 @@
 
 #include <libvirt/libvirt.h>
 #include "channel_monitor.h"
-#include "rte_power_guest_channel.h"
 #include "channel_manager.h"
 #include "power_manager.h"
 #include "oob_monitor.h"
diff --git a/examples/vm_power_manager/channel_monitor.h b/examples/vm_power_manager/channel_monitor.h
index 5d3537b91..9184a8327 100644
--- a/examples/vm_power_manager/channel_monitor.h
+++ b/examples/vm_power_manager/channel_monitor.h
@@ -5,8 +5,8 @@
 #ifndef CHANNEL_MONITOR_H_
 #define CHANNEL_MONITOR_H_
 
+#include <rte_power.h>
 #include "channel_manager.h"
-#include "rte_power_guest_channel.h"
 
 struct core_share {
 	unsigned int pcpu;
diff --git a/examples/vm_power_manager/guest_cli/vm_power_cli_guest.c b/examples/vm_power_manager/guest_cli/vm_power_cli_guest.c
index 3fde38dd3..32a2808d3 100644
--- a/examples/vm_power_manager/guest_cli/vm_power_cli_guest.c
+++ b/examples/vm_power_manager/guest_cli/vm_power_cli_guest.c
@@ -19,7 +19,6 @@
 #include <rte_ethdev.h>
 
 #include <rte_power.h>
-#include <guest_channel.h>
 
 #include "vm_power_cli_guest.h"
 
diff --git a/examples/vm_power_manager/guest_cli/vm_power_cli_guest.h b/examples/vm_power_manager/guest_cli/vm_power_cli_guest.h
index 5d285ca9d..b578ec072 100644
--- a/examples/vm_power_manager/guest_cli/vm_power_cli_guest.h
+++ b/examples/vm_power_manager/guest_cli/vm_power_cli_guest.h
@@ -9,8 +9,6 @@
 extern "C" {
 #endif
 
-#include "rte_power_guest_channel.h"
-
 struct rte_power_channel_packet *get_policy(void);
 
 int set_policy_mac(int port, int idx);
diff --git a/examples/vm_power_manager/vm_power_cli.c b/examples/vm_power_manager/vm_power_cli.c
index f7e1b596e..1a55e553b 100644
--- a/examples/vm_power_manager/vm_power_cli.c
+++ b/examples/vm_power_manager/vm_power_cli.c
@@ -21,7 +21,6 @@
 #include "channel_manager.h"
 #include "channel_monitor.h"
 #include "power_manager.h"
-#include "rte_power_guest_channel.h"
 
 struct cmd_quit_result {
 	cmdline_fixed_string_t quit;
diff --git a/lib/librte_power/guest_channel.c b/lib/librte_power/guest_channel.c
index 039cb1872..2f7507a03 100644
--- a/lib/librte_power/guest_channel.c
+++ b/lib/librte_power/guest_channel.c
@@ -15,9 +15,9 @@
 
 
 #include <rte_log.h>
+#include <rte_power.h>
 
 #include "guest_channel.h"
-#include "rte_power_guest_channel.h"
 
 #define RTE_LOGTYPE_GUEST_CHANNEL RTE_LOGTYPE_USER1
 
diff --git a/lib/librte_power/guest_channel.h b/lib/librte_power/guest_channel.h
index 7d3a909d9..24f609df3 100644
--- a/lib/librte_power/guest_channel.h
+++ b/lib/librte_power/guest_channel.h
@@ -8,8 +8,6 @@
 extern "C" {
 #endif
 
-#include <rte_power_guest_channel.h>
-
 /**
  * Check if any Virtio-Serial VM end-points exist in path.
  *
diff --git a/lib/librte_power/power_kvm_vm.c b/lib/librte_power/power_kvm_vm.c
index 27f9937aa..ab7d4b8ce 100644
--- a/lib/librte_power/power_kvm_vm.c
+++ b/lib/librte_power/power_kvm_vm.c
@@ -6,8 +6,8 @@
 
 #include <rte_log.h>
 
-#include "guest_channel.h"
 #include "rte_power_guest_channel.h"
+#include "guest_channel.h"
 #include "power_kvm_vm.h"
 #include "power_common.h"
 
diff --git a/lib/librte_power/rte_power.h b/lib/librte_power/rte_power.h
index bbbde4dfb..c8086bf6b 100644
--- a/lib/librte_power/rte_power.h
+++ b/lib/librte_power/rte_power.h
@@ -14,6 +14,7 @@
 #include <rte_byteorder.h>
 #include <rte_log.h>
 #include <rte_string_fns.h>
+#include <rte_power_guest_channel.h>
 
 #ifdef __cplusplus
 extern "C" {
diff --git a/lib/librte_power/rte_power_guest_channel.h b/lib/librte_power/rte_power_guest_channel.h
index 0e7082c51..f9c3f12e4 100644
--- a/lib/librte_power/rte_power_guest_channel.h
+++ b/lib/librte_power/rte_power_guest_channel.h
@@ -8,9 +8,6 @@
 extern "C" {
 #endif
 
-#include <stdint.h>
-#include <stdbool.h>
-
 #define RTE_POWER_MAX_VFS 10
 #define RTE_POWER_VM_MAX_NAME_SZ 32
 #define RTE_POWER_MAX_VCPU_PER_VM 8
-- 
2.17.1


^ permalink raw reply	[flat|nested] 69+ messages in thread

* Re: [dpdk-dev] [PATCH v3 2/6] power: make channel msg functions public
  2021-01-20 13:55       ` [dpdk-dev] [PATCH v3 2/6] power: make channel msg functions public David Hunt
@ 2021-01-20 14:26         ` Burakov, Anatoly
  2021-01-20 15:08           ` David Hunt
  0 siblings, 1 reply; 69+ messages in thread
From: Burakov, Anatoly @ 2021-01-20 14:26 UTC (permalink / raw)
  To: David Hunt, dev; +Cc: stable, Bruce Richardson

On 20-Jan-21 1:55 PM, David Hunt wrote:
> From: Bruce Richardson <bruce.richardson@intel.com>
> 
> Move the 2 public functions into rte_power_guest_channel.h
> 
> Fixes: 210c383e247b ("power: packet format for vm power management")
> Fixes: cd0d5547e873 ("power: vm communication channels in guest")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> Signed-off-by: David Hunt <david.hunt@intel.com>
> 
> ---

<snip>

>   
> +/**
> + * Send a message contained in pkt over the Virtio-Serial to the host endpoint.
> + *
> + * @param pkt
> + *  Pointer to a populated struct channel_packet
> + *
> + * @param lcore_id
> + *  lcore_id.

Not very informative doxygen comment :)

> + *
> + * @return
> + *  - 0 on success.
> + *  - Negative on error.
> + */
> +__rte_experimental
> +int rte_power_guest_channel_send_msg(struct channel_packet *pkt,
> +			unsigned int lcore_id);
> +
> +/**
> + * Receive a message contained in pkt over the Virtio-Serial
> + * from the host endpoint.
> + *

Nitpick, but we generally add a warning to experimental functions, like so:

  * @warning
  * @b EXPERIMENTAL: this API may change, or be removed, without prior 
notice.

also, presumably this is not meant to be public API and exists solely 
because there's no other way to do it without significant rework, so 
maybe mark as @internal too?

> + * @param pkt
> + *  Pointer to channel_packet or
> + *  channel_packet_freq_list struct.
> + *
> + * @param pkt_len
> + *  Size of expected data packet.
> + *
> + * @param lcore_id
> + *  lcore_id.
> + *
> + * @return
> + *  - 0 on success.
> + *  - Negative on error.
> + */
> +__rte_experimental
> +int rte_power_guest_channel_receive_msg(void *pkt,
> +		size_t pkt_len,
> +		unsigned int lcore_id);
> +
>   
>   #ifdef __cplusplus
>   }
> 


-- 
Thanks,
Anatoly

^ permalink raw reply	[flat|nested] 69+ messages in thread

* Re: [dpdk-dev] [PATCH v3 3/6] power: rename public structs
  2021-01-20 13:55       ` [dpdk-dev] [PATCH v3 3/6] power: rename public structs David Hunt
@ 2021-01-20 14:27         ` Burakov, Anatoly
  2021-01-20 15:03           ` David Hunt
  0 siblings, 1 reply; 69+ messages in thread
From: Burakov, Anatoly @ 2021-01-20 14:27 UTC (permalink / raw)
  To: David Hunt, dev; +Cc: stable, Bruce Richardson

On 20-Jan-21 1:55 PM, David Hunt wrote:
> From: Bruce Richardson <bruce.richardson@intel.com>
> 
> rename the public structs to have an rte_power_ prefix.
> 
> Fixes: 210c383e247b ("power: packet format for vm power management")
> Fixes: cd0d5547e873 ("power: vm communication channels in guest")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> Signed-off-by: David Hunt <david.hunt@intel.com>
> ---

<snip>

>   		RTE_LOG(ERR, GUEST_CLI, "Error receiving message.\n");
> @@ -293,14 +294,15 @@ cmd_query_caps_list_parsed(void *parsed_result,
>   {
>   	struct cmd_query_caps_result *res = parsed_result;
>   	unsigned int lcore_id;
> -	struct channel_packet_caps_list pkt_caps_list;
> -	struct channel_packet pkt;
> +	struct rte_power_channel_packet_caps_list pkt_caps_list;
> +	struct rte_power_channel_packet pkt;
>   	bool query_list = false;
>   	int ret;
>   	char *ep;
>   
> -	memset(&pkt, 0, sizeof(struct channel_packet));
> -	memset(&pkt_caps_list, 0, sizeof(struct channel_packet_caps_list));
> +	memset(&pkt, 0, sizeof(struct rte_power_channel_packet));
> +	memset(&pkt_caps_list, 0,
> +			sizeof(struct rte_power_channel_packet_caps_list));

Here and in other places where you do sizeof(), you might want to avoid 
future changes by replacing it with sizeof(*pkt) instead?

-- 
Thanks,
Anatoly

^ permalink raw reply	[flat|nested] 69+ messages in thread

* Re: [dpdk-dev] [PATCH v3 5/6] power: add new header file to export list
  2021-01-20 13:55       ` [dpdk-dev] [PATCH v3 5/6] power: add new header file to export list David Hunt
@ 2021-01-20 14:28         ` Burakov, Anatoly
  2021-01-20 15:01           ` David Hunt
  2021-01-20 15:08           ` Bruce Richardson
  0 siblings, 2 replies; 69+ messages in thread
From: Burakov, Anatoly @ 2021-01-20 14:28 UTC (permalink / raw)
  To: David Hunt, dev; +Cc: stable, Bruce Richardson

On 20-Jan-21 1:55 PM, David Hunt wrote:
> From: Bruce Richardson <bruce.richardson@intel.com>
> 
> Adjust meson.build so that 'ninja install' copies the new header
> file into the installation directory.
> 
> Fixes: 210c383e247b ("power: packet format for vm power management")
> Fixes: cd0d5547e873 ("power: vm communication channels in guest")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> Signed-off-by: David Hunt <david.hunt@intel.com>
> ---

IMO this should be part of the first patch, otherwise the build could 
(will?) be broken until this patch.

-- 
Thanks,
Anatoly

^ permalink raw reply	[flat|nested] 69+ messages in thread

* Re: [dpdk-dev] [PATCH v3 5/6] power: add new header file to export list
  2021-01-20 14:28         ` Burakov, Anatoly
@ 2021-01-20 15:01           ` David Hunt
  2021-01-20 15:17             ` Burakov, Anatoly
  2021-01-20 15:08           ` Bruce Richardson
  1 sibling, 1 reply; 69+ messages in thread
From: David Hunt @ 2021-01-20 15:01 UTC (permalink / raw)
  To: Burakov, Anatoly, dev; +Cc: stable, Bruce Richardson


On 20/1/2021 2:28 PM, Burakov, Anatoly wrote:
> On 20-Jan-21 1:55 PM, David Hunt wrote:
>> From: Bruce Richardson <bruce.richardson@intel.com>
>>
>> Adjust meson.build so that 'ninja install' copies the new header
>> file into the installation directory.
>>
>> Fixes: 210c383e247b ("power: packet format for vm power management")
>> Fixes: cd0d5547e873 ("power: vm communication channels in guest")
>> Cc: stable@dpdk.org
>>
>> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
>> Signed-off-by: David Hunt <david.hunt@intel.com>
>> ---
>
> IMO this should be part of the first patch, otherwise the build could 
> (will?) be broken until this patch.
>
Hi Anatoly,

    It was broken before this patch set. I wanted to have everything in 
place, including the correct naming of structs/defines before allowing 
builds against the new header file, hence this order in the patch set.

Rgds,

Dave.




^ permalink raw reply	[flat|nested] 69+ messages in thread

* Re: [dpdk-dev] [PATCH v3 3/6] power: rename public structs
  2021-01-20 14:27         ` Burakov, Anatoly
@ 2021-01-20 15:03           ` David Hunt
  0 siblings, 0 replies; 69+ messages in thread
From: David Hunt @ 2021-01-20 15:03 UTC (permalink / raw)
  To: Burakov, Anatoly, dev; +Cc: stable, Bruce Richardson


On 20/1/2021 2:27 PM, Burakov, Anatoly wrote:
> On 20-Jan-21 1:55 PM, David Hunt wrote:
>> From: Bruce Richardson <bruce.richardson@intel.com>
>>
>> rename the public structs to have an rte_power_ prefix.
>>
>> Fixes: 210c383e247b ("power: packet format for vm power management")
>> Fixes: cd0d5547e873 ("power: vm communication channels in guest")
>> Cc: stable@dpdk.org
>>
>> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
>> Signed-off-by: David Hunt <david.hunt@intel.com>
>> ---
>
> <snip>
>
>>           RTE_LOG(ERR, GUEST_CLI, "Error receiving message.\n");
>> @@ -293,14 +294,15 @@ cmd_query_caps_list_parsed(void *parsed_result,
>>   {
>>       struct cmd_query_caps_result *res = parsed_result;
>>       unsigned int lcore_id;
>> -    struct channel_packet_caps_list pkt_caps_list;
>> -    struct channel_packet pkt;
>> +    struct rte_power_channel_packet_caps_list pkt_caps_list;
>> +    struct rte_power_channel_packet pkt;
>>       bool query_list = false;
>>       int ret;
>>       char *ep;
>>   -    memset(&pkt, 0, sizeof(struct channel_packet));
>> -    memset(&pkt_caps_list, 0, sizeof(struct channel_packet_caps_list));
>> +    memset(&pkt, 0, sizeof(struct rte_power_channel_packet));
>> +    memset(&pkt_caps_list, 0,
>> +            sizeof(struct rte_power_channel_packet_caps_list));
>
> Here and in other places where you do sizeof(), you might want to 
> avoid future changes by replacing it with sizeof(*pkt) instead?
>

Good point. Will do.

Thanks.


^ permalink raw reply	[flat|nested] 69+ messages in thread

* Re: [dpdk-dev] [PATCH v3 5/6] power: add new header file to export list
  2021-01-20 14:28         ` Burakov, Anatoly
  2021-01-20 15:01           ` David Hunt
@ 2021-01-20 15:08           ` Bruce Richardson
  2021-01-20 15:18             ` Burakov, Anatoly
  1 sibling, 1 reply; 69+ messages in thread
From: Bruce Richardson @ 2021-01-20 15:08 UTC (permalink / raw)
  To: Burakov, Anatoly; +Cc: David Hunt, dev, stable

On Wed, Jan 20, 2021 at 02:28:59PM +0000, Burakov, Anatoly wrote:
> On 20-Jan-21 1:55 PM, David Hunt wrote:
> > From: Bruce Richardson <bruce.richardson@intel.com>
> > 
> > Adjust meson.build so that 'ninja install' copies the new header
> > file into the installation directory.
> > 
> > Fixes: 210c383e247b ("power: packet format for vm power management")
> > Fixes: cd0d5547e873 ("power: vm communication channels in guest")
> > Cc: stable@dpdk.org
> > 
> > Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> > Signed-off-by: David Hunt <david.hunt@intel.com>
> > ---
> 
> IMO this should be part of the first patch, otherwise the build could
> (will?) be broken until this patch.
> 
Since things were already broken before the set, I'm not sure this really
matters.

^ permalink raw reply	[flat|nested] 69+ messages in thread

* Re: [dpdk-dev] [PATCH v3 2/6] power: make channel msg functions public
  2021-01-20 14:26         ` Burakov, Anatoly
@ 2021-01-20 15:08           ` David Hunt
  2021-01-20 15:23             ` Burakov, Anatoly
  0 siblings, 1 reply; 69+ messages in thread
From: David Hunt @ 2021-01-20 15:08 UTC (permalink / raw)
  To: Burakov, Anatoly, dev; +Cc: stable, Bruce Richardson


On 20/1/2021 2:26 PM, Burakov, Anatoly wrote:
> On 20-Jan-21 1:55 PM, David Hunt wrote:
>> From: Bruce Richardson <bruce.richardson@intel.com>
>>
>> Move the 2 public functions into rte_power_guest_channel.h
>>
>> Fixes: 210c383e247b ("power: packet format for vm power management")
>> Fixes: cd0d5547e873 ("power: vm communication channels in guest")
>> Cc: stable@dpdk.org
>>
>> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
>> Signed-off-by: David Hunt <david.hunt@intel.com>
>>
>> ---
>
> <snip>
>
>>   +/**
>> + * Send a message contained in pkt over the Virtio-Serial to the 
>> host endpoint.
>> + *
>> + * @param pkt
>> + *  Pointer to a populated struct channel_packet
>> + *
>> + * @param lcore_id
>> + *  lcore_id.
>
> Not very informative doxygen comment :)


Maybe "Use channel specific to this lcore_id"?


>
>> + *
>> + * @return
>> + *  - 0 on success.
>> + *  - Negative on error.
>> + */
>> +__rte_experimental
>> +int rte_power_guest_channel_send_msg(struct channel_packet *pkt,
>> +            unsigned int lcore_id);
>> +
>> +/**
>> + * Receive a message contained in pkt over the Virtio-Serial
>> + * from the host endpoint.
>> + *
>
> Nitpick, but we generally add a warning to experimental functions, 
> like so:
>
>  * @warning
>  * @b EXPERIMENTAL: this API may change, or be removed, without prior 
> notice.
>
> also, presumably this is not meant to be public API and exists solely 
> because there's no other way to do it without significant rework, so 
> maybe mark as @internal too?
>

Yes, I believe so. I will add @internal.


>> + * @param pkt
>> + *  Pointer to channel_packet or
>> + *  channel_packet_freq_list struct.
>> + *
>> + * @param pkt_len
>> + *  Size of expected data packet.
>> + *
>> + * @param lcore_id
>> + *  lcore_id.


Same here.


>> + *
>> + * @return
>> + *  - 0 on success.
>> + *  - Negative on error.
>> + */
>> +__rte_experimental
>> +int rte_power_guest_channel_receive_msg(void *pkt,
>> +        size_t pkt_len,
>> +        unsigned int lcore_id);
>> +
>>     #ifdef __cplusplus
>>   }
>>
>
>

^ permalink raw reply	[flat|nested] 69+ messages in thread

* Re: [dpdk-dev] [PATCH v3 1/6] power: create guest channel public header file
  2021-01-20 13:55       ` [dpdk-dev] [PATCH v3 1/6] power: create guest channel public header file David Hunt
@ 2021-01-20 15:09         ` Burakov, Anatoly
  2021-01-20 15:12           ` David Hunt
  2021-01-21 17:21         ` [dpdk-dev] [PATCH v4 0/6] power: fix make build for power apps David Hunt
  1 sibling, 1 reply; 69+ messages in thread
From: Burakov, Anatoly @ 2021-01-20 15:09 UTC (permalink / raw)
  To: David Hunt, dev; +Cc: stable, Bruce Richardson

On 20-Jan-21 1:55 PM, David Hunt wrote:
> From: Bruce Richardson <bruce.richardson@intel.com>
> 
> In preparation for making the header file public, we first rename
> channel_commands.h as rte_power_guest_channel.h.
> 
> Fixes: 210c383e247b ("power: packet format for vm power management")
> Fixes: cd0d5547e873 ("power: vm communication channels in guest")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> Signed-off-by: David Hunt <david.hunt@intel.com>
> ---

You should also add the new API's to the map file.

-- 
Thanks,
Anatoly

^ permalink raw reply	[flat|nested] 69+ messages in thread

* Re: [dpdk-dev] [PATCH v3 1/6] power: create guest channel public header file
  2021-01-20 15:09         ` Burakov, Anatoly
@ 2021-01-20 15:12           ` David Hunt
  0 siblings, 0 replies; 69+ messages in thread
From: David Hunt @ 2021-01-20 15:12 UTC (permalink / raw)
  To: Burakov, Anatoly, dev; +Cc: stable, Bruce Richardson


On 20/1/2021 3:09 PM, Burakov, Anatoly wrote:
> On 20-Jan-21 1:55 PM, David Hunt wrote:
>> From: Bruce Richardson <bruce.richardson@intel.com>
>>
>> In preparation for making the header file public, we first rename
>> channel_commands.h as rte_power_guest_channel.h.
>>
>> Fixes: 210c383e247b ("power: packet format for vm power management")
>> Fixes: cd0d5547e873 ("power: vm communication channels in guest")
>> Cc: stable@dpdk.org
>>
>> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
>> Signed-off-by: David Hunt <david.hunt@intel.com>
>> ---
>
> You should also add the new API's to the map file.
>
Yes, spotted this earlier. Will be in the next respin. Thanks.




^ permalink raw reply	[flat|nested] 69+ messages in thread

* Re: [dpdk-dev] [PATCH v3 5/6] power: add new header file to export list
  2021-01-20 15:01           ` David Hunt
@ 2021-01-20 15:17             ` Burakov, Anatoly
  0 siblings, 0 replies; 69+ messages in thread
From: Burakov, Anatoly @ 2021-01-20 15:17 UTC (permalink / raw)
  To: David Hunt, dev; +Cc: stable, Bruce Richardson

On 20-Jan-21 3:01 PM, David Hunt wrote:
> 
> On 20/1/2021 2:28 PM, Burakov, Anatoly wrote:
>> On 20-Jan-21 1:55 PM, David Hunt wrote:
>>> From: Bruce Richardson <bruce.richardson@intel.com>
>>>
>>> Adjust meson.build so that 'ninja install' copies the new header
>>> file into the installation directory.
>>>
>>> Fixes: 210c383e247b ("power: packet format for vm power management")
>>> Fixes: cd0d5547e873 ("power: vm communication channels in guest")
>>> Cc: stable@dpdk.org
>>>
>>> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
>>> Signed-off-by: David Hunt <david.hunt@intel.com>
>>> ---
>>
>> IMO this should be part of the first patch, otherwise the build could 
>> (will?) be broken until this patch.
>>
> Hi Anatoly,
> 
>     It was broken before this patch set. I wanted to have everything in 
> place, including the correct naming of structs/defines before allowing 
> builds against the new header file, hence this order in the patch set.
> 
> Rgds,
> 
> Dave.
> 

It's only my opinion obviously, but i rather prefer an approach of 
fixing build issues first, and then renaming everything, as I like to 
have each patch build at every step of the way. You probably know 
better, but from a cursory look, you should be able to keep 
progressively changing things but also keep everything building 
correctly every step of the way.

-- 
Thanks,
Anatoly

^ permalink raw reply	[flat|nested] 69+ messages in thread

* Re: [dpdk-dev] [PATCH v3 5/6] power: add new header file to export list
  2021-01-20 15:08           ` Bruce Richardson
@ 2021-01-20 15:18             ` Burakov, Anatoly
  2021-01-20 15:29               ` David Hunt
  0 siblings, 1 reply; 69+ messages in thread
From: Burakov, Anatoly @ 2021-01-20 15:18 UTC (permalink / raw)
  To: Bruce Richardson; +Cc: David Hunt, dev, stable

On 20-Jan-21 3:08 PM, Bruce Richardson wrote:
> On Wed, Jan 20, 2021 at 02:28:59PM +0000, Burakov, Anatoly wrote:
>> On 20-Jan-21 1:55 PM, David Hunt wrote:
>>> From: Bruce Richardson <bruce.richardson@intel.com>
>>>
>>> Adjust meson.build so that 'ninja install' copies the new header
>>> file into the installation directory.
>>>
>>> Fixes: 210c383e247b ("power: packet format for vm power management")
>>> Fixes: cd0d5547e873 ("power: vm communication channels in guest")
>>> Cc: stable@dpdk.org
>>>
>>> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
>>> Signed-off-by: David Hunt <david.hunt@intel.com>
>>> ---
>>
>> IMO this should be part of the first patch, otherwise the build could
>> (will?) be broken until this patch.
>>
> Since things were already broken before the set, I'm not sure this really
> matters.
> 

If they can be *un*broken sooner, that's a win in my book :)

-- 
Thanks,
Anatoly

^ permalink raw reply	[flat|nested] 69+ messages in thread

* Re: [dpdk-dev] [PATCH v3 2/6] power: make channel msg functions public
  2021-01-20 15:08           ` David Hunt
@ 2021-01-20 15:23             ` Burakov, Anatoly
  0 siblings, 0 replies; 69+ messages in thread
From: Burakov, Anatoly @ 2021-01-20 15:23 UTC (permalink / raw)
  To: David Hunt, dev; +Cc: stable, Bruce Richardson

On 20-Jan-21 3:08 PM, David Hunt wrote:
> 
> On 20/1/2021 2:26 PM, Burakov, Anatoly wrote:
>> On 20-Jan-21 1:55 PM, David Hunt wrote:
>>> From: Bruce Richardson <bruce.richardson@intel.com>
>>>
>>> Move the 2 public functions into rte_power_guest_channel.h
>>>
>>> Fixes: 210c383e247b ("power: packet format for vm power management")
>>> Fixes: cd0d5547e873 ("power: vm communication channels in guest")
>>> Cc: stable@dpdk.org
>>>
>>> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
>>> Signed-off-by: David Hunt <david.hunt@intel.com>
>>>
>>> ---
>>
>> <snip>
>>
>>>   +/**
>>> + * Send a message contained in pkt over the Virtio-Serial to the 
>>> host endpoint.
>>> + *
>>> + * @param pkt
>>> + *  Pointer to a populated struct channel_packet
>>> + *
>>> + * @param lcore_id
>>> + *  lcore_id.
>>
>> Not very informative doxygen comment :)
> 
> 
> Maybe "Use channel specific to this lcore_id"?
> 

Something like that, yes. Or, "Use channel associated with this lcore ID".

-- 
Thanks,
Anatoly

^ permalink raw reply	[flat|nested] 69+ messages in thread

* Re: [dpdk-dev] [PATCH v3 5/6] power: add new header file to export list
  2021-01-20 15:18             ` Burakov, Anatoly
@ 2021-01-20 15:29               ` David Hunt
  2021-01-20 15:43                 ` Burakov, Anatoly
  0 siblings, 1 reply; 69+ messages in thread
From: David Hunt @ 2021-01-20 15:29 UTC (permalink / raw)
  To: Burakov, Anatoly, Bruce Richardson; +Cc: dev, stable


On 20/1/2021 3:18 PM, Burakov, Anatoly wrote:
> On 20-Jan-21 3:08 PM, Bruce Richardson wrote:
>> On Wed, Jan 20, 2021 at 02:28:59PM +0000, Burakov, Anatoly wrote:
>>> On 20-Jan-21 1:55 PM, David Hunt wrote:
>>>> From: Bruce Richardson <bruce.richardson@intel.com>
>>>>
>>>> Adjust meson.build so that 'ninja install' copies the new header
>>>> file into the installation directory.
>>>>
>>>> Fixes: 210c383e247b ("power: packet format for vm power management")
>>>> Fixes: cd0d5547e873 ("power: vm communication channels in guest")
>>>> Cc: stable@dpdk.org
>>>>
>>>> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
>>>> Signed-off-by: David Hunt <david.hunt@intel.com>
>>>> ---
>>>
>>> IMO this should be part of the first patch, otherwise the build could
>>> (will?) be broken until this patch.
>>>
>> Since things were already broken before the set, I'm not sure this 
>> really
>> matters.
>>
>
> If they can be *un*broken sooner, that's a win in my book :)


I'll keep that in mind for future patch sets. For this one, the effort 
to change far outweighs the benefits, so I'll leave as is. OK with you?


^ permalink raw reply	[flat|nested] 69+ messages in thread

* Re: [dpdk-dev] [PATCH v3 5/6] power: add new header file to export list
  2021-01-20 15:29               ` David Hunt
@ 2021-01-20 15:43                 ` Burakov, Anatoly
  0 siblings, 0 replies; 69+ messages in thread
From: Burakov, Anatoly @ 2021-01-20 15:43 UTC (permalink / raw)
  To: David Hunt, Bruce Richardson; +Cc: dev, stable

On 20-Jan-21 3:29 PM, David Hunt wrote:
> 
> On 20/1/2021 3:18 PM, Burakov, Anatoly wrote:
>> On 20-Jan-21 3:08 PM, Bruce Richardson wrote:
>>> On Wed, Jan 20, 2021 at 02:28:59PM +0000, Burakov, Anatoly wrote:
>>>> On 20-Jan-21 1:55 PM, David Hunt wrote:
>>>>> From: Bruce Richardson <bruce.richardson@intel.com>
>>>>>
>>>>> Adjust meson.build so that 'ninja install' copies the new header
>>>>> file into the installation directory.
>>>>>
>>>>> Fixes: 210c383e247b ("power: packet format for vm power management")
>>>>> Fixes: cd0d5547e873 ("power: vm communication channels in guest")
>>>>> Cc: stable@dpdk.org
>>>>>
>>>>> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
>>>>> Signed-off-by: David Hunt <david.hunt@intel.com>
>>>>> ---
>>>>
>>>> IMO this should be part of the first patch, otherwise the build could
>>>> (will?) be broken until this patch.
>>>>
>>> Since things were already broken before the set, I'm not sure this 
>>> really
>>> matters.
>>>
>>
>> If they can be *un*broken sooner, that's a win in my book :)
> 
> 
> I'll keep that in mind for future patch sets. For this one, the effort 
> to change far outweighs the benefits, so I'll leave as is. OK with you?
> 

Sure.
-- 
Thanks,
Anatoly

^ permalink raw reply	[flat|nested] 69+ messages in thread

* [dpdk-dev] [PATCH v4 0/6] power: fix make build for power apps
  2021-01-20 13:55       ` [dpdk-dev] [PATCH v3 1/6] power: create guest channel public header file David Hunt
  2021-01-20 15:09         ` Burakov, Anatoly
@ 2021-01-21 17:21         ` David Hunt
  2021-01-21 17:21           ` [dpdk-dev] [PATCH v4 1/6] power: create guest channel public header file David Hunt
                             ` (7 more replies)
  1 sibling, 8 replies; 69+ messages in thread
From: David Hunt @ 2021-01-21 17:21 UTC (permalink / raw)
  To: dev; +Cc: david.hunt, stable

The guest channel message definitions and functions in guest_channel.h
are needed by applications and need to be made public.

This worked pre-20.11, but now with all the meson/ninja changes, making
these apps externally no longer works. To fix, we need to move the
header file with the API definitions for the channel commands public,
and rename the functions accordingly.

The main change is to rename channel_commands.h to
rte_power_guest_channel.h so that it gets picked up by the installer
and copied to /usr/local/include. Other changes include renaming #defines
to have RTE_ at the beginning instead of CPU_. Finally we refactor the
code to work with those changes.

---
v2 changes
 - re-worked from monolithic patch to a 6 patch patchset for easier review
v3 changes
  - Ensure both functions added to the API are tagged as experimental
v4 changes
  - add @internal tag on 2 functions for Doxygen
  - add @warning EXPERIMENTAL tag on 2 functions for Doxygen
  - improve description of lcore param in API docs
  - Improve maintainability sizeof's
  - add the 2 added functions to the version.map file

[PATCH v4 1/6] power: create guest channel public header file
[PATCH v4 2/6] power: make channel msg functions public
[PATCH v4 3/6] power: rename public structs
[PATCH v4 4/6] power: rename defines
[PATCH v4 5/6] power: add new header file to export list
[PATCH v4 6/6] power: clean up includes


^ permalink raw reply	[flat|nested] 69+ messages in thread

* [dpdk-dev] [PATCH v4 1/6] power: create guest channel public header file
  2021-01-21 17:21         ` [dpdk-dev] [PATCH v4 0/6] power: fix make build for power apps David Hunt
@ 2021-01-21 17:21           ` David Hunt
  2021-01-29 10:21             ` [dpdk-dev] [PATCH v5 0/6] power: fix make build for power apps David Hunt
  2021-01-21 17:21           ` [dpdk-dev] [PATCH v4 2/6] power: make channel msg functions public David Hunt
                             ` (6 subsequent siblings)
  7 siblings, 1 reply; 69+ messages in thread
From: David Hunt @ 2021-01-21 17:21 UTC (permalink / raw)
  To: dev; +Cc: david.hunt, stable, Bruce Richardson

From: Bruce Richardson <bruce.richardson@intel.com>

In preparation for making the header file public, we first rename
channel_commands.h as rte_power_guest_channel.h.

Fixes: 210c383e247b ("power: packet format for vm power management")
Fixes: cd0d5547e873 ("power: vm communication channels in guest")
Cc: stable@dpdk.org

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: David Hunt <david.hunt@intel.com>
---
 examples/vm_power_manager/channel_manager.c              | 2 +-
 examples/vm_power_manager/channel_monitor.c              | 2 +-
 examples/vm_power_manager/channel_monitor.h              | 2 +-
 examples/vm_power_manager/guest_cli/vm_power_cli_guest.h | 2 +-
 examples/vm_power_manager/vm_power_cli.c                 | 2 +-
 lib/librte_power/guest_channel.c                         | 2 +-
 lib/librte_power/guest_channel.h                         | 2 +-
 lib/librte_power/power_kvm_vm.c                          | 2 +-
 .../{channel_commands.h => rte_power_guest_channel.h}    | 9 ++++-----
 9 files changed, 12 insertions(+), 13 deletions(-)
 rename lib/librte_power/{channel_commands.h => rte_power_guest_channel.h} (94%)

diff --git a/examples/vm_power_manager/channel_manager.c b/examples/vm_power_manager/channel_manager.c
index a26315051..c7d5bf5a8 100644
--- a/examples/vm_power_manager/channel_manager.c
+++ b/examples/vm_power_manager/channel_manager.c
@@ -27,7 +27,7 @@
 #include <libvirt/libvirt.h>
 
 #include "channel_manager.h"
-#include "channel_commands.h"
+#include "rte_power_guest_channel.h"
 #include "channel_monitor.h"
 #include "power_manager.h"
 
diff --git a/examples/vm_power_manager/channel_monitor.c b/examples/vm_power_manager/channel_monitor.c
index 228f06803..08306105d 100644
--- a/examples/vm_power_manager/channel_monitor.c
+++ b/examples/vm_power_manager/channel_monitor.c
@@ -35,7 +35,7 @@
 
 #include <libvirt/libvirt.h>
 #include "channel_monitor.h"
-#include "channel_commands.h"
+#include "rte_power_guest_channel.h"
 #include "channel_manager.h"
 #include "power_manager.h"
 #include "oob_monitor.h"
diff --git a/examples/vm_power_manager/channel_monitor.h b/examples/vm_power_manager/channel_monitor.h
index 7362a80d2..4a526ff67 100644
--- a/examples/vm_power_manager/channel_monitor.h
+++ b/examples/vm_power_manager/channel_monitor.h
@@ -6,7 +6,7 @@
 #define CHANNEL_MONITOR_H_
 
 #include "channel_manager.h"
-#include "channel_commands.h"
+#include "rte_power_guest_channel.h"
 
 struct core_share {
 	unsigned int pcpu;
diff --git a/examples/vm_power_manager/guest_cli/vm_power_cli_guest.h b/examples/vm_power_manager/guest_cli/vm_power_cli_guest.h
index 6ad14a3de..2299d23dc 100644
--- a/examples/vm_power_manager/guest_cli/vm_power_cli_guest.h
+++ b/examples/vm_power_manager/guest_cli/vm_power_cli_guest.h
@@ -9,7 +9,7 @@
 extern "C" {
 #endif
 
-#include "channel_commands.h"
+#include "rte_power_guest_channel.h"
 
 struct channel_packet *get_policy(void);
 
diff --git a/examples/vm_power_manager/vm_power_cli.c b/examples/vm_power_manager/vm_power_cli.c
index ed0623a41..f7e1b596e 100644
--- a/examples/vm_power_manager/vm_power_cli.c
+++ b/examples/vm_power_manager/vm_power_cli.c
@@ -21,7 +21,7 @@
 #include "channel_manager.h"
 #include "channel_monitor.h"
 #include "power_manager.h"
-#include "channel_commands.h"
+#include "rte_power_guest_channel.h"
 
 struct cmd_quit_result {
 	cmdline_fixed_string_t quit;
diff --git a/lib/librte_power/guest_channel.c b/lib/librte_power/guest_channel.c
index 7b5926e5c..4cb5ae1dd 100644
--- a/lib/librte_power/guest_channel.c
+++ b/lib/librte_power/guest_channel.c
@@ -17,7 +17,7 @@
 #include <rte_log.h>
 
 #include "guest_channel.h"
-#include "channel_commands.h"
+#include "rte_power_guest_channel.h"
 
 #define RTE_LOGTYPE_GUEST_CHANNEL RTE_LOGTYPE_USER1
 
diff --git a/lib/librte_power/guest_channel.h b/lib/librte_power/guest_channel.h
index e15db46fc..d3d87f0ae 100644
--- a/lib/librte_power/guest_channel.h
+++ b/lib/librte_power/guest_channel.h
@@ -8,7 +8,7 @@
 extern "C" {
 #endif
 
-#include <channel_commands.h>
+#include <rte_power_guest_channel.h>
 
 /**
  * Check if any Virtio-Serial VM end-points exist in path.
diff --git a/lib/librte_power/power_kvm_vm.c b/lib/librte_power/power_kvm_vm.c
index 409c3e03a..649ebe85c 100644
--- a/lib/librte_power/power_kvm_vm.c
+++ b/lib/librte_power/power_kvm_vm.c
@@ -7,7 +7,7 @@
 #include <rte_log.h>
 
 #include "guest_channel.h"
-#include "channel_commands.h"
+#include "rte_power_guest_channel.h"
 #include "power_kvm_vm.h"
 #include "power_common.h"
 
diff --git a/lib/librte_power/channel_commands.h b/lib/librte_power/rte_power_guest_channel.h
similarity index 94%
rename from lib/librte_power/channel_commands.h
rename to lib/librte_power/rte_power_guest_channel.h
index adc8e5ca2..ef3b064a8 100644
--- a/lib/librte_power/channel_commands.h
+++ b/lib/librte_power/rte_power_guest_channel.h
@@ -1,9 +1,8 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2010-2014 Intel Corporation
+ * Copyright(c) 2010-2021 Intel Corporation
  */
-
-#ifndef CHANNEL_COMMANDS_H_
-#define CHANNEL_COMMANDS_H_
+#ifndef RTE_POWER_GUEST_CHANNEL_H
+#define RTE_POWER_GUEST_CHANNEL_H
 
 #ifdef __cplusplus
 extern "C" {
@@ -122,4 +121,4 @@ struct channel_packet_caps_list {
 }
 #endif
 
-#endif /* CHANNEL_COMMANDS_H_ */
+#endif /* RTE_POWER_GUEST_CHANNEL_H_ */
-- 
2.17.1


^ permalink raw reply	[flat|nested] 69+ messages in thread

* [dpdk-dev] [PATCH v4 2/6] power: make channel msg functions public
  2021-01-21 17:21         ` [dpdk-dev] [PATCH v4 0/6] power: fix make build for power apps David Hunt
  2021-01-21 17:21           ` [dpdk-dev] [PATCH v4 1/6] power: create guest channel public header file David Hunt
@ 2021-01-21 17:21           ` David Hunt
  2021-01-22 12:12             ` Burakov, Anatoly
  2021-02-22  9:53             ` [dpdk-dev] [dpdk-stable] " Ferruh Yigit
  2021-01-21 17:21           ` [dpdk-dev] [PATCH v4 3/6] power: rename public structs David Hunt
                             ` (5 subsequent siblings)
  7 siblings, 2 replies; 69+ messages in thread
From: David Hunt @ 2021-01-21 17:21 UTC (permalink / raw)
  To: dev; +Cc: david.hunt, stable, Bruce Richardson

From: Bruce Richardson <bruce.richardson@intel.com>

Move the 2 public functions into rte_power_guest_channel.h

Fixes: 210c383e247b ("power: packet format for vm power management")
Fixes: cd0d5547e873 ("power: vm communication channels in guest")
Cc: stable@dpdk.org

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: David Hunt <david.hunt@intel.com>

---
changes in v3
* Mark both added functions as experimental
changes in v4
* add @internal tag for Doxygen
* add @warning EXPERIMENTAL tag for Doxygen
* improve description of lcore param
---
 lib/librte_power/guest_channel.h           | 40 +----------------
 lib/librte_power/rte_power_guest_channel.h | 50 ++++++++++++++++++++++
 2 files changed, 51 insertions(+), 39 deletions(-)

diff --git a/lib/librte_power/guest_channel.h b/lib/librte_power/guest_channel.h
index d3d87f0ae..69020b030 100644
--- a/lib/librte_power/guest_channel.h
+++ b/lib/librte_power/guest_channel.h
@@ -65,21 +65,7 @@ void guest_channel_host_disconnect(unsigned int 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.
- *
- * @param pkt
- *  Pointer to a populated struct channel_packet
- *
- * @param lcore_id
- *  lcore_id.
- *
- * @return
- *  - 0 on success.
- *  - Negative on error.
- */
-int rte_power_guest_channel_send_msg(struct channel_packet *pkt,
-			unsigned int lcore_id);
+
 
 /**
  * Read a message contained in pkt over the Virtio-Serial
@@ -103,30 +89,6 @@ int power_guest_channel_read_msg(void *pkt,
 		size_t pkt_len,
 		unsigned int lcore_id);
 
-/**
- * Receive a message contained in pkt over the Virtio-Serial
- * from the host endpoint.
- *
- * @param pkt
- *  Pointer to channel_packet or
- *  channel_packet_freq_list struct.
- *
- * @param pkt_len
- *  Size of expected data packet.
- *
- * @param lcore_id
- *  lcore_id.
- *
- * @return
- *  - 0 on success.
- *  - Negative on error.
- */
-__rte_experimental
-int
-rte_power_guest_channel_receive_msg(void *pkt,
-		size_t pkt_len,
-		unsigned int lcore_id);
-
 
 #ifdef __cplusplus
 }
diff --git a/lib/librte_power/rte_power_guest_channel.h b/lib/librte_power/rte_power_guest_channel.h
index ef3b064a8..c500c0cda 100644
--- a/lib/librte_power/rte_power_guest_channel.h
+++ b/lib/librte_power/rte_power_guest_channel.h
@@ -116,6 +116,56 @@ struct channel_packet_caps_list {
 	uint8_t num_vcpu;
 };
 
+/**
+ * @internal
+ *
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice.
+ *
+ * Send a message contained in pkt over the Virtio-Serial to the host endpoint.
+ *
+ * @param pkt
+ *  Pointer to a populated struct channel_packet.
+ *
+ * @param lcore_id
+ *  Use channel specific to this lcore_id.
+ *
+ * @return
+ *  - 0 on success.
+ *  - Negative on error.
+ */
+__rte_experimental
+int rte_power_guest_channel_send_msg(struct channel_packet *pkt,
+			unsigned int lcore_id);
+
+/**
+ * @internal
+ *
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice.
+ *
+ * Receive a message contained in pkt over the Virtio-Serial
+ * from the host endpoint.
+ *
+ * @param pkt
+ *  Pointer to channel_packet or
+ *  channel_packet_freq_list struct.
+ *
+ * @param pkt_len
+ *  Size of expected data packet.
+ *
+ * @param lcore_id
+ *  Use channel specific to this lcore_id.
+ *
+ * @return
+ *  - 0 on success.
+ *  - Negative on error.
+ */
+__rte_experimental
+int rte_power_guest_channel_receive_msg(void *pkt,
+		size_t pkt_len,
+		unsigned int lcore_id);
+
 
 #ifdef __cplusplus
 }
-- 
2.17.1


^ permalink raw reply	[flat|nested] 69+ messages in thread

* [dpdk-dev] [PATCH v4 3/6] power: rename public structs
  2021-01-21 17:21         ` [dpdk-dev] [PATCH v4 0/6] power: fix make build for power apps David Hunt
  2021-01-21 17:21           ` [dpdk-dev] [PATCH v4 1/6] power: create guest channel public header file David Hunt
  2021-01-21 17:21           ` [dpdk-dev] [PATCH v4 2/6] power: make channel msg functions public David Hunt
@ 2021-01-21 17:21           ` David Hunt
  2021-01-22 12:15             ` Burakov, Anatoly
                               ` (3 more replies)
  2021-01-21 17:21           ` [dpdk-dev] [PATCH v4 4/6] power: rename defines David Hunt
                             ` (4 subsequent siblings)
  7 siblings, 4 replies; 69+ messages in thread
From: David Hunt @ 2021-01-21 17:21 UTC (permalink / raw)
  To: dev; +Cc: david.hunt, stable, Bruce Richardson

From: Bruce Richardson <bruce.richardson@intel.com>

rename the public structs to have an rte_power_ prefix and
add them to version.map in experimental section.

Fixes: 210c383e247b ("power: packet format for vm power management")
Fixes: cd0d5547e873 ("power: vm communication channels in guest")
Cc: stable@dpdk.org

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: David Hunt <david.hunt@intel.com>

---
changes in v4
* Improve sizeof's
* add the 2 functions to the version.map file
---
 examples/vm_power_manager/channel_monitor.c   | 33 ++++++------
 examples/vm_power_manager/channel_monitor.h   |  2 +-
 examples/vm_power_manager/guest_cli/main.c    |  2 +-
 .../guest_cli/vm_power_cli_guest.c            | 38 +++++++-------
 .../guest_cli/vm_power_cli_guest.h            |  4 +-
 lib/librte_power/guest_channel.c              |  7 +--
 lib/librte_power/guest_channel.h              |  7 +--
 lib/librte_power/power_kvm_vm.c               |  2 +-
 lib/librte_power/rte_power_guest_channel.h    | 51 +++++++++----------
 lib/librte_power/version.map                  |  4 ++
 10 files changed, 77 insertions(+), 73 deletions(-)

diff --git a/examples/vm_power_manager/channel_monitor.c b/examples/vm_power_manager/channel_monitor.c
index 08306105d..1b6041b6f 100644
--- a/examples/vm_power_manager/channel_monitor.c
+++ b/examples/vm_power_manager/channel_monitor.c
@@ -108,7 +108,7 @@ str_to_ether_addr(const char *a, struct rte_ether_addr *ether_addr)
 }
 
 static int
-set_policy_mac(struct channel_packet *pkt, int idx, char *mac)
+set_policy_mac(struct rte_power_channel_packet *pkt, int idx, char *mac)
 {
 	union PFID pfid;
 	int ret;
@@ -165,7 +165,7 @@ get_resource_id_from_vmname(const char *vm_name)
 }
 
 static int
-parse_json_to_pkt(json_t *element, struct channel_packet *pkt,
+parse_json_to_pkt(json_t *element, struct rte_power_channel_packet *pkt,
 					const char *vm_name)
 {
 	const char *key;
@@ -173,7 +173,7 @@ parse_json_to_pkt(json_t *element, struct channel_packet *pkt,
 	int ret;
 	int resource_id;
 
-	memset(pkt, 0, sizeof(struct channel_packet));
+	memset(pkt, 0, sizeof(*pkt));
 
 	pkt->nb_mac_to_monitor = 0;
 	pkt->t_boost_status.tbEnabled = false;
@@ -463,7 +463,7 @@ get_pfid(struct policy *pol)
 }
 
 static int
-update_policy(struct channel_packet *pkt)
+update_policy(struct rte_power_channel_packet *pkt)
 {
 
 	unsigned int updated = 0;
@@ -512,7 +512,7 @@ update_policy(struct channel_packet *pkt)
 }
 
 static int
-remove_policy(struct channel_packet *pkt __rte_unused)
+remove_policy(struct rte_power_channel_packet *pkt __rte_unused)
 {
 	unsigned int i;
 
@@ -673,7 +673,7 @@ static void
 apply_policy(struct policy *pol)
 {
 
-	struct channel_packet *pkt = &pol->pkt;
+	struct rte_power_channel_packet *pkt = &pol->pkt;
 
 	/*Check policy to use*/
 	if (pkt->policy_to_use == TRAFFIC)
@@ -715,12 +715,12 @@ write_binary_packet(void *buffer,
 }
 
 static int
-send_freq(struct channel_packet *pkt,
+send_freq(struct rte_power_channel_packet *pkt,
 		struct channel_info *chan_info,
 		bool freq_list)
 {
 	unsigned int vcore_id = pkt->resource_id;
-	struct channel_packet_freq_list channel_pkt_freq_list;
+	struct rte_power_channel_packet_freq_list channel_pkt_freq_list;
 	struct vm_info info;
 
 	if (get_info_vm(pkt->vm_name, &info) != 0)
@@ -751,12 +751,12 @@ send_freq(struct channel_packet *pkt,
 }
 
 static int
-send_capabilities(struct channel_packet *pkt,
+send_capabilities(struct rte_power_channel_packet *pkt,
 		struct channel_info *chan_info,
 		bool list_requested)
 {
 	unsigned int vcore_id = pkt->resource_id;
-	struct channel_packet_caps_list channel_pkt_caps_list;
+	struct rte_power_channel_packet_caps_list channel_pkt_caps_list;
 	struct vm_info info;
 	struct rte_power_core_capabilities caps;
 	int ret;
@@ -805,18 +805,19 @@ send_capabilities(struct channel_packet *pkt,
 }
 
 static int
-send_ack_for_received_cmd(struct channel_packet *pkt,
+send_ack_for_received_cmd(struct rte_power_channel_packet *pkt,
 		struct channel_info *chan_info,
 		uint32_t command)
 {
 	pkt->command = command;
 	return write_binary_packet(pkt,
-			sizeof(struct channel_packet),
+			sizeof(*pkt),
 			chan_info);
 }
 
 static int
-process_request(struct channel_packet *pkt, struct channel_info *chan_info)
+process_request(struct rte_power_channel_packet *pkt,
+		struct channel_info *chan_info)
 {
 	int ret;
 
@@ -988,7 +989,7 @@ channel_monitor_init(void)
 static void
 read_binary_packet(struct channel_info *chan_info)
 {
-	struct channel_packet pkt;
+	struct rte_power_channel_packet pkt;
 	void *buffer = &pkt;
 	int buffer_len = sizeof(pkt);
 	int n_bytes, err = 0;
@@ -1019,7 +1020,7 @@ read_binary_packet(struct channel_info *chan_info)
 static void
 read_json_packet(struct channel_info *chan_info)
 {
-	struct channel_packet pkt;
+	struct rte_power_channel_packet pkt;
 	int n_bytes, ret;
 	json_t *root;
 	json_error_t error;
@@ -1063,7 +1064,7 @@ read_json_packet(struct channel_info *chan_info)
 			/*
 			 * Because our data is now in the json
 			 * object, we can overwrite the pkt
-			 * with a channel_packet struct, using
+			 * with a rte_power_channel_packet struct, using
 			 * parse_json_to_pkt()
 			 */
 			ret = parse_json_to_pkt(root, &pkt, resource_name);
diff --git a/examples/vm_power_manager/channel_monitor.h b/examples/vm_power_manager/channel_monitor.h
index 4a526ff67..0ca6207ad 100644
--- a/examples/vm_power_manager/channel_monitor.h
+++ b/examples/vm_power_manager/channel_monitor.h
@@ -18,7 +18,7 @@ struct core_share {
 };
 
 struct policy {
-	struct channel_packet pkt;
+	struct rte_power_channel_packet pkt;
 	uint32_t pfid[MAX_VFS];
 	uint32_t port[MAX_VFS];
 	unsigned int enabled;
diff --git a/examples/vm_power_manager/guest_cli/main.c b/examples/vm_power_manager/guest_cli/main.c
index f63b3c988..fc7a8c30a 100644
--- a/examples/vm_power_manager/guest_cli/main.c
+++ b/examples/vm_power_manager/guest_cli/main.c
@@ -48,7 +48,7 @@ parse_args(int argc, char **argv)
 		{ "policy", required_argument, 0, 'o'},
 		{NULL, 0, 0, 0}
 	};
-	struct channel_packet *policy;
+	struct rte_power_channel_packet *policy;
 	unsigned short int hours[MAX_HOURS];
 	unsigned short int cores[MAX_VCPU_PER_VM];
 	unsigned short int ports[MAX_VCPU_PER_VM];
diff --git a/examples/vm_power_manager/guest_cli/vm_power_cli_guest.c b/examples/vm_power_manager/guest_cli/vm_power_cli_guest.c
index cf1636e78..125dfeb10 100644
--- a/examples/vm_power_manager/guest_cli/vm_power_cli_guest.c
+++ b/examples/vm_power_manager/guest_cli/vm_power_cli_guest.c
@@ -38,9 +38,9 @@ union PFID {
 	uint64_t pfid;
 };
 
-static struct channel_packet policy;
+static struct rte_power_channel_packet policy;
 
-struct channel_packet *
+struct rte_power_channel_packet *
 get_policy(void)
 {
 	return &policy;
@@ -49,7 +49,7 @@ get_policy(void)
 int
 set_policy_mac(int port, int idx)
 {
-	struct channel_packet *policy;
+	struct rte_power_channel_packet *policy;
 	union PFID pfid;
 	int ret;
 
@@ -73,7 +73,7 @@ set_policy_mac(int port, int idx)
 }
 
 int
-set_policy_defaults(struct channel_packet *pkt)
+set_policy_defaults(struct rte_power_channel_packet *pkt)
 {
 	int ret;
 
@@ -145,7 +145,7 @@ struct cmd_freq_list_result {
 };
 
 static int
-query_data(struct channel_packet *pkt, unsigned int lcore_id)
+query_data(struct rte_power_channel_packet *pkt, unsigned int lcore_id)
 {
 	int ret;
 	ret = rte_power_guest_channel_send_msg(pkt, lcore_id);
@@ -157,13 +157,13 @@ query_data(struct channel_packet *pkt, unsigned int lcore_id)
 }
 
 static int
-receive_freq_list(struct channel_packet_freq_list *pkt_freq_list,
+receive_freq_list(struct rte_power_channel_packet_freq_list *pkt_freq_list,
 		unsigned int lcore_id)
 {
 	int ret;
 
 	ret = rte_power_guest_channel_receive_msg(pkt_freq_list,
-			sizeof(struct channel_packet_freq_list),
+			sizeof(*pkt_freq_list),
 			lcore_id);
 	if (ret < 0) {
 		RTE_LOG(ERR, GUEST_CLI, "Error receiving message.\n");
@@ -183,14 +183,14 @@ cmd_query_freq_list_parsed(void *parsed_result,
 {
 	struct cmd_freq_list_result *res = parsed_result;
 	unsigned int lcore_id;
-	struct channel_packet_freq_list pkt_freq_list;
-	struct channel_packet pkt;
+	struct rte_power_channel_packet_freq_list pkt_freq_list;
+	struct rte_power_channel_packet pkt;
 	bool query_list = false;
 	int ret;
 	char *ep;
 
-	memset(&pkt, 0, sizeof(struct channel_packet));
-	memset(&pkt_freq_list, 0, sizeof(struct channel_packet_freq_list));
+	memset(&pkt, 0, sizeof(pkt));
+	memset(&pkt_freq_list, 0, sizeof(pkt_freq_list));
 
 	if (!strcmp(res->cpu_num, "all")) {
 
@@ -267,13 +267,13 @@ struct cmd_query_caps_result {
 };
 
 static int
-receive_capabilities(struct channel_packet_caps_list *pkt_caps_list,
+receive_capabilities(struct rte_power_channel_packet_caps_list *pkt_caps_list,
 		unsigned int lcore_id)
 {
 	int ret;
 
 	ret = rte_power_guest_channel_receive_msg(pkt_caps_list,
-		sizeof(struct channel_packet_caps_list),
+		sizeof(*pkt_caps_list),
 		lcore_id);
 	if (ret < 0) {
 		RTE_LOG(ERR, GUEST_CLI, "Error receiving message.\n");
@@ -293,14 +293,14 @@ cmd_query_caps_list_parsed(void *parsed_result,
 {
 	struct cmd_query_caps_result *res = parsed_result;
 	unsigned int lcore_id;
-	struct channel_packet_caps_list pkt_caps_list;
-	struct channel_packet pkt;
+	struct rte_power_channel_packet_caps_list pkt_caps_list;
+	struct rte_power_channel_packet pkt;
 	bool query_list = false;
 	int ret;
 	char *ep;
 
-	memset(&pkt, 0, sizeof(struct channel_packet));
-	memset(&pkt_caps_list, 0, sizeof(struct channel_packet_caps_list));
+	memset(&pkt, 0, sizeof(pkt));
+	memset(&pkt_caps_list, 0, sizeof(pkt_caps_list));
 
 	if (!strcmp(res->cpu_num, "all")) {
 
@@ -380,7 +380,7 @@ cmdline_parse_inst_t cmd_query_caps_list = {
 static int
 check_response_cmd(unsigned int lcore_id, int *result)
 {
-	struct channel_packet pkt;
+	struct rte_power_channel_packet pkt;
 	int ret;
 
 	ret = rte_power_guest_channel_receive_msg(&pkt, sizeof pkt, lcore_id);
@@ -473,7 +473,7 @@ struct cmd_send_policy_result {
 };
 
 static inline int
-send_policy(struct channel_packet *pkt, struct cmdline *cl)
+send_policy(struct rte_power_channel_packet *pkt, struct cmdline *cl)
 {
 	int ret;
 
diff --git a/examples/vm_power_manager/guest_cli/vm_power_cli_guest.h b/examples/vm_power_manager/guest_cli/vm_power_cli_guest.h
index 2299d23dc..5d285ca9d 100644
--- a/examples/vm_power_manager/guest_cli/vm_power_cli_guest.h
+++ b/examples/vm_power_manager/guest_cli/vm_power_cli_guest.h
@@ -11,11 +11,11 @@ extern "C" {
 
 #include "rte_power_guest_channel.h"
 
-struct channel_packet *get_policy(void);
+struct rte_power_channel_packet *get_policy(void);
 
 int set_policy_mac(int port, int idx);
 
-int set_policy_defaults(struct channel_packet *pkt);
+int set_policy_defaults(struct rte_power_channel_packet *pkt);
 
 void run_cli(__rte_unused void *arg);
 
diff --git a/lib/librte_power/guest_channel.c b/lib/librte_power/guest_channel.c
index 4cb5ae1dd..9eb2f6330 100644
--- a/lib/librte_power/guest_channel.c
+++ b/lib/librte_power/guest_channel.c
@@ -55,7 +55,7 @@ int
 guest_channel_host_connect(const char *path, unsigned int lcore_id)
 {
 	int flags, ret;
-	struct channel_packet pkt;
+	struct rte_power_channel_packet pkt;
 	char fd_path[PATH_MAX];
 	int fd = -1;
 
@@ -119,7 +119,8 @@ guest_channel_host_connect(const char *path, unsigned int lcore_id)
 }
 
 int
-guest_channel_send_msg(struct channel_packet *pkt, unsigned int lcore_id)
+guest_channel_send_msg(struct rte_power_channel_packet *pkt,
+		unsigned int lcore_id)
 {
 	int ret, buffer_len = sizeof(*pkt);
 	void *buffer = pkt;
@@ -149,7 +150,7 @@ guest_channel_send_msg(struct channel_packet *pkt, unsigned int lcore_id)
 	return 0;
 }
 
-int rte_power_guest_channel_send_msg(struct channel_packet *pkt,
+int rte_power_guest_channel_send_msg(struct rte_power_channel_packet *pkt,
 			unsigned int lcore_id)
 {
 	return guest_channel_send_msg(pkt, lcore_id);
diff --git a/lib/librte_power/guest_channel.h b/lib/librte_power/guest_channel.h
index 69020b030..7d3a909d9 100644
--- a/lib/librte_power/guest_channel.h
+++ b/lib/librte_power/guest_channel.h
@@ -63,7 +63,8 @@ void guest_channel_host_disconnect(unsigned int lcore_id);
  *  - Negative on channel not connected.
  *  - errno on write to channel error.
  */
-int guest_channel_send_msg(struct channel_packet *pkt, unsigned int lcore_id);
+int guest_channel_send_msg(struct rte_power_channel_packet *pkt,
+		unsigned int lcore_id);
 
 
 
@@ -72,8 +73,8 @@ int guest_channel_send_msg(struct channel_packet *pkt, unsigned int lcore_id);
  * from the host endpoint.
  *
  * @param pkt
- *  Pointer to channel_packet or
- *  channel_packet_freq_list struct.
+ *  Pointer to rte_power_channel_packet or
+ *  rte_power_channel_packet_freq_list struct.
  *
  * @param pkt_len
  *  Size of expected data packet.
diff --git a/lib/librte_power/power_kvm_vm.c b/lib/librte_power/power_kvm_vm.c
index 649ebe85c..9ae438489 100644
--- a/lib/librte_power/power_kvm_vm.c
+++ b/lib/librte_power/power_kvm_vm.c
@@ -13,7 +13,7 @@
 
 #define FD_PATH "/dev/virtio-ports/virtio.serial.port.poweragent"
 
-static struct channel_packet pkt[RTE_MAX_LCORE];
+static struct rte_power_channel_packet pkt[RTE_MAX_LCORE];
 
 int
 power_kvm_vm_check_supported(void)
diff --git a/lib/librte_power/rte_power_guest_channel.h b/lib/librte_power/rte_power_guest_channel.h
index c500c0cda..c9ab7bae8 100644
--- a/lib/librte_power/rte_power_guest_channel.h
+++ b/lib/librte_power/rte_power_guest_channel.h
@@ -11,7 +11,10 @@ extern "C" {
 #include <stdint.h>
 #include <stdbool.h>
 
-/* --- Incoming messages --- */
+#define MAX_VFS 10
+#define VM_MAX_NAME_SZ 32
+#define MAX_VCPU_PER_VM         8
+#define HOURS 24
 
 /* Valid Commands */
 #define CPU_POWER               1
@@ -19,6 +22,9 @@ extern "C" {
 #define PKT_POLICY              3
 #define PKT_POLICY_REMOVE       4
 
+#define CORE_TYPE_VIRTUAL 0
+#define CORE_TYPE_PHYSICAL 1
+
 /* CPU Power Command Scaling */
 #define CPU_POWER_SCALE_UP      1
 #define CPU_POWER_SCALE_DOWN    2
@@ -43,41 +49,32 @@ extern "C" {
 #define CPU_POWER_FREQ_LIST     3
 #define CPU_POWER_CAPS_LIST     4
 
-#define HOURS 24
-
-#define MAX_VFS 10
-#define VM_MAX_NAME_SZ 32
-
-#define MAX_VCPU_PER_VM         8
-
-struct t_boost_status {
-	bool tbEnabled;
-};
-
-struct timer_profile {
+struct rte_power_timer_profile {
 	int busy_hours[HOURS];
 	int quiet_hours[HOURS];
 	int hours_to_use_traffic_profile[HOURS];
 };
 
-enum workload {HIGH, MEDIUM, LOW};
-enum policy_to_use {
+enum rte_power_workload_level {HIGH, MEDIUM, LOW};
+
+enum rte_power_policy {
 	TRAFFIC,
 	TIME,
 	WORKLOAD,
 	BRANCH_RATIO
 };
 
-struct traffic {
+struct rte_power_traffic_policy {
 	uint32_t min_packet_thresh;
 	uint32_t avg_max_packet_thresh;
 	uint32_t max_max_packet_thresh;
 };
 
-#define CORE_TYPE_VIRTUAL 0
-#define CORE_TYPE_PHYSICAL 1
+struct rte_power_turbo_status {
+	bool tbEnabled;
+};
 
-struct channel_packet {
+struct rte_power_channel_packet {
 	uint64_t resource_id; /**< core_num, device */
 	uint32_t unit;        /**< scale down/up/min/max */
 	uint32_t command;     /**< Power, IO, etc */
@@ -85,17 +82,17 @@ struct channel_packet {
 
 	uint64_t vfid[MAX_VFS];
 	int nb_mac_to_monitor;
-	struct traffic traffic_policy;
+	struct rte_power_traffic_policy traffic_policy;
 	uint8_t vcpu_to_control[MAX_VCPU_PER_VM];
 	uint8_t num_vcpu;
-	struct timer_profile timer_policy;
+	struct rte_power_timer_profile timer_policy;
 	bool core_type;
-	enum workload workload;
-	enum policy_to_use policy_to_use;
-	struct t_boost_status t_boost_status;
+	enum rte_power_workload_level workload;
+	enum rte_power_policy policy_to_use;
+	struct rte_power_turbo_status t_boost_status;
 };
 
-struct channel_packet_freq_list {
+struct rte_power_channel_packet_freq_list {
 	uint64_t resource_id; /**< core_num, device */
 	uint32_t unit;        /**< scale down/up/min/max */
 	uint32_t command;     /**< Power, IO, etc */
@@ -105,7 +102,7 @@ struct channel_packet_freq_list {
 	uint8_t num_vcpu;
 };
 
-struct channel_packet_caps_list {
+struct rte_power_channel_packet_caps_list {
 	uint64_t resource_id; /**< core_num, device */
 	uint32_t unit;        /**< scale down/up/min/max */
 	uint32_t command;     /**< Power, IO, etc */
@@ -135,7 +132,7 @@ struct channel_packet_caps_list {
  *  - Negative on error.
  */
 __rte_experimental
-int rte_power_guest_channel_send_msg(struct channel_packet *pkt,
+int rte_power_guest_channel_send_msg(struct rte_power_channel_packet *pkt,
 			unsigned int lcore_id);
 
 /**
diff --git a/lib/librte_power/version.map b/lib/librte_power/version.map
index 69ca9af61..13f0af3b2 100644
--- a/lib/librte_power/version.map
+++ b/lib/librte_power/version.map
@@ -34,4 +34,8 @@ EXPERIMENTAL {
 	rte_power_guest_channel_receive_msg;
 	rte_power_poll_stat_fetch;
 	rte_power_poll_stat_update;
+
+	# added in 21.02
+	rte_power_guest_channel_receive_msg;
+	rte_power_guest_channel_send_msg;
 };
-- 
2.17.1


^ permalink raw reply	[flat|nested] 69+ messages in thread

* [dpdk-dev] [PATCH v4 4/6] power: rename defines
  2021-01-21 17:21         ` [dpdk-dev] [PATCH v4 0/6] power: fix make build for power apps David Hunt
                             ` (2 preceding siblings ...)
  2021-01-21 17:21           ` [dpdk-dev] [PATCH v4 3/6] power: rename public structs David Hunt
@ 2021-01-21 17:21           ` David Hunt
  2021-01-22 13:50             ` Burakov, Anatoly
  2021-01-21 17:22           ` [dpdk-dev] [PATCH v4 5/6] power: add new header file to export list David Hunt
                             ` (3 subsequent siblings)
  7 siblings, 1 reply; 69+ messages in thread
From: David Hunt @ 2021-01-21 17:21 UTC (permalink / raw)
  To: dev; +Cc: david.hunt, stable, Bruce Richardson

From: Bruce Richardson <bruce.richardson@intel.com>

Rename the #defines to have an RTE_POWER_ prefix

Fixes: 210c383e247b ("power: packet format for vm power management")
Fixes: cd0d5547e873 ("power: vm communication channels in guest")
Cc: stable@dpdk.org

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: David Hunt <david.hunt@intel.com>
---
 examples/vm_power_manager/channel_monitor.c   | 116 +++++++++---------
 examples/vm_power_manager/channel_monitor.h   |   6 +-
 examples/vm_power_manager/guest_cli/main.c    |  29 +++--
 .../guest_cli/vm_power_cli_guest.c            |  28 ++---
 examples/vm_power_manager/main.c              |   2 +-
 lib/librte_power/guest_channel.c              |   2 +-
 lib/librte_power/power_kvm_vm.c               |  14 +--
 lib/librte_power/rte_power_guest_channel.h    |  98 +++++++--------
 8 files changed, 155 insertions(+), 140 deletions(-)

diff --git a/examples/vm_power_manager/channel_monitor.c b/examples/vm_power_manager/channel_monitor.c
index 1b6041b6f..7bb33e026 100644
--- a/examples/vm_power_manager/channel_monitor.c
+++ b/examples/vm_power_manager/channel_monitor.c
@@ -177,10 +177,10 @@ parse_json_to_pkt(json_t *element, struct rte_power_channel_packet *pkt,
 
 	pkt->nb_mac_to_monitor = 0;
 	pkt->t_boost_status.tbEnabled = false;
-	pkt->workload = LOW;
-	pkt->policy_to_use = TIME;
-	pkt->command = PKT_POLICY;
-	pkt->core_type = CORE_TYPE_PHYSICAL;
+	pkt->workload = RTE_POWER_WL_LOW;
+	pkt->policy_to_use = RTE_POWER_POLICY_TIME;
+	pkt->command = RTE_POWER_PKT_POLICY;
+	pkt->core_type = RTE_POWER_CORE_TYPE_PHYSICAL;
 
 	if (vm_name == NULL) {
 		RTE_LOG(ERR, CHANNEL_MONITOR,
@@ -203,11 +203,11 @@ parse_json_to_pkt(json_t *element, struct rte_power_channel_packet *pkt,
 			char command[32];
 			strlcpy(command, json_string_value(value), 32);
 			if (!strcmp(command, "power")) {
-				pkt->command = CPU_POWER;
+				pkt->command = RTE_POWER_CPU_POWER;
 			} else if (!strcmp(command, "create")) {
-				pkt->command = PKT_POLICY;
+				pkt->command = RTE_POWER_PKT_POLICY;
 			} else if (!strcmp(command, "destroy")) {
-				pkt->command = PKT_POLICY_REMOVE;
+				pkt->command = RTE_POWER_PKT_POLICY_REMOVE;
 			} else {
 				RTE_LOG(ERR, CHANNEL_MONITOR,
 					"Invalid command received in JSON\n");
@@ -217,13 +217,17 @@ parse_json_to_pkt(json_t *element, struct rte_power_channel_packet *pkt,
 			char command[32];
 			strlcpy(command, json_string_value(value), 32);
 			if (!strcmp(command, "TIME")) {
-				pkt->policy_to_use = TIME;
+				pkt->policy_to_use =
+						RTE_POWER_POLICY_TIME;
 			} else if (!strcmp(command, "TRAFFIC")) {
-				pkt->policy_to_use = TRAFFIC;
+				pkt->policy_to_use =
+						RTE_POWER_POLICY_TRAFFIC;
 			} else if (!strcmp(command, "WORKLOAD")) {
-				pkt->policy_to_use = WORKLOAD;
+				pkt->policy_to_use =
+						RTE_POWER_POLICY_WORKLOAD;
 			} else if (!strcmp(command, "BRANCH_RATIO")) {
-				pkt->policy_to_use = BRANCH_RATIO;
+				pkt->policy_to_use =
+						RTE_POWER_POLICY_BRANCH_RATIO;
 			} else {
 				RTE_LOG(ERR, CHANNEL_MONITOR,
 					"Wrong policy_type received in JSON\n");
@@ -233,11 +237,11 @@ parse_json_to_pkt(json_t *element, struct rte_power_channel_packet *pkt,
 			char command[32];
 			strlcpy(command, json_string_value(value), 32);
 			if (!strcmp(command, "HIGH")) {
-				pkt->workload = HIGH;
+				pkt->workload = RTE_POWER_WL_HIGH;
 			} else if (!strcmp(command, "MEDIUM")) {
-				pkt->workload = MEDIUM;
+				pkt->workload = RTE_POWER_WL_MEDIUM;
 			} else if (!strcmp(command, "LOW")) {
-				pkt->workload = LOW;
+				pkt->workload = RTE_POWER_WL_LOW;
 			} else {
 				RTE_LOG(ERR, CHANNEL_MONITOR,
 					"Wrong workload received in JSON\n");
@@ -283,17 +287,17 @@ parse_json_to_pkt(json_t *element, struct rte_power_channel_packet *pkt,
 			char unit[32];
 			strlcpy(unit, json_string_value(value), 32);
 			if (!strcmp(unit, "SCALE_UP")) {
-				pkt->unit = CPU_POWER_SCALE_UP;
+				pkt->unit = RTE_POWER_SCALE_UP;
 			} else if (!strcmp(unit, "SCALE_DOWN")) {
-				pkt->unit = CPU_POWER_SCALE_DOWN;
+				pkt->unit = RTE_POWER_SCALE_DOWN;
 			} else if (!strcmp(unit, "SCALE_MAX")) {
-				pkt->unit = CPU_POWER_SCALE_MAX;
+				pkt->unit = RTE_POWER_SCALE_MAX;
 			} else if (!strcmp(unit, "SCALE_MIN")) {
-				pkt->unit = CPU_POWER_SCALE_MIN;
+				pkt->unit = RTE_POWER_SCALE_MIN;
 			} else if (!strcmp(unit, "ENABLE_TURBO")) {
-				pkt->unit = CPU_POWER_ENABLE_TURBO;
+				pkt->unit = RTE_POWER_ENABLE_TURBO;
 			} else if (!strcmp(unit, "DISABLE_TURBO")) {
-				pkt->unit = CPU_POWER_DISABLE_TURBO;
+				pkt->unit = RTE_POWER_DISABLE_TURBO;
 			} else {
 				RTE_LOG(ERR, CHANNEL_MONITOR,
 					"Invalid command received in JSON\n");
@@ -312,7 +316,7 @@ parse_json_to_pkt(json_t *element, struct rte_power_channel_packet *pkt,
 				vm_name);
 			return -1;
 		}
-		strlcpy(pkt->vm_name, vm_name, VM_MAX_NAME_SZ);
+		strlcpy(pkt->vm_name, vm_name, RTE_POWER_VM_MAX_NAME_SZ);
 		pkt->resource_id = resource_id;
 	}
 	return 0;
@@ -367,7 +371,7 @@ pcpu_monitor(struct policy *pol, struct core_info *ci, int pcpu, int count)
 {
 	int ret = 0;
 
-	if (pol->pkt.policy_to_use == BRANCH_RATIO) {
+	if (pol->pkt.policy_to_use == RTE_POWER_POLICY_BRANCH_RATIO) {
 		ci->cd[pcpu].oob_enabled = 1;
 		ret = add_core_to_monitor(pcpu);
 		if (ret == 0)
@@ -407,7 +411,7 @@ get_pcpu_to_control(struct policy *pol)
 	 * differenciate between them when adding them to the branch monitor.
 	 * Virtual cores need to be converted to physical cores.
 	 */
-	if (pol->pkt.core_type == CORE_TYPE_VIRTUAL) {
+	if (pol->pkt.core_type == RTE_POWER_CORE_TYPE_VIRTUAL) {
 		/*
 		 * If the cores in the policy are virtual, we need to map them
 		 * to physical core. We look up the vm info and use that for
@@ -479,7 +483,8 @@ update_policy(struct rte_power_channel_packet *pkt)
 			policies[i].pkt = *pkt;
 			get_pcpu_to_control(&policies[i]);
 			/* Check Eth dev only for Traffic policy */
-			if (policies[i].pkt.policy_to_use == TRAFFIC) {
+			if (policies[i].pkt.policy_to_use ==
+					RTE_POWER_POLICY_TRAFFIC) {
 				if (get_pfid(&policies[i]) < 0) {
 					updated = 1;
 					break;
@@ -496,7 +501,8 @@ update_policy(struct rte_power_channel_packet *pkt)
 				policies[i].pkt = *pkt;
 				get_pcpu_to_control(&policies[i]);
 				/* Check Eth dev only for Traffic policy */
-				if (policies[i].pkt.policy_to_use == TRAFFIC) {
+				if (policies[i].pkt.policy_to_use ==
+						RTE_POWER_POLICY_TRAFFIC) {
 					if (get_pfid(&policies[i]) < 0) {
 						updated = 1;
 						break;
@@ -615,7 +621,7 @@ apply_time_profile(struct policy *pol)
 	/* Format the date and time, down to a single second. */
 	strftime(time_string, sizeof(time_string), "%Y-%m-%d %H:%M:%S", ptm);
 
-	for (x = 0; x < HOURS; x++) {
+	for (x = 0; x < RTE_POWER_HOURS_PER_DAY; x++) {
 
 		if (ptm->tm_hour == pol->pkt.timer_policy.busy_hours[x]) {
 			for (count = 0; count < pol->pkt.num_vcpu; count++) {
@@ -648,19 +654,19 @@ apply_workload_profile(struct policy *pol)
 
 	int count;
 
-	if (pol->pkt.workload == HIGH) {
+	if (pol->pkt.workload == RTE_POWER_WL_HIGH) {
 		for (count = 0; count < pol->pkt.num_vcpu; count++) {
 			if (pol->core_share[count].status != 1)
 				power_manager_scale_core_max(
 						pol->core_share[count].pcpu);
 		}
-	} else if (pol->pkt.workload == MEDIUM) {
+	} else if (pol->pkt.workload == RTE_POWER_WL_MEDIUM) {
 		for (count = 0; count < pol->pkt.num_vcpu; count++) {
 			if (pol->core_share[count].status != 1)
 				power_manager_scale_core_med(
 						pol->core_share[count].pcpu);
 		}
-	} else if (pol->pkt.workload == LOW) {
+	} else if (pol->pkt.workload == RTE_POWER_WL_LOW) {
 		for (count = 0; count < pol->pkt.num_vcpu; count++) {
 			if (pol->core_share[count].status != 1)
 				power_manager_scale_core_min(
@@ -676,11 +682,11 @@ apply_policy(struct policy *pol)
 	struct rte_power_channel_packet *pkt = &pol->pkt;
 
 	/*Check policy to use*/
-	if (pkt->policy_to_use == TRAFFIC)
+	if (pkt->policy_to_use == RTE_POWER_POLICY_TRAFFIC)
 		apply_traffic_profile(pol);
-	else if (pkt->policy_to_use == TIME)
+	else if (pkt->policy_to_use == RTE_POWER_POLICY_TIME)
 		apply_time_profile(pol);
-	else if (pkt->policy_to_use == WORKLOAD)
+	else if (pkt->policy_to_use == RTE_POWER_POLICY_WORKLOAD)
 		apply_workload_profile(pol);
 }
 
@@ -726,13 +732,13 @@ send_freq(struct rte_power_channel_packet *pkt,
 	if (get_info_vm(pkt->vm_name, &info) != 0)
 		return -1;
 
-	if (!freq_list && vcore_id >= MAX_VCPU_PER_VM)
+	if (!freq_list && vcore_id >= RTE_POWER_MAX_VCPU_PER_VM)
 		return -1;
 
 	if (!info.allow_query)
 		return -1;
 
-	channel_pkt_freq_list.command = CPU_POWER_FREQ_LIST;
+	channel_pkt_freq_list.command = RTE_POWER_FREQ_LIST;
 	channel_pkt_freq_list.num_vcpu = info.num_vcpus;
 
 	if (freq_list) {
@@ -764,13 +770,13 @@ send_capabilities(struct rte_power_channel_packet *pkt,
 	if (get_info_vm(pkt->vm_name, &info) != 0)
 		return -1;
 
-	if (!list_requested && vcore_id >= MAX_VCPU_PER_VM)
+	if (!list_requested && vcore_id >= RTE_POWER_MAX_VCPU_PER_VM)
 		return -1;
 
 	if (!info.allow_query)
 		return -1;
 
-	channel_pkt_caps_list.command = CPU_POWER_CAPS_LIST;
+	channel_pkt_caps_list.command = RTE_POWER_CAPS_LIST;
 	channel_pkt_caps_list.num_vcpu = info.num_vcpus;
 
 	if (list_requested) {
@@ -828,10 +834,10 @@ process_request(struct rte_power_channel_packet *pkt,
 			CHANNEL_MGR_CHANNEL_PROCESSING) == 0)
 		return -1;
 
-	if (pkt->command == CPU_POWER) {
+	if (pkt->command == RTE_POWER_CPU_POWER) {
 		unsigned int core_num;
 
-		if (pkt->core_type == CORE_TYPE_VIRTUAL)
+		if (pkt->core_type == RTE_POWER_CORE_TYPE_VIRTUAL)
 			core_num = get_pcpu(chan_info, pkt->resource_id);
 		else
 			core_num = pkt->resource_id;
@@ -843,22 +849,22 @@ process_request(struct rte_power_channel_packet *pkt,
 		bool valid_unit = true;
 
 		switch (pkt->unit) {
-		case(CPU_POWER_SCALE_MIN):
+		case(RTE_POWER_SCALE_MIN):
 			scale_res = power_manager_scale_core_min(core_num);
 			break;
-		case(CPU_POWER_SCALE_MAX):
+		case(RTE_POWER_SCALE_MAX):
 			scale_res = power_manager_scale_core_max(core_num);
 			break;
-		case(CPU_POWER_SCALE_DOWN):
+		case(RTE_POWER_SCALE_DOWN):
 			scale_res = power_manager_scale_core_down(core_num);
 			break;
-		case(CPU_POWER_SCALE_UP):
+		case(RTE_POWER_SCALE_UP):
 			scale_res = power_manager_scale_core_up(core_num);
 			break;
-		case(CPU_POWER_ENABLE_TURBO):
+		case(RTE_POWER_ENABLE_TURBO):
 			scale_res = power_manager_enable_turbo_core(core_num);
 			break;
-		case(CPU_POWER_DISABLE_TURBO):
+		case(RTE_POWER_DISABLE_TURBO):
 			scale_res = power_manager_disable_turbo_core(core_num);
 			break;
 		default:
@@ -870,8 +876,8 @@ process_request(struct rte_power_channel_packet *pkt,
 			ret = send_ack_for_received_cmd(pkt,
 					chan_info,
 					scale_res >= 0 ?
-						CPU_POWER_CMD_ACK :
-						CPU_POWER_CMD_NACK);
+						RTE_POWER_CMD_ACK :
+						RTE_POWER_CMD_NACK);
 			if (ret < 0)
 				RTE_LOG(ERR, CHANNEL_MONITOR, "Error during sending ack command.\n");
 		} else
@@ -879,19 +885,19 @@ process_request(struct rte_power_channel_packet *pkt,
 
 	}
 
-	if (pkt->command == PKT_POLICY) {
+	if (pkt->command == RTE_POWER_PKT_POLICY) {
 		RTE_LOG(INFO, CHANNEL_MONITOR, "Processing policy request %s\n",
 				pkt->vm_name);
 		int ret = send_ack_for_received_cmd(pkt,
 				chan_info,
-				CPU_POWER_CMD_ACK);
+				RTE_POWER_CMD_ACK);
 		if (ret < 0)
 			RTE_LOG(ERR, CHANNEL_MONITOR, "Error during sending ack command.\n");
 		update_policy(pkt);
 		policy_is_set = 1;
 	}
 
-	if (pkt->command == PKT_POLICY_REMOVE) {
+	if (pkt->command == RTE_POWER_PKT_POLICY_REMOVE) {
 		ret = remove_policy(pkt);
 		if (ret == 0)
 			RTE_LOG(INFO, CHANNEL_MONITOR,
@@ -901,26 +907,26 @@ process_request(struct rte_power_channel_packet *pkt,
 				 "Policy %s does not exist\n", pkt->vm_name);
 	}
 
-	if (pkt->command == CPU_POWER_QUERY_FREQ_LIST ||
-		pkt->command == CPU_POWER_QUERY_FREQ) {
+	if (pkt->command == RTE_POWER_QUERY_FREQ_LIST ||
+		pkt->command == RTE_POWER_QUERY_FREQ) {
 
 		RTE_LOG(INFO, CHANNEL_MONITOR,
 			"Frequency for %s requested.\n", pkt->vm_name);
 		int ret = send_freq(pkt,
 				chan_info,
-				pkt->command == CPU_POWER_QUERY_FREQ_LIST);
+				pkt->command == RTE_POWER_QUERY_FREQ_LIST);
 		if (ret < 0)
 			RTE_LOG(ERR, CHANNEL_MONITOR, "Error during frequency sending.\n");
 	}
 
-	if (pkt->command == CPU_POWER_QUERY_CAPS_LIST ||
-		pkt->command == CPU_POWER_QUERY_CAPS) {
+	if (pkt->command == RTE_POWER_QUERY_CAPS_LIST ||
+		pkt->command == RTE_POWER_QUERY_CAPS) {
 
 		RTE_LOG(INFO, CHANNEL_MONITOR,
 			"Capabilities for %s requested.\n", pkt->vm_name);
 		int ret = send_capabilities(pkt,
 				chan_info,
-				pkt->command == CPU_POWER_QUERY_CAPS_LIST);
+				pkt->command == RTE_POWER_QUERY_CAPS_LIST);
 		if (ret < 0)
 			RTE_LOG(ERR, CHANNEL_MONITOR, "Error during sending capabilities.\n");
 	}
diff --git a/examples/vm_power_manager/channel_monitor.h b/examples/vm_power_manager/channel_monitor.h
index 0ca6207ad..5d3537b91 100644
--- a/examples/vm_power_manager/channel_monitor.h
+++ b/examples/vm_power_manager/channel_monitor.h
@@ -19,10 +19,10 @@ struct core_share {
 
 struct policy {
 	struct rte_power_channel_packet pkt;
-	uint32_t pfid[MAX_VFS];
-	uint32_t port[MAX_VFS];
+	uint32_t pfid[RTE_POWER_MAX_VFS];
+	uint32_t port[RTE_POWER_MAX_VFS];
 	unsigned int enabled;
-	struct core_share core_share[MAX_VCPU_PER_VM];
+	struct core_share core_share[RTE_POWER_MAX_VCPU_PER_VM];
 };
 
 #ifdef __cplusplus
diff --git a/examples/vm_power_manager/guest_cli/main.c b/examples/vm_power_manager/guest_cli/main.c
index fc7a8c30a..4e17f7fb9 100644
--- a/examples/vm_power_manager/guest_cli/main.c
+++ b/examples/vm_power_manager/guest_cli/main.c
@@ -50,8 +50,8 @@ parse_args(int argc, char **argv)
 	};
 	struct rte_power_channel_packet *policy;
 	unsigned short int hours[MAX_HOURS];
-	unsigned short int cores[MAX_VCPU_PER_VM];
-	unsigned short int ports[MAX_VCPU_PER_VM];
+	unsigned short int cores[RTE_POWER_MAX_VCPU_PER_VM];
+	unsigned short int ports[RTE_POWER_MAX_VCPU_PER_VM];
 	int i, cnt, idx;
 
 	policy = get_policy();
@@ -69,7 +69,8 @@ parse_args(int argc, char **argv)
 		switch (opt) {
 		/* portmask */
 		case 'n':
-			strlcpy(policy->vm_name, optarg, VM_MAX_NAME_SZ);
+			strlcpy(policy->vm_name, optarg,
+					RTE_POWER_VM_MAX_NAME_SZ);
 			printf("Setting VM Name to [%s]\n", policy->vm_name);
 			break;
 		case 'b':
@@ -97,14 +98,15 @@ parse_args(int argc, char **argv)
 			}
 			break;
 		case 'l':
-			cnt = parse_set(optarg, cores, MAX_VCPU_PER_VM);
+			cnt = parse_set(optarg, cores,
+					RTE_POWER_MAX_VCPU_PER_VM);
 			if (cnt < 0) {
 				printf("Invalid value passed to vcpu-list - [%s]\n",
 						optarg);
 				break;
 			}
 			idx = 0;
-			for (i = 0; i < MAX_VCPU_PER_VM; i++) {
+			for (i = 0; i < RTE_POWER_MAX_VCPU_PER_VM; i++) {
 				if (cores[i]) {
 					printf("***Using core %d\n", i);
 					policy->vcpu_to_control[idx++] = i;
@@ -114,14 +116,15 @@ parse_args(int argc, char **argv)
 			printf("Total cores: %d\n", idx);
 			break;
 		case 'p':
-			cnt = parse_set(optarg, ports, MAX_VCPU_PER_VM);
+			cnt = parse_set(optarg, ports,
+					RTE_POWER_MAX_VCPU_PER_VM);
 			if (cnt < 0) {
 				printf("Invalid value passed to port-list - [%s]\n",
 						optarg);
 				break;
 			}
 			idx = 0;
-			for (i = 0; i < MAX_VCPU_PER_VM; i++) {
+			for (i = 0; i < RTE_POWER_MAX_VCPU_PER_VM; i++) {
 				if (ports[i]) {
 					printf("***Using port %d\n", i);
 					if (set_policy_mac(i, idx++) != 0) {
@@ -135,13 +138,17 @@ parse_args(int argc, char **argv)
 			break;
 		case 'o':
 			if (!strcmp(optarg, "TRAFFIC"))
-				policy->policy_to_use = TRAFFIC;
+				policy->policy_to_use =
+						RTE_POWER_POLICY_TRAFFIC;
 			else if (!strcmp(optarg, "TIME"))
-				policy->policy_to_use = TIME;
+				policy->policy_to_use =
+						RTE_POWER_POLICY_TIME;
 			else if (!strcmp(optarg, "WORKLOAD"))
-				policy->policy_to_use = WORKLOAD;
+				policy->policy_to_use =
+						RTE_POWER_POLICY_WORKLOAD;
 			else if (!strcmp(optarg, "BRANCH_RATIO"))
-				policy->policy_to_use = BRANCH_RATIO;
+				policy->policy_to_use =
+						RTE_POWER_POLICY_BRANCH_RATIO;
 			else {
 				printf("Invalid policy specified: %s\n",
 						optarg);
diff --git a/examples/vm_power_manager/guest_cli/vm_power_cli_guest.c b/examples/vm_power_manager/guest_cli/vm_power_cli_guest.c
index 125dfeb10..ec6409abd 100644
--- a/examples/vm_power_manager/guest_cli/vm_power_cli_guest.c
+++ b/examples/vm_power_manager/guest_cli/vm_power_cli_guest.c
@@ -103,10 +103,10 @@ set_policy_defaults(struct rte_power_channel_packet *pkt)
 	pkt->timer_policy.hours_to_use_traffic_profile[0] = 8;
 	pkt->timer_policy.hours_to_use_traffic_profile[1] = 10;
 
-	pkt->core_type = CORE_TYPE_VIRTUAL;
-	pkt->workload = LOW;
-	pkt->policy_to_use = TIME;
-	pkt->command = PKT_POLICY;
+	pkt->core_type = RTE_POWER_CORE_TYPE_VIRTUAL;
+	pkt->workload = RTE_POWER_WL_LOW;
+	pkt->policy_to_use = RTE_POWER_POLICY_TIME;
+	pkt->command = RTE_POWER_PKT_POLICY;
 	strlcpy(pkt->vm_name, "ubuntu2", sizeof(pkt->vm_name));
 
 	return 0;
@@ -169,7 +169,7 @@ receive_freq_list(struct rte_power_channel_packet_freq_list *pkt_freq_list,
 		RTE_LOG(ERR, GUEST_CLI, "Error receiving message.\n");
 		return -1;
 	}
-	if (pkt_freq_list->command != CPU_POWER_FREQ_LIST) {
+	if (pkt_freq_list->command != RTE_POWER_FREQ_LIST) {
 		RTE_LOG(ERR, GUEST_CLI, "Unexpected message received.\n");
 		return -1;
 	}
@@ -203,18 +203,18 @@ cmd_query_freq_list_parsed(void *parsed_result,
 			return;
 		}
 
-		pkt.command = CPU_POWER_QUERY_FREQ_LIST;
+		pkt.command = RTE_POWER_QUERY_FREQ_LIST;
 		strlcpy(pkt.vm_name, policy.vm_name, sizeof(pkt.vm_name));
 		query_list = true;
 	} else {
 		errno = 0;
 		lcore_id = (unsigned int)strtol(res->cpu_num, &ep, 10);
-		if (errno != 0 || lcore_id >= MAX_VCPU_PER_VM ||
+		if (errno != 0 || lcore_id >= RTE_POWER_MAX_VCPU_PER_VM ||
 			ep == res->cpu_num) {
 			cmdline_printf(cl, "Invalid parameter provided.\n");
 			return;
 		}
-		pkt.command = CPU_POWER_QUERY_FREQ;
+		pkt.command = RTE_POWER_QUERY_FREQ;
 		strlcpy(pkt.vm_name, policy.vm_name, sizeof(pkt.vm_name));
 		pkt.resource_id = lcore_id;
 	}
@@ -279,7 +279,7 @@ receive_capabilities(struct rte_power_channel_packet_caps_list *pkt_caps_list,
 		RTE_LOG(ERR, GUEST_CLI, "Error receiving message.\n");
 		return -1;
 	}
-	if (pkt_caps_list->command != CPU_POWER_CAPS_LIST) {
+	if (pkt_caps_list->command != RTE_POWER_CAPS_LIST) {
 		RTE_LOG(ERR, GUEST_CLI, "Unexpected message received.\n");
 		return -1;
 	}
@@ -313,18 +313,18 @@ cmd_query_caps_list_parsed(void *parsed_result,
 			return;
 		}
 
-		pkt.command = CPU_POWER_QUERY_CAPS_LIST;
+		pkt.command = RTE_POWER_QUERY_CAPS_LIST;
 		strlcpy(pkt.vm_name, policy.vm_name, sizeof(pkt.vm_name));
 		query_list = true;
 	} else {
 		errno = 0;
 		lcore_id = (unsigned int)strtol(res->cpu_num, &ep, 10);
-		if (errno != 0 || lcore_id >= MAX_VCPU_PER_VM ||
+		if (errno != 0 || lcore_id >= RTE_POWER_MAX_VCPU_PER_VM ||
 			ep == res->cpu_num) {
 			cmdline_printf(cl, "Invalid parameter provided.\n");
 			return;
 		}
-		pkt.command = CPU_POWER_QUERY_CAPS;
+		pkt.command = RTE_POWER_QUERY_CAPS;
 		strlcpy(pkt.vm_name, policy.vm_name, sizeof(pkt.vm_name));
 		pkt.resource_id = lcore_id;
 	}
@@ -388,10 +388,10 @@ check_response_cmd(unsigned int lcore_id, int *result)
 		return -1;
 
 	switch (pkt.command) {
-	case(CPU_POWER_CMD_ACK):
+	case(RTE_POWER_CMD_ACK):
 		*result = 1;
 		break;
-	case(CPU_POWER_CMD_NACK):
+	case(RTE_POWER_CMD_NACK):
 		*result = 0;
 		break;
 	default:
diff --git a/examples/vm_power_manager/main.c b/examples/vm_power_manager/main.c
index 75d5b5364..799d7b9bc 100644
--- a/examples/vm_power_manager/main.c
+++ b/examples/vm_power_manager/main.c
@@ -394,7 +394,7 @@ main(int argc, char **argv)
 					"Cannot init port %"PRIu8 "\n",
 					portid);
 
-			for (w = 0; w < MAX_VFS; w++) {
+			for (w = 0; w < RTE_POWER_MAX_VFS; w++) {
 				eth.addr_bytes[5] = w + 0xf0;
 
 				ret = -ENOTSUP;
diff --git a/lib/librte_power/guest_channel.c b/lib/librte_power/guest_channel.c
index 9eb2f6330..039cb1872 100644
--- a/lib/librte_power/guest_channel.c
+++ b/lib/librte_power/guest_channel.c
@@ -100,7 +100,7 @@ guest_channel_host_connect(const char *path, unsigned int lcore_id)
 	/* Send a test packet, this command is ignored by the host, but a successful
 	 * send indicates that the host endpoint is monitoring.
 	 */
-	pkt.command = CPU_POWER_CONNECT;
+	pkt.command = RTE_POWER_CPU_POWER_CONNECT;
 	global_fds[lcore_id] = fd;
 	ret = guest_channel_send_msg(&pkt, lcore_id);
 	if (ret != 0) {
diff --git a/lib/librte_power/power_kvm_vm.c b/lib/librte_power/power_kvm_vm.c
index 9ae438489..27f9937aa 100644
--- a/lib/librte_power/power_kvm_vm.c
+++ b/lib/librte_power/power_kvm_vm.c
@@ -29,7 +29,7 @@ power_kvm_vm_init(unsigned int lcore_id)
 				lcore_id, RTE_MAX_LCORE-1);
 		return -1;
 	}
-	pkt[lcore_id].command = CPU_POWER;
+	pkt[lcore_id].command = RTE_POWER_CPU_POWER;
 	pkt[lcore_id].resource_id = lcore_id;
 	return guest_channel_host_connect(FD_PATH, lcore_id);
 }
@@ -90,25 +90,25 @@ send_msg(unsigned int lcore_id, uint32_t scale_direction)
 int
 power_kvm_vm_freq_up(unsigned int lcore_id)
 {
-	return send_msg(lcore_id, CPU_POWER_SCALE_UP);
+	return send_msg(lcore_id, RTE_POWER_SCALE_UP);
 }
 
 int
 power_kvm_vm_freq_down(unsigned int lcore_id)
 {
-	return send_msg(lcore_id, CPU_POWER_SCALE_DOWN);
+	return send_msg(lcore_id, RTE_POWER_SCALE_DOWN);
 }
 
 int
 power_kvm_vm_freq_max(unsigned int lcore_id)
 {
-	return send_msg(lcore_id, CPU_POWER_SCALE_MAX);
+	return send_msg(lcore_id, RTE_POWER_SCALE_MAX);
 }
 
 int
 power_kvm_vm_freq_min(unsigned int lcore_id)
 {
-	return send_msg(lcore_id, CPU_POWER_SCALE_MIN);
+	return send_msg(lcore_id, RTE_POWER_SCALE_MIN);
 }
 
 int
@@ -121,13 +121,13 @@ power_kvm_vm_turbo_status(__rte_unused unsigned int lcore_id)
 int
 power_kvm_vm_enable_turbo(unsigned int lcore_id)
 {
-	return send_msg(lcore_id, CPU_POWER_ENABLE_TURBO);
+	return send_msg(lcore_id, RTE_POWER_ENABLE_TURBO);
 }
 
 int
 power_kvm_vm_disable_turbo(unsigned int lcore_id)
 {
-	return send_msg(lcore_id, CPU_POWER_DISABLE_TURBO);
+	return send_msg(lcore_id, RTE_POWER_DISABLE_TURBO);
 }
 
 struct rte_power_core_capabilities;
diff --git a/lib/librte_power/rte_power_guest_channel.h b/lib/librte_power/rte_power_guest_channel.h
index c9ab7bae8..b9273a025 100644
--- a/lib/librte_power/rte_power_guest_channel.h
+++ b/lib/librte_power/rte_power_guest_channel.h
@@ -11,63 +11,65 @@ extern "C" {
 #include <stdint.h>
 #include <stdbool.h>
 
-#define MAX_VFS 10
-#define VM_MAX_NAME_SZ 32
-#define MAX_VCPU_PER_VM         8
-#define HOURS 24
+#define RTE_POWER_MAX_VFS 10
+#define RTE_POWER_VM_MAX_NAME_SZ 32
+#define RTE_POWER_MAX_VCPU_PER_VM 8
+#define RTE_POWER_HOURS_PER_DAY 24
 
 /* Valid Commands */
-#define CPU_POWER               1
-#define CPU_POWER_CONNECT       2
-#define PKT_POLICY              3
-#define PKT_POLICY_REMOVE       4
+#define RTE_POWER_CPU_POWER               1
+#define RTE_POWER_CPU_POWER_CONNECT       2
+#define RTE_POWER_PKT_POLICY              3
+#define RTE_POWER_PKT_POLICY_REMOVE       4
 
-#define CORE_TYPE_VIRTUAL 0
-#define CORE_TYPE_PHYSICAL 1
+#define RTE_POWER_CORE_TYPE_VIRTUAL 0
+#define RTE_POWER_CORE_TYPE_PHYSICAL 1
 
 /* CPU Power Command Scaling */
-#define CPU_POWER_SCALE_UP      1
-#define CPU_POWER_SCALE_DOWN    2
-#define CPU_POWER_SCALE_MAX     3
-#define CPU_POWER_SCALE_MIN     4
-#define CPU_POWER_ENABLE_TURBO  5
-#define CPU_POWER_DISABLE_TURBO 6
+#define RTE_POWER_SCALE_UP      1
+#define RTE_POWER_SCALE_DOWN    2
+#define RTE_POWER_SCALE_MAX     3
+#define RTE_POWER_SCALE_MIN     4
+#define RTE_POWER_ENABLE_TURBO  5
+#define RTE_POWER_DISABLE_TURBO 6
 
 /* CPU Power Queries */
-#define CPU_POWER_QUERY_FREQ_LIST  7
-#define CPU_POWER_QUERY_FREQ       8
-#define CPU_POWER_QUERY_CAPS_LIST  9
-#define CPU_POWER_QUERY_CAPS       10
-
-/* --- Outgoing messages --- */
+#define RTE_POWER_QUERY_FREQ_LIST  7
+#define RTE_POWER_QUERY_FREQ       8
+#define RTE_POWER_QUERY_CAPS_LIST  9
+#define RTE_POWER_QUERY_CAPS       10
 
 /* Generic Power Command Response */
-#define CPU_POWER_CMD_ACK       1
-#define CPU_POWER_CMD_NACK      2
+#define RTE_POWER_CMD_ACK       1
+#define RTE_POWER_CMD_NACK      2
 
 /* CPU Power Query Responses */
-#define CPU_POWER_FREQ_LIST     3
-#define CPU_POWER_CAPS_LIST     4
+#define RTE_POWER_FREQ_LIST     3
+#define RTE_POWER_CAPS_LIST     4
 
-struct rte_power_timer_profile {
-	int busy_hours[HOURS];
-	int quiet_hours[HOURS];
-	int hours_to_use_traffic_profile[HOURS];
+struct rte_power_traffic_policy {
+	uint32_t min_packet_thresh;
+	uint32_t avg_max_packet_thresh;
+	uint32_t max_max_packet_thresh;
 };
 
-enum rte_power_workload_level {HIGH, MEDIUM, LOW};
+struct rte_power_timer_profile {
+	int busy_hours[RTE_POWER_HOURS_PER_DAY];
+	int quiet_hours[RTE_POWER_HOURS_PER_DAY];
+	int hours_to_use_traffic_profile[RTE_POWER_HOURS_PER_DAY];
+};
 
-enum rte_power_policy {
-	TRAFFIC,
-	TIME,
-	WORKLOAD,
-	BRANCH_RATIO
+enum rte_power_workload_level {
+	RTE_POWER_WL_HIGH,
+	RTE_POWER_WL_MEDIUM,
+	RTE_POWER_WL_LOW
 };
 
-struct rte_power_traffic_policy {
-	uint32_t min_packet_thresh;
-	uint32_t avg_max_packet_thresh;
-	uint32_t max_max_packet_thresh;
+enum rte_power_policy {
+	RTE_POWER_POLICY_TRAFFIC,
+	RTE_POWER_POLICY_TIME,
+	RTE_POWER_POLICY_WORKLOAD,
+	RTE_POWER_POLICY_BRANCH_RATIO
 };
 
 struct rte_power_turbo_status {
@@ -78,12 +80,12 @@ struct rte_power_channel_packet {
 	uint64_t resource_id; /**< core_num, device */
 	uint32_t unit;        /**< scale down/up/min/max */
 	uint32_t command;     /**< Power, IO, etc */
-	char vm_name[VM_MAX_NAME_SZ];
+	char vm_name[RTE_POWER_VM_MAX_NAME_SZ];
 
-	uint64_t vfid[MAX_VFS];
+	uint64_t vfid[RTE_POWER_MAX_VFS];
 	int nb_mac_to_monitor;
 	struct rte_power_traffic_policy traffic_policy;
-	uint8_t vcpu_to_control[MAX_VCPU_PER_VM];
+	uint8_t vcpu_to_control[RTE_POWER_MAX_VCPU_PER_VM];
 	uint8_t num_vcpu;
 	struct rte_power_timer_profile timer_policy;
 	bool core_type;
@@ -96,9 +98,9 @@ struct rte_power_channel_packet_freq_list {
 	uint64_t resource_id; /**< core_num, device */
 	uint32_t unit;        /**< scale down/up/min/max */
 	uint32_t command;     /**< Power, IO, etc */
-	char vm_name[VM_MAX_NAME_SZ];
+	char vm_name[RTE_POWER_VM_MAX_NAME_SZ];
 
-	uint32_t freq_list[MAX_VCPU_PER_VM];
+	uint32_t freq_list[RTE_POWER_MAX_VCPU_PER_VM];
 	uint8_t num_vcpu;
 };
 
@@ -106,10 +108,10 @@ struct rte_power_channel_packet_caps_list {
 	uint64_t resource_id; /**< core_num, device */
 	uint32_t unit;        /**< scale down/up/min/max */
 	uint32_t command;     /**< Power, IO, etc */
-	char vm_name[VM_MAX_NAME_SZ];
+	char vm_name[RTE_POWER_VM_MAX_NAME_SZ];
 
-	uint64_t turbo[MAX_VCPU_PER_VM];
-	uint64_t priority[MAX_VCPU_PER_VM];
+	uint64_t turbo[RTE_POWER_MAX_VCPU_PER_VM];
+	uint64_t priority[RTE_POWER_MAX_VCPU_PER_VM];
 	uint8_t num_vcpu;
 };
 
-- 
2.17.1


^ permalink raw reply	[flat|nested] 69+ messages in thread

* [dpdk-dev] [PATCH v4 5/6] power: add new header file to export list
  2021-01-21 17:21         ` [dpdk-dev] [PATCH v4 0/6] power: fix make build for power apps David Hunt
                             ` (3 preceding siblings ...)
  2021-01-21 17:21           ` [dpdk-dev] [PATCH v4 4/6] power: rename defines David Hunt
@ 2021-01-21 17:22           ` David Hunt
  2021-01-22 13:51             ` Burakov, Anatoly
  2021-01-21 17:22           ` [dpdk-dev] [PATCH v4 6/6] power: clean up includes David Hunt
                             ` (2 subsequent siblings)
  7 siblings, 1 reply; 69+ messages in thread
From: David Hunt @ 2021-01-21 17:22 UTC (permalink / raw)
  To: dev; +Cc: david.hunt, stable, Bruce Richardson

From: Bruce Richardson <bruce.richardson@intel.com>

Adjust meson.build so that 'ninja install' copies the new header
file into the installation directory.

Fixes: 210c383e247b ("power: packet format for vm power management")
Fixes: cd0d5547e873 ("power: vm communication channels in guest")
Cc: stable@dpdk.org

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: David Hunt <david.hunt@intel.com>
---
 lib/librte_power/meson.build | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/librte_power/meson.build b/lib/librte_power/meson.build
index 4b4cf1b90..541569528 100644
--- a/lib/librte_power/meson.build
+++ b/lib/librte_power/meson.build
@@ -10,5 +10,6 @@ sources = files('rte_power.c', 'power_acpi_cpufreq.c',
 		'rte_power_empty_poll.c',
 		'power_pstate_cpufreq.c',
 		'power_common.c')
-headers = files('rte_power.h','rte_power_empty_poll.h')
+headers = files('rte_power.h','rte_power_empty_poll.h',
+	'rte_power_guest_channel.h')
 deps += ['timer']
-- 
2.17.1


^ permalink raw reply	[flat|nested] 69+ messages in thread

* [dpdk-dev] [PATCH v4 6/6] power: clean up includes
  2021-01-21 17:21         ` [dpdk-dev] [PATCH v4 0/6] power: fix make build for power apps David Hunt
                             ` (4 preceding siblings ...)
  2021-01-21 17:22           ` [dpdk-dev] [PATCH v4 5/6] power: add new header file to export list David Hunt
@ 2021-01-21 17:22           ` David Hunt
  2021-01-22 13:53             ` Burakov, Anatoly
  2021-01-29 10:27           ` [dpdk-dev] [dpdk-stable] [PATCH v4 0/6] power: fix make build for power apps Thomas Monjalon
  2021-02-24 14:54           ` [dpdk-dev] [PATCH] power: remove duplicated symbols from map file Ferruh Yigit
  7 siblings, 1 reply; 69+ messages in thread
From: David Hunt @ 2021-01-21 17:22 UTC (permalink / raw)
  To: dev; +Cc: david.hunt, stable, Bruce Richardson

From: Bruce Richardson <bruce.richardson@intel.com>

re-organise the including of the new public header file and
remove un-needed includes

Fixes: 210c383e247b ("power: packet format for vm power management")
Fixes: cd0d5547e873 ("power: vm communication channels in guest")
Cc: stable@dpdk.org

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: David Hunt <david.hunt@intel.com>
---
 examples/vm_power_manager/channel_manager.c              | 1 -
 examples/vm_power_manager/channel_monitor.c              | 1 -
 examples/vm_power_manager/channel_monitor.h              | 2 +-
 examples/vm_power_manager/guest_cli/vm_power_cli_guest.c | 1 -
 examples/vm_power_manager/guest_cli/vm_power_cli_guest.h | 2 --
 examples/vm_power_manager/vm_power_cli.c                 | 1 -
 lib/librte_power/guest_channel.c                         | 2 +-
 lib/librte_power/guest_channel.h                         | 2 --
 lib/librte_power/power_kvm_vm.c                          | 2 +-
 lib/librte_power/rte_power.h                             | 1 +
 lib/librte_power/rte_power_guest_channel.h               | 3 ---
 11 files changed, 4 insertions(+), 14 deletions(-)

diff --git a/examples/vm_power_manager/channel_manager.c b/examples/vm_power_manager/channel_manager.c
index c7d5bf5a8..0a28cb643 100644
--- a/examples/vm_power_manager/channel_manager.c
+++ b/examples/vm_power_manager/channel_manager.c
@@ -27,7 +27,6 @@
 #include <libvirt/libvirt.h>
 
 #include "channel_manager.h"
-#include "rte_power_guest_channel.h"
 #include "channel_monitor.h"
 #include "power_manager.h"
 
diff --git a/examples/vm_power_manager/channel_monitor.c b/examples/vm_power_manager/channel_monitor.c
index 7bb33e026..99f81544d 100644
--- a/examples/vm_power_manager/channel_monitor.c
+++ b/examples/vm_power_manager/channel_monitor.c
@@ -35,7 +35,6 @@
 
 #include <libvirt/libvirt.h>
 #include "channel_monitor.h"
-#include "rte_power_guest_channel.h"
 #include "channel_manager.h"
 #include "power_manager.h"
 #include "oob_monitor.h"
diff --git a/examples/vm_power_manager/channel_monitor.h b/examples/vm_power_manager/channel_monitor.h
index 5d3537b91..9184a8327 100644
--- a/examples/vm_power_manager/channel_monitor.h
+++ b/examples/vm_power_manager/channel_monitor.h
@@ -5,8 +5,8 @@
 #ifndef CHANNEL_MONITOR_H_
 #define CHANNEL_MONITOR_H_
 
+#include <rte_power.h>
 #include "channel_manager.h"
-#include "rte_power_guest_channel.h"
 
 struct core_share {
 	unsigned int pcpu;
diff --git a/examples/vm_power_manager/guest_cli/vm_power_cli_guest.c b/examples/vm_power_manager/guest_cli/vm_power_cli_guest.c
index ec6409abd..0bf5774ff 100644
--- a/examples/vm_power_manager/guest_cli/vm_power_cli_guest.c
+++ b/examples/vm_power_manager/guest_cli/vm_power_cli_guest.c
@@ -19,7 +19,6 @@
 #include <rte_ethdev.h>
 
 #include <rte_power.h>
-#include <guest_channel.h>
 
 #include "vm_power_cli_guest.h"
 
diff --git a/examples/vm_power_manager/guest_cli/vm_power_cli_guest.h b/examples/vm_power_manager/guest_cli/vm_power_cli_guest.h
index 5d285ca9d..b578ec072 100644
--- a/examples/vm_power_manager/guest_cli/vm_power_cli_guest.h
+++ b/examples/vm_power_manager/guest_cli/vm_power_cli_guest.h
@@ -9,8 +9,6 @@
 extern "C" {
 #endif
 
-#include "rte_power_guest_channel.h"
-
 struct rte_power_channel_packet *get_policy(void);
 
 int set_policy_mac(int port, int idx);
diff --git a/examples/vm_power_manager/vm_power_cli.c b/examples/vm_power_manager/vm_power_cli.c
index f7e1b596e..1a55e553b 100644
--- a/examples/vm_power_manager/vm_power_cli.c
+++ b/examples/vm_power_manager/vm_power_cli.c
@@ -21,7 +21,6 @@
 #include "channel_manager.h"
 #include "channel_monitor.h"
 #include "power_manager.h"
-#include "rte_power_guest_channel.h"
 
 struct cmd_quit_result {
 	cmdline_fixed_string_t quit;
diff --git a/lib/librte_power/guest_channel.c b/lib/librte_power/guest_channel.c
index 039cb1872..2f7507a03 100644
--- a/lib/librte_power/guest_channel.c
+++ b/lib/librte_power/guest_channel.c
@@ -15,9 +15,9 @@
 
 
 #include <rte_log.h>
+#include <rte_power.h>
 
 #include "guest_channel.h"
-#include "rte_power_guest_channel.h"
 
 #define RTE_LOGTYPE_GUEST_CHANNEL RTE_LOGTYPE_USER1
 
diff --git a/lib/librte_power/guest_channel.h b/lib/librte_power/guest_channel.h
index 7d3a909d9..24f609df3 100644
--- a/lib/librte_power/guest_channel.h
+++ b/lib/librte_power/guest_channel.h
@@ -8,8 +8,6 @@
 extern "C" {
 #endif
 
-#include <rte_power_guest_channel.h>
-
 /**
  * Check if any Virtio-Serial VM end-points exist in path.
  *
diff --git a/lib/librte_power/power_kvm_vm.c b/lib/librte_power/power_kvm_vm.c
index 27f9937aa..ab7d4b8ce 100644
--- a/lib/librte_power/power_kvm_vm.c
+++ b/lib/librte_power/power_kvm_vm.c
@@ -6,8 +6,8 @@
 
 #include <rte_log.h>
 
-#include "guest_channel.h"
 #include "rte_power_guest_channel.h"
+#include "guest_channel.h"
 #include "power_kvm_vm.h"
 #include "power_common.h"
 
diff --git a/lib/librte_power/rte_power.h b/lib/librte_power/rte_power.h
index bbbde4dfb..c8086bf6b 100644
--- a/lib/librte_power/rte_power.h
+++ b/lib/librte_power/rte_power.h
@@ -14,6 +14,7 @@
 #include <rte_byteorder.h>
 #include <rte_log.h>
 #include <rte_string_fns.h>
+#include <rte_power_guest_channel.h>
 
 #ifdef __cplusplus
 extern "C" {
diff --git a/lib/librte_power/rte_power_guest_channel.h b/lib/librte_power/rte_power_guest_channel.h
index b9273a025..adc973817 100644
--- a/lib/librte_power/rte_power_guest_channel.h
+++ b/lib/librte_power/rte_power_guest_channel.h
@@ -8,9 +8,6 @@
 extern "C" {
 #endif
 
-#include <stdint.h>
-#include <stdbool.h>
-
 #define RTE_POWER_MAX_VFS 10
 #define RTE_POWER_VM_MAX_NAME_SZ 32
 #define RTE_POWER_MAX_VCPU_PER_VM 8
-- 
2.17.1


^ permalink raw reply	[flat|nested] 69+ messages in thread

* Re: [dpdk-dev] [PATCH v4 2/6] power: make channel msg functions public
  2021-01-21 17:21           ` [dpdk-dev] [PATCH v4 2/6] power: make channel msg functions public David Hunt
@ 2021-01-22 12:12             ` Burakov, Anatoly
  2021-02-22  9:53             ` [dpdk-dev] [dpdk-stable] " Ferruh Yigit
  1 sibling, 0 replies; 69+ messages in thread
From: Burakov, Anatoly @ 2021-01-22 12:12 UTC (permalink / raw)
  To: David Hunt, dev; +Cc: stable, Bruce Richardson

On 21-Jan-21 5:21 PM, David Hunt wrote:
> From: Bruce Richardson <bruce.richardson@intel.com>
> 
> Move the 2 public functions into rte_power_guest_channel.h
> 
> Fixes: 210c383e247b ("power: packet format for vm power management")
> Fixes: cd0d5547e873 ("power: vm communication channels in guest")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> Signed-off-by: David Hunt <david.hunt@intel.com>
> 
> ---
> changes in v3
> * Mark both added functions as experimental
> changes in v4
> * add @internal tag for Doxygen
> * add @warning EXPERIMENTAL tag for Doxygen
> * improve description of lcore param
> ---
>   lib/librte_power/guest_channel.h           | 40 +----------------
>   lib/librte_power/rte_power_guest_channel.h | 50 ++++++++++++++++++++++
>   2 files changed, 51 insertions(+), 39 deletions(-)
> 
> diff --git a/lib/librte_power/guest_channel.h b/lib/librte_power/guest_channel.h
> index d3d87f0ae..69020b030 100644
> --- a/lib/librte_power/guest_channel.h
> +++ b/lib/librte_power/guest_channel.h
> @@ -65,21 +65,7 @@ void guest_channel_host_disconnect(unsigned int 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.
> - *
> - * @param pkt
> - *  Pointer to a populated struct channel_packet
> - *
> - * @param lcore_id
> - *  lcore_id.
> - *
> - * @return
> - *  - 0 on success.
> - *  - Negative on error.
> - */
> -int rte_power_guest_channel_send_msg(struct channel_packet *pkt,
> -			unsigned int lcore_id);
> +
>   


Nitpick but you left an extra newline there :) can probably be fixed on 
apply, so

Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>

-- 
Thanks,
Anatoly

^ permalink raw reply	[flat|nested] 69+ messages in thread

* Re: [dpdk-dev] [PATCH v4 3/6] power: rename public structs
  2021-01-21 17:21           ` [dpdk-dev] [PATCH v4 3/6] power: rename public structs David Hunt
@ 2021-01-22 12:15             ` Burakov, Anatoly
  2021-01-22 12:18               ` Burakov, Anatoly
  2021-01-22 12:18             ` Burakov, Anatoly
                               ` (2 subsequent siblings)
  3 siblings, 1 reply; 69+ messages in thread
From: Burakov, Anatoly @ 2021-01-22 12:15 UTC (permalink / raw)
  To: David Hunt, dev; +Cc: stable, Bruce Richardson

On 21-Jan-21 5:21 PM, David Hunt wrote:
> From: Bruce Richardson <bruce.richardson@intel.com>
> 
> rename the public structs to have an rte_power_ prefix and
> add them to version.map in experimental section.
> 
> Fixes: 210c383e247b ("power: packet format for vm power management")
> Fixes: cd0d5547e873 ("power: vm communication channels in guest")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> Signed-off-by: David Hunt <david.hunt@intel.com>
> 
> ---
> changes in v4
> * Improve sizeof's
> * add the 2 functions to the version.map file
> ---

<snip>

> diff --git a/lib/librte_power/rte_power_guest_channel.h b/lib/librte_power/rte_power_guest_channel.h
> index c500c0cda..c9ab7bae8 100644
> --- a/lib/librte_power/rte_power_guest_channel.h
> +++ b/lib/librte_power/rte_power_guest_channel.h
> @@ -11,7 +11,10 @@ extern "C" {
>   #include <stdint.h>
>   #include <stdbool.h>
>   
> -/* --- Incoming messages --- */
> +#define MAX_VFS 10
> +#define VM_MAX_NAME_SZ 32
> +#define MAX_VCPU_PER_VM         8
> +#define HOURS 24
>   

These and other defines are in public header, and they're not under RTE_ 
namespace. To avoid clashes with user code, I would suggest either 
adding an RTE_ prefix, or maybe #undef'ing them at the end of the file.

-- 
Thanks,
Anatoly

^ permalink raw reply	[flat|nested] 69+ messages in thread

* Re: [dpdk-dev] [PATCH v4 3/6] power: rename public structs
  2021-01-22 12:15             ` Burakov, Anatoly
@ 2021-01-22 12:18               ` Burakov, Anatoly
  0 siblings, 0 replies; 69+ messages in thread
From: Burakov, Anatoly @ 2021-01-22 12:18 UTC (permalink / raw)
  To: David Hunt, dev; +Cc: stable, Bruce Richardson

On 22-Jan-21 12:15 PM, Burakov, Anatoly wrote:
> On 21-Jan-21 5:21 PM, David Hunt wrote:
>> From: Bruce Richardson <bruce.richardson@intel.com>
>>
>> rename the public structs to have an rte_power_ prefix and
>> add them to version.map in experimental section.
>>
>> Fixes: 210c383e247b ("power: packet format for vm power management")
>> Fixes: cd0d5547e873 ("power: vm communication channels in guest")
>> Cc: stable@dpdk.org
>>
>> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
>> Signed-off-by: David Hunt <david.hunt@intel.com>
>>
>> ---
>> changes in v4
>> * Improve sizeof's
>> * add the 2 functions to the version.map file
>> ---
> 
> <snip>
> 
>> diff --git a/lib/librte_power/rte_power_guest_channel.h 
>> b/lib/librte_power/rte_power_guest_channel.h
>> index c500c0cda..c9ab7bae8 100644
>> --- a/lib/librte_power/rte_power_guest_channel.h
>> +++ b/lib/librte_power/rte_power_guest_channel.h
>> @@ -11,7 +11,10 @@ extern "C" {
>>   #include <stdint.h>
>>   #include <stdbool.h>
>> -/* --- Incoming messages --- */
>> +#define MAX_VFS 10
>> +#define VM_MAX_NAME_SZ 32
>> +#define MAX_VCPU_PER_VM         8
>> +#define HOURS 24
> 
> These and other defines are in public header, and they're not under RTE_ 
> namespace. To avoid clashes with user code, I would suggest either 
> adding an RTE_ prefix, or maybe #undef'ing them at the end of the file.
> 

Apologies, didn't realize this was in the next patch :D (also, #undef 
was a bad idea...)

-- 
Thanks,
Anatoly

^ permalink raw reply	[flat|nested] 69+ messages in thread

* Re: [dpdk-dev] [PATCH v4 3/6] power: rename public structs
  2021-01-21 17:21           ` [dpdk-dev] [PATCH v4 3/6] power: rename public structs David Hunt
  2021-01-22 12:15             ` Burakov, Anatoly
@ 2021-01-22 12:18             ` Burakov, Anatoly
  2021-01-28 22:57             ` [dpdk-dev] [dpdk-stable] " Thomas Monjalon
  2021-02-22  9:56             ` Ferruh Yigit
  3 siblings, 0 replies; 69+ messages in thread
From: Burakov, Anatoly @ 2021-01-22 12:18 UTC (permalink / raw)
  To: David Hunt, dev; +Cc: stable, Bruce Richardson

On 21-Jan-21 5:21 PM, David Hunt wrote:
> From: Bruce Richardson <bruce.richardson@intel.com>
> 
> rename the public structs to have an rte_power_ prefix and
> add them to version.map in experimental section.
> 
> Fixes: 210c383e247b ("power: packet format for vm power management")
> Fixes: cd0d5547e873 ("power: vm communication channels in guest")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> Signed-off-by: David Hunt <david.hunt@intel.com>
> 
> ---
> changes in v4
> * Improve sizeof's
> * add the 2 functions to the version.map file
> ---

Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>

-- 
Thanks,
Anatoly

^ permalink raw reply	[flat|nested] 69+ messages in thread

* Re: [dpdk-dev] [PATCH v4 4/6] power: rename defines
  2021-01-21 17:21           ` [dpdk-dev] [PATCH v4 4/6] power: rename defines David Hunt
@ 2021-01-22 13:50             ` Burakov, Anatoly
  0 siblings, 0 replies; 69+ messages in thread
From: Burakov, Anatoly @ 2021-01-22 13:50 UTC (permalink / raw)
  To: David Hunt, dev; +Cc: stable, Bruce Richardson

On 21-Jan-21 5:21 PM, David Hunt wrote:
> From: Bruce Richardson <bruce.richardson@intel.com>
> 
> Rename the #defines to have an RTE_POWER_ prefix
> 
> Fixes: 210c383e247b ("power: packet format for vm power management")
> Fixes: cd0d5547e873 ("power: vm communication channels in guest")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> Signed-off-by: David Hunt <david.hunt@intel.com>
> ---

Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>

-- 
Thanks,
Anatoly

^ permalink raw reply	[flat|nested] 69+ messages in thread

* Re: [dpdk-dev] [PATCH v4 5/6] power: add new header file to export list
  2021-01-21 17:22           ` [dpdk-dev] [PATCH v4 5/6] power: add new header file to export list David Hunt
@ 2021-01-22 13:51             ` Burakov, Anatoly
  0 siblings, 0 replies; 69+ messages in thread
From: Burakov, Anatoly @ 2021-01-22 13:51 UTC (permalink / raw)
  To: David Hunt, dev; +Cc: stable, Bruce Richardson

On 21-Jan-21 5:22 PM, David Hunt wrote:
> From: Bruce Richardson <bruce.richardson@intel.com>
> 
> Adjust meson.build so that 'ninja install' copies the new header
> file into the installation directory.
> 
> Fixes: 210c383e247b ("power: packet format for vm power management")
> Fixes: cd0d5547e873 ("power: vm communication channels in guest")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> Signed-off-by: David Hunt <david.hunt@intel.com>
> ---

Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>

-- 
Thanks,
Anatoly

^ permalink raw reply	[flat|nested] 69+ messages in thread

* Re: [dpdk-dev] [PATCH v4 6/6] power: clean up includes
  2021-01-21 17:22           ` [dpdk-dev] [PATCH v4 6/6] power: clean up includes David Hunt
@ 2021-01-22 13:53             ` Burakov, Anatoly
  0 siblings, 0 replies; 69+ messages in thread
From: Burakov, Anatoly @ 2021-01-22 13:53 UTC (permalink / raw)
  To: David Hunt, dev; +Cc: stable, Bruce Richardson

On 21-Jan-21 5:22 PM, David Hunt wrote:
> From: Bruce Richardson <bruce.richardson@intel.com>
> 
> re-organise the including of the new public header file and
> remove un-needed includes
> 
> Fixes: 210c383e247b ("power: packet format for vm power management")
> Fixes: cd0d5547e873 ("power: vm communication channels in guest")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> Signed-off-by: David Hunt <david.hunt@intel.com>
> ---
>   examples/vm_power_manager/channel_manager.c              | 1 -
>   examples/vm_power_manager/channel_monitor.c              | 1 -
>   examples/vm_power_manager/channel_monitor.h              | 2 +-
>   examples/vm_power_manager/guest_cli/vm_power_cli_guest.c | 1 -
>   examples/vm_power_manager/guest_cli/vm_power_cli_guest.h | 2 --
>   examples/vm_power_manager/vm_power_cli.c                 | 1 -
>   lib/librte_power/guest_channel.c                         | 2 +-
>   lib/librte_power/guest_channel.h                         | 2 --
>   lib/librte_power/power_kvm_vm.c                          | 2 +-
>   lib/librte_power/rte_power.h                             | 1 +
>   lib/librte_power/rte_power_guest_channel.h               | 3 ---
>   11 files changed, 4 insertions(+), 14 deletions(-)
> 
> diff --git a/examples/vm_power_manager/channel_manager.c b/examples/vm_power_manager/channel_manager.c
> index c7d5bf5a8..0a28cb643 100644
> --- a/examples/vm_power_manager/channel_manager.c
> +++ b/examples/vm_power_manager/channel_manager.c
> @@ -27,7 +27,6 @@
>   #include <libvirt/libvirt.h>
>   
>   #include "channel_manager.h"
> -#include "rte_power_guest_channel.h"
>   #include "channel_monitor.h"
>   #include "power_manager.h"
>   
> diff --git a/examples/vm_power_manager/channel_monitor.c b/examples/vm_power_manager/channel_monitor.c
> index 7bb33e026..99f81544d 100644
> --- a/examples/vm_power_manager/channel_monitor.c
> +++ b/examples/vm_power_manager/channel_monitor.c
> @@ -35,7 +35,6 @@
>   
>   #include <libvirt/libvirt.h>
>   #include "channel_monitor.h"
> -#include "rte_power_guest_channel.h"
>   #include "channel_manager.h"
>   #include "power_manager.h"
>   #include "oob_monitor.h"
> diff --git a/examples/vm_power_manager/channel_monitor.h b/examples/vm_power_manager/channel_monitor.h
> index 5d3537b91..9184a8327 100644
> --- a/examples/vm_power_manager/channel_monitor.h
> +++ b/examples/vm_power_manager/channel_monitor.h
> @@ -5,8 +5,8 @@
>   #ifndef CHANNEL_MONITOR_H_
>   #define CHANNEL_MONITOR_H_
>   
> +#include <rte_power.h>
>   #include "channel_manager.h"

Should have newline before quoted headers, e.g.

#include <blah>

#include "blah"

Otherwise,

Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>

-- 
Thanks,
Anatoly

^ permalink raw reply	[flat|nested] 69+ messages in thread

* Re: [dpdk-dev] [dpdk-stable] [PATCH v4 3/6] power: rename public structs
  2021-01-21 17:21           ` [dpdk-dev] [PATCH v4 3/6] power: rename public structs David Hunt
  2021-01-22 12:15             ` Burakov, Anatoly
  2021-01-22 12:18             ` Burakov, Anatoly
@ 2021-01-28 22:57             ` Thomas Monjalon
  2021-02-22  9:56             ` Ferruh Yigit
  3 siblings, 0 replies; 69+ messages in thread
From: Thomas Monjalon @ 2021-01-28 22:57 UTC (permalink / raw)
  To: David Hunt; +Cc: dev, stable, Bruce Richardson

21/01/2021 18:21, David Hunt:
> --- a/lib/librte_power/version.map
> +++ b/lib/librte_power/version.map
> +	# added in 21.02
> +	rte_power_guest_channel_receive_msg;
> +	rte_power_guest_channel_send_msg;

This should be in the previous patch otherwise it does not compile.



^ permalink raw reply	[flat|nested] 69+ messages in thread

* [dpdk-dev] [PATCH v5 0/6] power: fix make build for power apps
  2021-01-21 17:21           ` [dpdk-dev] [PATCH v4 1/6] power: create guest channel public header file David Hunt
@ 2021-01-29 10:21             ` David Hunt
  2021-01-29 10:21               ` [dpdk-dev] [PATCH v5 1/6] power: create guest channel public header file David Hunt
                                 ` (6 more replies)
  0 siblings, 7 replies; 69+ messages in thread
From: David Hunt @ 2021-01-29 10:21 UTC (permalink / raw)
  To: dev; +Cc: david.hunt, stable

The guest channel message definitions and functions in guest_channel.h
are needed by applications and need to be made public.

This worked pre-20.11, but now with all the meson/ninja changes, making
these apps externally no longer works. To fix, we need to move the
header file with the API definitions for the channel commands public,
and rename the functions accordingly.

The main change is to rename channel_commands.h to
rte_power_guest_channel.h so that it gets picked up by the installer
and copied to /usr/local/include. Other changes include renaming #defines
to have RTE_ at the beginning instead of CPU_. Finally we refactor the
code to work with those changes.

---
v2 changes
 - re-worked from monolithic patch to a 6 patch patchset for easier review
v3 changes
  - Ensure both functions added to the API are tagged as experimental
v4 changes
  - add @internal tag on 2 functions for Doxygen
  - add @warning EXPERIMENTAL tag on 2 functions for Doxygen
  - improve description of lcore param in API docs
  - Improve maintainability sizeof's
  - add the 2 added functions to the version.map file
v5 changes
  - moved version.map additions from patch 3 to patch 2

[v5 1/6] power: create guest channel public header file
[v5 2/6] power: make channel msg functions public
[v5 3/6] power: rename public structs
[v5 4/6] power: rename defines
[v5 5/6] power: add new header file to export list
[v5 6/6] power: clean up includes


^ permalink raw reply	[flat|nested] 69+ messages in thread

* [dpdk-dev] [PATCH v5 1/6] power: create guest channel public header file
  2021-01-29 10:21             ` [dpdk-dev] [PATCH v5 0/6] power: fix make build for power apps David Hunt
@ 2021-01-29 10:21               ` David Hunt
  2021-01-29 10:21               ` [dpdk-dev] [PATCH v5 2/6] power: make channel msg functions public David Hunt
                                 ` (5 subsequent siblings)
  6 siblings, 0 replies; 69+ messages in thread
From: David Hunt @ 2021-01-29 10:21 UTC (permalink / raw)
  To: dev; +Cc: david.hunt, stable, Bruce Richardson

From: Bruce Richardson <bruce.richardson@intel.com>

In preparation for making the header file public, we first rename
channel_commands.h as rte_power_guest_channel.h.

Fixes: 210c383e247b ("power: packet format for vm power management")
Fixes: cd0d5547e873 ("power: vm communication channels in guest")
Cc: stable@dpdk.org

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: David Hunt <david.hunt@intel.com>
---
 examples/vm_power_manager/channel_manager.c              | 2 +-
 examples/vm_power_manager/channel_monitor.c              | 2 +-
 examples/vm_power_manager/channel_monitor.h              | 2 +-
 examples/vm_power_manager/guest_cli/vm_power_cli_guest.h | 2 +-
 examples/vm_power_manager/vm_power_cli.c                 | 2 +-
 lib/librte_power/guest_channel.c                         | 2 +-
 lib/librte_power/guest_channel.h                         | 2 +-
 lib/librte_power/power_kvm_vm.c                          | 2 +-
 .../{channel_commands.h => rte_power_guest_channel.h}    | 9 ++++-----
 9 files changed, 12 insertions(+), 13 deletions(-)
 rename lib/librte_power/{channel_commands.h => rte_power_guest_channel.h} (94%)

diff --git a/examples/vm_power_manager/channel_manager.c b/examples/vm_power_manager/channel_manager.c
index 9dca6f686..58a243b23 100644
--- a/examples/vm_power_manager/channel_manager.c
+++ b/examples/vm_power_manager/channel_manager.c
@@ -27,7 +27,7 @@
 #include <libvirt/libvirt.h>
 
 #include "channel_manager.h"
-#include "channel_commands.h"
+#include "rte_power_guest_channel.h"
 #include "channel_monitor.h"
 #include "power_manager.h"
 
diff --git a/examples/vm_power_manager/channel_monitor.c b/examples/vm_power_manager/channel_monitor.c
index 228f06803..08306105d 100644
--- a/examples/vm_power_manager/channel_monitor.c
+++ b/examples/vm_power_manager/channel_monitor.c
@@ -35,7 +35,7 @@
 
 #include <libvirt/libvirt.h>
 #include "channel_monitor.h"
-#include "channel_commands.h"
+#include "rte_power_guest_channel.h"
 #include "channel_manager.h"
 #include "power_manager.h"
 #include "oob_monitor.h"
diff --git a/examples/vm_power_manager/channel_monitor.h b/examples/vm_power_manager/channel_monitor.h
index 7362a80d2..4a526ff67 100644
--- a/examples/vm_power_manager/channel_monitor.h
+++ b/examples/vm_power_manager/channel_monitor.h
@@ -6,7 +6,7 @@
 #define CHANNEL_MONITOR_H_
 
 #include "channel_manager.h"
-#include "channel_commands.h"
+#include "rte_power_guest_channel.h"
 
 struct core_share {
 	unsigned int pcpu;
diff --git a/examples/vm_power_manager/guest_cli/vm_power_cli_guest.h b/examples/vm_power_manager/guest_cli/vm_power_cli_guest.h
index 6ad14a3de..2299d23dc 100644
--- a/examples/vm_power_manager/guest_cli/vm_power_cli_guest.h
+++ b/examples/vm_power_manager/guest_cli/vm_power_cli_guest.h
@@ -9,7 +9,7 @@
 extern "C" {
 #endif
 
-#include "channel_commands.h"
+#include "rte_power_guest_channel.h"
 
 struct channel_packet *get_policy(void);
 
diff --git a/examples/vm_power_manager/vm_power_cli.c b/examples/vm_power_manager/vm_power_cli.c
index ed0623a41..f7e1b596e 100644
--- a/examples/vm_power_manager/vm_power_cli.c
+++ b/examples/vm_power_manager/vm_power_cli.c
@@ -21,7 +21,7 @@
 #include "channel_manager.h"
 #include "channel_monitor.h"
 #include "power_manager.h"
-#include "channel_commands.h"
+#include "rte_power_guest_channel.h"
 
 struct cmd_quit_result {
 	cmdline_fixed_string_t quit;
diff --git a/lib/librte_power/guest_channel.c b/lib/librte_power/guest_channel.c
index 7b5926e5c..4cb5ae1dd 100644
--- a/lib/librte_power/guest_channel.c
+++ b/lib/librte_power/guest_channel.c
@@ -17,7 +17,7 @@
 #include <rte_log.h>
 
 #include "guest_channel.h"
-#include "channel_commands.h"
+#include "rte_power_guest_channel.h"
 
 #define RTE_LOGTYPE_GUEST_CHANNEL RTE_LOGTYPE_USER1
 
diff --git a/lib/librte_power/guest_channel.h b/lib/librte_power/guest_channel.h
index e15db46fc..d3d87f0ae 100644
--- a/lib/librte_power/guest_channel.h
+++ b/lib/librte_power/guest_channel.h
@@ -8,7 +8,7 @@
 extern "C" {
 #endif
 
-#include <channel_commands.h>
+#include <rte_power_guest_channel.h>
 
 /**
  * Check if any Virtio-Serial VM end-points exist in path.
diff --git a/lib/librte_power/power_kvm_vm.c b/lib/librte_power/power_kvm_vm.c
index 409c3e03a..649ebe85c 100644
--- a/lib/librte_power/power_kvm_vm.c
+++ b/lib/librte_power/power_kvm_vm.c
@@ -7,7 +7,7 @@
 #include <rte_log.h>
 
 #include "guest_channel.h"
-#include "channel_commands.h"
+#include "rte_power_guest_channel.h"
 #include "power_kvm_vm.h"
 #include "power_common.h"
 
diff --git a/lib/librte_power/channel_commands.h b/lib/librte_power/rte_power_guest_channel.h
similarity index 94%
rename from lib/librte_power/channel_commands.h
rename to lib/librte_power/rte_power_guest_channel.h
index adc8e5ca2..ef3b064a8 100644
--- a/lib/librte_power/channel_commands.h
+++ b/lib/librte_power/rte_power_guest_channel.h
@@ -1,9 +1,8 @@
 /* SPDX-License-Identifier: BSD-3-Clause
- * Copyright(c) 2010-2014 Intel Corporation
+ * Copyright(c) 2010-2021 Intel Corporation
  */
-
-#ifndef CHANNEL_COMMANDS_H_
-#define CHANNEL_COMMANDS_H_
+#ifndef RTE_POWER_GUEST_CHANNEL_H
+#define RTE_POWER_GUEST_CHANNEL_H
 
 #ifdef __cplusplus
 extern "C" {
@@ -122,4 +121,4 @@ struct channel_packet_caps_list {
 }
 #endif
 
-#endif /* CHANNEL_COMMANDS_H_ */
+#endif /* RTE_POWER_GUEST_CHANNEL_H_ */
-- 
2.17.1


^ permalink raw reply	[flat|nested] 69+ messages in thread

* [dpdk-dev] [PATCH v5 2/6] power: make channel msg functions public
  2021-01-29 10:21             ` [dpdk-dev] [PATCH v5 0/6] power: fix make build for power apps David Hunt
  2021-01-29 10:21               ` [dpdk-dev] [PATCH v5 1/6] power: create guest channel public header file David Hunt
@ 2021-01-29 10:21               ` David Hunt
  2021-01-29 10:21               ` [dpdk-dev] [PATCH v5 3/6] power: rename public structs David Hunt
                                 ` (4 subsequent siblings)
  6 siblings, 0 replies; 69+ messages in thread
From: David Hunt @ 2021-01-29 10:21 UTC (permalink / raw)
  To: dev; +Cc: david.hunt, stable, Bruce Richardson

From: Bruce Richardson <bruce.richardson@intel.com>

Move the 2 public functions into rte_power_guest_channel.h

Fixes: 210c383e247b ("power: packet format for vm power management")
Fixes: cd0d5547e873 ("power: vm communication channels in guest")
Cc: stable@dpdk.org

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: David Hunt <david.hunt@intel.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
changes in v3
* Mark both added functions as experimental
changes in v4
* add @internal tag for Doxygen
* add @warning EXPERIMENTAL tag for Doxygen
* improve description of lcore param
changes in v5
* moved version.map additions from patch 3 to patch 2
---
 lib/librte_power/guest_channel.h           | 40 +----------------
 lib/librte_power/rte_power_guest_channel.h | 50 ++++++++++++++++++++++
 lib/librte_power/version.map               |  4 ++
 3 files changed, 55 insertions(+), 39 deletions(-)

diff --git a/lib/librte_power/guest_channel.h b/lib/librte_power/guest_channel.h
index d3d87f0ae..69020b030 100644
--- a/lib/librte_power/guest_channel.h
+++ b/lib/librte_power/guest_channel.h
@@ -65,21 +65,7 @@ void guest_channel_host_disconnect(unsigned int 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.
- *
- * @param pkt
- *  Pointer to a populated struct channel_packet
- *
- * @param lcore_id
- *  lcore_id.
- *
- * @return
- *  - 0 on success.
- *  - Negative on error.
- */
-int rte_power_guest_channel_send_msg(struct channel_packet *pkt,
-			unsigned int lcore_id);
+
 
 /**
  * Read a message contained in pkt over the Virtio-Serial
@@ -103,30 +89,6 @@ int power_guest_channel_read_msg(void *pkt,
 		size_t pkt_len,
 		unsigned int lcore_id);
 
-/**
- * Receive a message contained in pkt over the Virtio-Serial
- * from the host endpoint.
- *
- * @param pkt
- *  Pointer to channel_packet or
- *  channel_packet_freq_list struct.
- *
- * @param pkt_len
- *  Size of expected data packet.
- *
- * @param lcore_id
- *  lcore_id.
- *
- * @return
- *  - 0 on success.
- *  - Negative on error.
- */
-__rte_experimental
-int
-rte_power_guest_channel_receive_msg(void *pkt,
-		size_t pkt_len,
-		unsigned int lcore_id);
-
 
 #ifdef __cplusplus
 }
diff --git a/lib/librte_power/rte_power_guest_channel.h b/lib/librte_power/rte_power_guest_channel.h
index ef3b064a8..c500c0cda 100644
--- a/lib/librte_power/rte_power_guest_channel.h
+++ b/lib/librte_power/rte_power_guest_channel.h
@@ -116,6 +116,56 @@ struct channel_packet_caps_list {
 	uint8_t num_vcpu;
 };
 
+/**
+ * @internal
+ *
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice.
+ *
+ * Send a message contained in pkt over the Virtio-Serial to the host endpoint.
+ *
+ * @param pkt
+ *  Pointer to a populated struct channel_packet.
+ *
+ * @param lcore_id
+ *  Use channel specific to this lcore_id.
+ *
+ * @return
+ *  - 0 on success.
+ *  - Negative on error.
+ */
+__rte_experimental
+int rte_power_guest_channel_send_msg(struct channel_packet *pkt,
+			unsigned int lcore_id);
+
+/**
+ * @internal
+ *
+ * @warning
+ * @b EXPERIMENTAL: this API may change without prior notice.
+ *
+ * Receive a message contained in pkt over the Virtio-Serial
+ * from the host endpoint.
+ *
+ * @param pkt
+ *  Pointer to channel_packet or
+ *  channel_packet_freq_list struct.
+ *
+ * @param pkt_len
+ *  Size of expected data packet.
+ *
+ * @param lcore_id
+ *  Use channel specific to this lcore_id.
+ *
+ * @return
+ *  - 0 on success.
+ *  - Negative on error.
+ */
+__rte_experimental
+int rte_power_guest_channel_receive_msg(void *pkt,
+		size_t pkt_len,
+		unsigned int lcore_id);
+
 
 #ifdef __cplusplus
 }
diff --git a/lib/librte_power/version.map b/lib/librte_power/version.map
index 69ca9af61..13f0af3b2 100644
--- a/lib/librte_power/version.map
+++ b/lib/librte_power/version.map
@@ -34,4 +34,8 @@ EXPERIMENTAL {
 	rte_power_guest_channel_receive_msg;
 	rte_power_poll_stat_fetch;
 	rte_power_poll_stat_update;
+
+	# added in 21.02
+	rte_power_guest_channel_receive_msg;
+	rte_power_guest_channel_send_msg;
 };
-- 
2.17.1


^ permalink raw reply	[flat|nested] 69+ messages in thread

* [dpdk-dev] [PATCH v5 3/6] power: rename public structs
  2021-01-29 10:21             ` [dpdk-dev] [PATCH v5 0/6] power: fix make build for power apps David Hunt
  2021-01-29 10:21               ` [dpdk-dev] [PATCH v5 1/6] power: create guest channel public header file David Hunt
  2021-01-29 10:21               ` [dpdk-dev] [PATCH v5 2/6] power: make channel msg functions public David Hunt
@ 2021-01-29 10:21               ` David Hunt
  2021-01-29 10:21               ` [dpdk-dev] [PATCH v5 4/6] power: rename defines David Hunt
                                 ` (3 subsequent siblings)
  6 siblings, 0 replies; 69+ messages in thread
From: David Hunt @ 2021-01-29 10:21 UTC (permalink / raw)
  To: dev; +Cc: david.hunt, stable, Bruce Richardson

From: Bruce Richardson <bruce.richardson@intel.com>

rename the public structs to have an rte_power_ prefix and
add them to version.map in experimental section.

Fixes: 210c383e247b ("power: packet format for vm power management")
Fixes: cd0d5547e873 ("power: vm communication channels in guest")
Cc: stable@dpdk.org

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: David Hunt <david.hunt@intel.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>

---
changes in v4
* Improve sizeof's
* add the 2 functions to the version.map file
changes in v5
* Moved version.map additions from patch 3 to patch 2
---
 examples/vm_power_manager/channel_monitor.c   | 33 ++++++------
 examples/vm_power_manager/channel_monitor.h   |  2 +-
 examples/vm_power_manager/guest_cli/main.c    |  2 +-
 .../guest_cli/vm_power_cli_guest.c            | 38 +++++++-------
 .../guest_cli/vm_power_cli_guest.h            |  4 +-
 lib/librte_power/guest_channel.c              |  7 +--
 lib/librte_power/guest_channel.h              |  7 +--
 lib/librte_power/power_kvm_vm.c               |  2 +-
 lib/librte_power/rte_power_guest_channel.h    | 51 +++++++++----------
 9 files changed, 73 insertions(+), 73 deletions(-)

diff --git a/examples/vm_power_manager/channel_monitor.c b/examples/vm_power_manager/channel_monitor.c
index 08306105d..1b6041b6f 100644
--- a/examples/vm_power_manager/channel_monitor.c
+++ b/examples/vm_power_manager/channel_monitor.c
@@ -108,7 +108,7 @@ str_to_ether_addr(const char *a, struct rte_ether_addr *ether_addr)
 }
 
 static int
-set_policy_mac(struct channel_packet *pkt, int idx, char *mac)
+set_policy_mac(struct rte_power_channel_packet *pkt, int idx, char *mac)
 {
 	union PFID pfid;
 	int ret;
@@ -165,7 +165,7 @@ get_resource_id_from_vmname(const char *vm_name)
 }
 
 static int
-parse_json_to_pkt(json_t *element, struct channel_packet *pkt,
+parse_json_to_pkt(json_t *element, struct rte_power_channel_packet *pkt,
 					const char *vm_name)
 {
 	const char *key;
@@ -173,7 +173,7 @@ parse_json_to_pkt(json_t *element, struct channel_packet *pkt,
 	int ret;
 	int resource_id;
 
-	memset(pkt, 0, sizeof(struct channel_packet));
+	memset(pkt, 0, sizeof(*pkt));
 
 	pkt->nb_mac_to_monitor = 0;
 	pkt->t_boost_status.tbEnabled = false;
@@ -463,7 +463,7 @@ get_pfid(struct policy *pol)
 }
 
 static int
-update_policy(struct channel_packet *pkt)
+update_policy(struct rte_power_channel_packet *pkt)
 {
 
 	unsigned int updated = 0;
@@ -512,7 +512,7 @@ update_policy(struct channel_packet *pkt)
 }
 
 static int
-remove_policy(struct channel_packet *pkt __rte_unused)
+remove_policy(struct rte_power_channel_packet *pkt __rte_unused)
 {
 	unsigned int i;
 
@@ -673,7 +673,7 @@ static void
 apply_policy(struct policy *pol)
 {
 
-	struct channel_packet *pkt = &pol->pkt;
+	struct rte_power_channel_packet *pkt = &pol->pkt;
 
 	/*Check policy to use*/
 	if (pkt->policy_to_use == TRAFFIC)
@@ -715,12 +715,12 @@ write_binary_packet(void *buffer,
 }
 
 static int
-send_freq(struct channel_packet *pkt,
+send_freq(struct rte_power_channel_packet *pkt,
 		struct channel_info *chan_info,
 		bool freq_list)
 {
 	unsigned int vcore_id = pkt->resource_id;
-	struct channel_packet_freq_list channel_pkt_freq_list;
+	struct rte_power_channel_packet_freq_list channel_pkt_freq_list;
 	struct vm_info info;
 
 	if (get_info_vm(pkt->vm_name, &info) != 0)
@@ -751,12 +751,12 @@ send_freq(struct channel_packet *pkt,
 }
 
 static int
-send_capabilities(struct channel_packet *pkt,
+send_capabilities(struct rte_power_channel_packet *pkt,
 		struct channel_info *chan_info,
 		bool list_requested)
 {
 	unsigned int vcore_id = pkt->resource_id;
-	struct channel_packet_caps_list channel_pkt_caps_list;
+	struct rte_power_channel_packet_caps_list channel_pkt_caps_list;
 	struct vm_info info;
 	struct rte_power_core_capabilities caps;
 	int ret;
@@ -805,18 +805,19 @@ send_capabilities(struct channel_packet *pkt,
 }
 
 static int
-send_ack_for_received_cmd(struct channel_packet *pkt,
+send_ack_for_received_cmd(struct rte_power_channel_packet *pkt,
 		struct channel_info *chan_info,
 		uint32_t command)
 {
 	pkt->command = command;
 	return write_binary_packet(pkt,
-			sizeof(struct channel_packet),
+			sizeof(*pkt),
 			chan_info);
 }
 
 static int
-process_request(struct channel_packet *pkt, struct channel_info *chan_info)
+process_request(struct rte_power_channel_packet *pkt,
+		struct channel_info *chan_info)
 {
 	int ret;
 
@@ -988,7 +989,7 @@ channel_monitor_init(void)
 static void
 read_binary_packet(struct channel_info *chan_info)
 {
-	struct channel_packet pkt;
+	struct rte_power_channel_packet pkt;
 	void *buffer = &pkt;
 	int buffer_len = sizeof(pkt);
 	int n_bytes, err = 0;
@@ -1019,7 +1020,7 @@ read_binary_packet(struct channel_info *chan_info)
 static void
 read_json_packet(struct channel_info *chan_info)
 {
-	struct channel_packet pkt;
+	struct rte_power_channel_packet pkt;
 	int n_bytes, ret;
 	json_t *root;
 	json_error_t error;
@@ -1063,7 +1064,7 @@ read_json_packet(struct channel_info *chan_info)
 			/*
 			 * Because our data is now in the json
 			 * object, we can overwrite the pkt
-			 * with a channel_packet struct, using
+			 * with a rte_power_channel_packet struct, using
 			 * parse_json_to_pkt()
 			 */
 			ret = parse_json_to_pkt(root, &pkt, resource_name);
diff --git a/examples/vm_power_manager/channel_monitor.h b/examples/vm_power_manager/channel_monitor.h
index 4a526ff67..0ca6207ad 100644
--- a/examples/vm_power_manager/channel_monitor.h
+++ b/examples/vm_power_manager/channel_monitor.h
@@ -18,7 +18,7 @@ struct core_share {
 };
 
 struct policy {
-	struct channel_packet pkt;
+	struct rte_power_channel_packet pkt;
 	uint32_t pfid[MAX_VFS];
 	uint32_t port[MAX_VFS];
 	unsigned int enabled;
diff --git a/examples/vm_power_manager/guest_cli/main.c b/examples/vm_power_manager/guest_cli/main.c
index f63b3c988..fc7a8c30a 100644
--- a/examples/vm_power_manager/guest_cli/main.c
+++ b/examples/vm_power_manager/guest_cli/main.c
@@ -48,7 +48,7 @@ parse_args(int argc, char **argv)
 		{ "policy", required_argument, 0, 'o'},
 		{NULL, 0, 0, 0}
 	};
-	struct channel_packet *policy;
+	struct rte_power_channel_packet *policy;
 	unsigned short int hours[MAX_HOURS];
 	unsigned short int cores[MAX_VCPU_PER_VM];
 	unsigned short int ports[MAX_VCPU_PER_VM];
diff --git a/examples/vm_power_manager/guest_cli/vm_power_cli_guest.c b/examples/vm_power_manager/guest_cli/vm_power_cli_guest.c
index cf1636e78..125dfeb10 100644
--- a/examples/vm_power_manager/guest_cli/vm_power_cli_guest.c
+++ b/examples/vm_power_manager/guest_cli/vm_power_cli_guest.c
@@ -38,9 +38,9 @@ union PFID {
 	uint64_t pfid;
 };
 
-static struct channel_packet policy;
+static struct rte_power_channel_packet policy;
 
-struct channel_packet *
+struct rte_power_channel_packet *
 get_policy(void)
 {
 	return &policy;
@@ -49,7 +49,7 @@ get_policy(void)
 int
 set_policy_mac(int port, int idx)
 {
-	struct channel_packet *policy;
+	struct rte_power_channel_packet *policy;
 	union PFID pfid;
 	int ret;
 
@@ -73,7 +73,7 @@ set_policy_mac(int port, int idx)
 }
 
 int
-set_policy_defaults(struct channel_packet *pkt)
+set_policy_defaults(struct rte_power_channel_packet *pkt)
 {
 	int ret;
 
@@ -145,7 +145,7 @@ struct cmd_freq_list_result {
 };
 
 static int
-query_data(struct channel_packet *pkt, unsigned int lcore_id)
+query_data(struct rte_power_channel_packet *pkt, unsigned int lcore_id)
 {
 	int ret;
 	ret = rte_power_guest_channel_send_msg(pkt, lcore_id);
@@ -157,13 +157,13 @@ query_data(struct channel_packet *pkt, unsigned int lcore_id)
 }
 
 static int
-receive_freq_list(struct channel_packet_freq_list *pkt_freq_list,
+receive_freq_list(struct rte_power_channel_packet_freq_list *pkt_freq_list,
 		unsigned int lcore_id)
 {
 	int ret;
 
 	ret = rte_power_guest_channel_receive_msg(pkt_freq_list,
-			sizeof(struct channel_packet_freq_list),
+			sizeof(*pkt_freq_list),
 			lcore_id);
 	if (ret < 0) {
 		RTE_LOG(ERR, GUEST_CLI, "Error receiving message.\n");
@@ -183,14 +183,14 @@ cmd_query_freq_list_parsed(void *parsed_result,
 {
 	struct cmd_freq_list_result *res = parsed_result;
 	unsigned int lcore_id;
-	struct channel_packet_freq_list pkt_freq_list;
-	struct channel_packet pkt;
+	struct rte_power_channel_packet_freq_list pkt_freq_list;
+	struct rte_power_channel_packet pkt;
 	bool query_list = false;
 	int ret;
 	char *ep;
 
-	memset(&pkt, 0, sizeof(struct channel_packet));
-	memset(&pkt_freq_list, 0, sizeof(struct channel_packet_freq_list));
+	memset(&pkt, 0, sizeof(pkt));
+	memset(&pkt_freq_list, 0, sizeof(pkt_freq_list));
 
 	if (!strcmp(res->cpu_num, "all")) {
 
@@ -267,13 +267,13 @@ struct cmd_query_caps_result {
 };
 
 static int
-receive_capabilities(struct channel_packet_caps_list *pkt_caps_list,
+receive_capabilities(struct rte_power_channel_packet_caps_list *pkt_caps_list,
 		unsigned int lcore_id)
 {
 	int ret;
 
 	ret = rte_power_guest_channel_receive_msg(pkt_caps_list,
-		sizeof(struct channel_packet_caps_list),
+		sizeof(*pkt_caps_list),
 		lcore_id);
 	if (ret < 0) {
 		RTE_LOG(ERR, GUEST_CLI, "Error receiving message.\n");
@@ -293,14 +293,14 @@ cmd_query_caps_list_parsed(void *parsed_result,
 {
 	struct cmd_query_caps_result *res = parsed_result;
 	unsigned int lcore_id;
-	struct channel_packet_caps_list pkt_caps_list;
-	struct channel_packet pkt;
+	struct rte_power_channel_packet_caps_list pkt_caps_list;
+	struct rte_power_channel_packet pkt;
 	bool query_list = false;
 	int ret;
 	char *ep;
 
-	memset(&pkt, 0, sizeof(struct channel_packet));
-	memset(&pkt_caps_list, 0, sizeof(struct channel_packet_caps_list));
+	memset(&pkt, 0, sizeof(pkt));
+	memset(&pkt_caps_list, 0, sizeof(pkt_caps_list));
 
 	if (!strcmp(res->cpu_num, "all")) {
 
@@ -380,7 +380,7 @@ cmdline_parse_inst_t cmd_query_caps_list = {
 static int
 check_response_cmd(unsigned int lcore_id, int *result)
 {
-	struct channel_packet pkt;
+	struct rte_power_channel_packet pkt;
 	int ret;
 
 	ret = rte_power_guest_channel_receive_msg(&pkt, sizeof pkt, lcore_id);
@@ -473,7 +473,7 @@ struct cmd_send_policy_result {
 };
 
 static inline int
-send_policy(struct channel_packet *pkt, struct cmdline *cl)
+send_policy(struct rte_power_channel_packet *pkt, struct cmdline *cl)
 {
 	int ret;
 
diff --git a/examples/vm_power_manager/guest_cli/vm_power_cli_guest.h b/examples/vm_power_manager/guest_cli/vm_power_cli_guest.h
index 2299d23dc..5d285ca9d 100644
--- a/examples/vm_power_manager/guest_cli/vm_power_cli_guest.h
+++ b/examples/vm_power_manager/guest_cli/vm_power_cli_guest.h
@@ -11,11 +11,11 @@ extern "C" {
 
 #include "rte_power_guest_channel.h"
 
-struct channel_packet *get_policy(void);
+struct rte_power_channel_packet *get_policy(void);
 
 int set_policy_mac(int port, int idx);
 
-int set_policy_defaults(struct channel_packet *pkt);
+int set_policy_defaults(struct rte_power_channel_packet *pkt);
 
 void run_cli(__rte_unused void *arg);
 
diff --git a/lib/librte_power/guest_channel.c b/lib/librte_power/guest_channel.c
index 4cb5ae1dd..9eb2f6330 100644
--- a/lib/librte_power/guest_channel.c
+++ b/lib/librte_power/guest_channel.c
@@ -55,7 +55,7 @@ int
 guest_channel_host_connect(const char *path, unsigned int lcore_id)
 {
 	int flags, ret;
-	struct channel_packet pkt;
+	struct rte_power_channel_packet pkt;
 	char fd_path[PATH_MAX];
 	int fd = -1;
 
@@ -119,7 +119,8 @@ guest_channel_host_connect(const char *path, unsigned int lcore_id)
 }
 
 int
-guest_channel_send_msg(struct channel_packet *pkt, unsigned int lcore_id)
+guest_channel_send_msg(struct rte_power_channel_packet *pkt,
+		unsigned int lcore_id)
 {
 	int ret, buffer_len = sizeof(*pkt);
 	void *buffer = pkt;
@@ -149,7 +150,7 @@ guest_channel_send_msg(struct channel_packet *pkt, unsigned int lcore_id)
 	return 0;
 }
 
-int rte_power_guest_channel_send_msg(struct channel_packet *pkt,
+int rte_power_guest_channel_send_msg(struct rte_power_channel_packet *pkt,
 			unsigned int lcore_id)
 {
 	return guest_channel_send_msg(pkt, lcore_id);
diff --git a/lib/librte_power/guest_channel.h b/lib/librte_power/guest_channel.h
index 69020b030..7d3a909d9 100644
--- a/lib/librte_power/guest_channel.h
+++ b/lib/librte_power/guest_channel.h
@@ -63,7 +63,8 @@ void guest_channel_host_disconnect(unsigned int lcore_id);
  *  - Negative on channel not connected.
  *  - errno on write to channel error.
  */
-int guest_channel_send_msg(struct channel_packet *pkt, unsigned int lcore_id);
+int guest_channel_send_msg(struct rte_power_channel_packet *pkt,
+		unsigned int lcore_id);
 
 
 
@@ -72,8 +73,8 @@ int guest_channel_send_msg(struct channel_packet *pkt, unsigned int lcore_id);
  * from the host endpoint.
  *
  * @param pkt
- *  Pointer to channel_packet or
- *  channel_packet_freq_list struct.
+ *  Pointer to rte_power_channel_packet or
+ *  rte_power_channel_packet_freq_list struct.
  *
  * @param pkt_len
  *  Size of expected data packet.
diff --git a/lib/librte_power/power_kvm_vm.c b/lib/librte_power/power_kvm_vm.c
index 649ebe85c..9ae438489 100644
--- a/lib/librte_power/power_kvm_vm.c
+++ b/lib/librte_power/power_kvm_vm.c
@@ -13,7 +13,7 @@
 
 #define FD_PATH "/dev/virtio-ports/virtio.serial.port.poweragent"
 
-static struct channel_packet pkt[RTE_MAX_LCORE];
+static struct rte_power_channel_packet pkt[RTE_MAX_LCORE];
 
 int
 power_kvm_vm_check_supported(void)
diff --git a/lib/librte_power/rte_power_guest_channel.h b/lib/librte_power/rte_power_guest_channel.h
index c500c0cda..c9ab7bae8 100644
--- a/lib/librte_power/rte_power_guest_channel.h
+++ b/lib/librte_power/rte_power_guest_channel.h
@@ -11,7 +11,10 @@ extern "C" {
 #include <stdint.h>
 #include <stdbool.h>
 
-/* --- Incoming messages --- */
+#define MAX_VFS 10
+#define VM_MAX_NAME_SZ 32
+#define MAX_VCPU_PER_VM         8
+#define HOURS 24
 
 /* Valid Commands */
 #define CPU_POWER               1
@@ -19,6 +22,9 @@ extern "C" {
 #define PKT_POLICY              3
 #define PKT_POLICY_REMOVE       4
 
+#define CORE_TYPE_VIRTUAL 0
+#define CORE_TYPE_PHYSICAL 1
+
 /* CPU Power Command Scaling */
 #define CPU_POWER_SCALE_UP      1
 #define CPU_POWER_SCALE_DOWN    2
@@ -43,41 +49,32 @@ extern "C" {
 #define CPU_POWER_FREQ_LIST     3
 #define CPU_POWER_CAPS_LIST     4
 
-#define HOURS 24
-
-#define MAX_VFS 10
-#define VM_MAX_NAME_SZ 32
-
-#define MAX_VCPU_PER_VM         8
-
-struct t_boost_status {
-	bool tbEnabled;
-};
-
-struct timer_profile {
+struct rte_power_timer_profile {
 	int busy_hours[HOURS];
 	int quiet_hours[HOURS];
 	int hours_to_use_traffic_profile[HOURS];
 };
 
-enum workload {HIGH, MEDIUM, LOW};
-enum policy_to_use {
+enum rte_power_workload_level {HIGH, MEDIUM, LOW};
+
+enum rte_power_policy {
 	TRAFFIC,
 	TIME,
 	WORKLOAD,
 	BRANCH_RATIO
 };
 
-struct traffic {
+struct rte_power_traffic_policy {
 	uint32_t min_packet_thresh;
 	uint32_t avg_max_packet_thresh;
 	uint32_t max_max_packet_thresh;
 };
 
-#define CORE_TYPE_VIRTUAL 0
-#define CORE_TYPE_PHYSICAL 1
+struct rte_power_turbo_status {
+	bool tbEnabled;
+};
 
-struct channel_packet {
+struct rte_power_channel_packet {
 	uint64_t resource_id; /**< core_num, device */
 	uint32_t unit;        /**< scale down/up/min/max */
 	uint32_t command;     /**< Power, IO, etc */
@@ -85,17 +82,17 @@ struct channel_packet {
 
 	uint64_t vfid[MAX_VFS];
 	int nb_mac_to_monitor;
-	struct traffic traffic_policy;
+	struct rte_power_traffic_policy traffic_policy;
 	uint8_t vcpu_to_control[MAX_VCPU_PER_VM];
 	uint8_t num_vcpu;
-	struct timer_profile timer_policy;
+	struct rte_power_timer_profile timer_policy;
 	bool core_type;
-	enum workload workload;
-	enum policy_to_use policy_to_use;
-	struct t_boost_status t_boost_status;
+	enum rte_power_workload_level workload;
+	enum rte_power_policy policy_to_use;
+	struct rte_power_turbo_status t_boost_status;
 };
 
-struct channel_packet_freq_list {
+struct rte_power_channel_packet_freq_list {
 	uint64_t resource_id; /**< core_num, device */
 	uint32_t unit;        /**< scale down/up/min/max */
 	uint32_t command;     /**< Power, IO, etc */
@@ -105,7 +102,7 @@ struct channel_packet_freq_list {
 	uint8_t num_vcpu;
 };
 
-struct channel_packet_caps_list {
+struct rte_power_channel_packet_caps_list {
 	uint64_t resource_id; /**< core_num, device */
 	uint32_t unit;        /**< scale down/up/min/max */
 	uint32_t command;     /**< Power, IO, etc */
@@ -135,7 +132,7 @@ struct channel_packet_caps_list {
  *  - Negative on error.
  */
 __rte_experimental
-int rte_power_guest_channel_send_msg(struct channel_packet *pkt,
+int rte_power_guest_channel_send_msg(struct rte_power_channel_packet *pkt,
 			unsigned int lcore_id);
 
 /**
-- 
2.17.1


^ permalink raw reply	[flat|nested] 69+ messages in thread

* [dpdk-dev] [PATCH v5 4/6] power: rename defines
  2021-01-29 10:21             ` [dpdk-dev] [PATCH v5 0/6] power: fix make build for power apps David Hunt
                                 ` (2 preceding siblings ...)
  2021-01-29 10:21               ` [dpdk-dev] [PATCH v5 3/6] power: rename public structs David Hunt
@ 2021-01-29 10:21               ` David Hunt
  2021-01-29 10:21               ` [dpdk-dev] [PATCH v5 5/6] power: add new header file to export list David Hunt
                                 ` (2 subsequent siblings)
  6 siblings, 0 replies; 69+ messages in thread
From: David Hunt @ 2021-01-29 10:21 UTC (permalink / raw)
  To: dev; +Cc: david.hunt, stable, Bruce Richardson

From: Bruce Richardson <bruce.richardson@intel.com>

Rename the #defines to have an RTE_POWER_ prefix

Fixes: 210c383e247b ("power: packet format for vm power management")
Fixes: cd0d5547e873 ("power: vm communication channels in guest")
Cc: stable@dpdk.org

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: David Hunt <david.hunt@intel.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
 examples/vm_power_manager/channel_monitor.c   | 116 +++++++++---------
 examples/vm_power_manager/channel_monitor.h   |   6 +-
 examples/vm_power_manager/guest_cli/main.c    |  29 +++--
 .../guest_cli/vm_power_cli_guest.c            |  28 ++---
 examples/vm_power_manager/main.c              |   2 +-
 lib/librte_power/guest_channel.c              |   2 +-
 lib/librte_power/power_kvm_vm.c               |  14 +--
 lib/librte_power/rte_power_guest_channel.h    |  98 +++++++--------
 8 files changed, 155 insertions(+), 140 deletions(-)

diff --git a/examples/vm_power_manager/channel_monitor.c b/examples/vm_power_manager/channel_monitor.c
index 1b6041b6f..7bb33e026 100644
--- a/examples/vm_power_manager/channel_monitor.c
+++ b/examples/vm_power_manager/channel_monitor.c
@@ -177,10 +177,10 @@ parse_json_to_pkt(json_t *element, struct rte_power_channel_packet *pkt,
 
 	pkt->nb_mac_to_monitor = 0;
 	pkt->t_boost_status.tbEnabled = false;
-	pkt->workload = LOW;
-	pkt->policy_to_use = TIME;
-	pkt->command = PKT_POLICY;
-	pkt->core_type = CORE_TYPE_PHYSICAL;
+	pkt->workload = RTE_POWER_WL_LOW;
+	pkt->policy_to_use = RTE_POWER_POLICY_TIME;
+	pkt->command = RTE_POWER_PKT_POLICY;
+	pkt->core_type = RTE_POWER_CORE_TYPE_PHYSICAL;
 
 	if (vm_name == NULL) {
 		RTE_LOG(ERR, CHANNEL_MONITOR,
@@ -203,11 +203,11 @@ parse_json_to_pkt(json_t *element, struct rte_power_channel_packet *pkt,
 			char command[32];
 			strlcpy(command, json_string_value(value), 32);
 			if (!strcmp(command, "power")) {
-				pkt->command = CPU_POWER;
+				pkt->command = RTE_POWER_CPU_POWER;
 			} else if (!strcmp(command, "create")) {
-				pkt->command = PKT_POLICY;
+				pkt->command = RTE_POWER_PKT_POLICY;
 			} else if (!strcmp(command, "destroy")) {
-				pkt->command = PKT_POLICY_REMOVE;
+				pkt->command = RTE_POWER_PKT_POLICY_REMOVE;
 			} else {
 				RTE_LOG(ERR, CHANNEL_MONITOR,
 					"Invalid command received in JSON\n");
@@ -217,13 +217,17 @@ parse_json_to_pkt(json_t *element, struct rte_power_channel_packet *pkt,
 			char command[32];
 			strlcpy(command, json_string_value(value), 32);
 			if (!strcmp(command, "TIME")) {
-				pkt->policy_to_use = TIME;
+				pkt->policy_to_use =
+						RTE_POWER_POLICY_TIME;
 			} else if (!strcmp(command, "TRAFFIC")) {
-				pkt->policy_to_use = TRAFFIC;
+				pkt->policy_to_use =
+						RTE_POWER_POLICY_TRAFFIC;
 			} else if (!strcmp(command, "WORKLOAD")) {
-				pkt->policy_to_use = WORKLOAD;
+				pkt->policy_to_use =
+						RTE_POWER_POLICY_WORKLOAD;
 			} else if (!strcmp(command, "BRANCH_RATIO")) {
-				pkt->policy_to_use = BRANCH_RATIO;
+				pkt->policy_to_use =
+						RTE_POWER_POLICY_BRANCH_RATIO;
 			} else {
 				RTE_LOG(ERR, CHANNEL_MONITOR,
 					"Wrong policy_type received in JSON\n");
@@ -233,11 +237,11 @@ parse_json_to_pkt(json_t *element, struct rte_power_channel_packet *pkt,
 			char command[32];
 			strlcpy(command, json_string_value(value), 32);
 			if (!strcmp(command, "HIGH")) {
-				pkt->workload = HIGH;
+				pkt->workload = RTE_POWER_WL_HIGH;
 			} else if (!strcmp(command, "MEDIUM")) {
-				pkt->workload = MEDIUM;
+				pkt->workload = RTE_POWER_WL_MEDIUM;
 			} else if (!strcmp(command, "LOW")) {
-				pkt->workload = LOW;
+				pkt->workload = RTE_POWER_WL_LOW;
 			} else {
 				RTE_LOG(ERR, CHANNEL_MONITOR,
 					"Wrong workload received in JSON\n");
@@ -283,17 +287,17 @@ parse_json_to_pkt(json_t *element, struct rte_power_channel_packet *pkt,
 			char unit[32];
 			strlcpy(unit, json_string_value(value), 32);
 			if (!strcmp(unit, "SCALE_UP")) {
-				pkt->unit = CPU_POWER_SCALE_UP;
+				pkt->unit = RTE_POWER_SCALE_UP;
 			} else if (!strcmp(unit, "SCALE_DOWN")) {
-				pkt->unit = CPU_POWER_SCALE_DOWN;
+				pkt->unit = RTE_POWER_SCALE_DOWN;
 			} else if (!strcmp(unit, "SCALE_MAX")) {
-				pkt->unit = CPU_POWER_SCALE_MAX;
+				pkt->unit = RTE_POWER_SCALE_MAX;
 			} else if (!strcmp(unit, "SCALE_MIN")) {
-				pkt->unit = CPU_POWER_SCALE_MIN;
+				pkt->unit = RTE_POWER_SCALE_MIN;
 			} else if (!strcmp(unit, "ENABLE_TURBO")) {
-				pkt->unit = CPU_POWER_ENABLE_TURBO;
+				pkt->unit = RTE_POWER_ENABLE_TURBO;
 			} else if (!strcmp(unit, "DISABLE_TURBO")) {
-				pkt->unit = CPU_POWER_DISABLE_TURBO;
+				pkt->unit = RTE_POWER_DISABLE_TURBO;
 			} else {
 				RTE_LOG(ERR, CHANNEL_MONITOR,
 					"Invalid command received in JSON\n");
@@ -312,7 +316,7 @@ parse_json_to_pkt(json_t *element, struct rte_power_channel_packet *pkt,
 				vm_name);
 			return -1;
 		}
-		strlcpy(pkt->vm_name, vm_name, VM_MAX_NAME_SZ);
+		strlcpy(pkt->vm_name, vm_name, RTE_POWER_VM_MAX_NAME_SZ);
 		pkt->resource_id = resource_id;
 	}
 	return 0;
@@ -367,7 +371,7 @@ pcpu_monitor(struct policy *pol, struct core_info *ci, int pcpu, int count)
 {
 	int ret = 0;
 
-	if (pol->pkt.policy_to_use == BRANCH_RATIO) {
+	if (pol->pkt.policy_to_use == RTE_POWER_POLICY_BRANCH_RATIO) {
 		ci->cd[pcpu].oob_enabled = 1;
 		ret = add_core_to_monitor(pcpu);
 		if (ret == 0)
@@ -407,7 +411,7 @@ get_pcpu_to_control(struct policy *pol)
 	 * differenciate between them when adding them to the branch monitor.
 	 * Virtual cores need to be converted to physical cores.
 	 */
-	if (pol->pkt.core_type == CORE_TYPE_VIRTUAL) {
+	if (pol->pkt.core_type == RTE_POWER_CORE_TYPE_VIRTUAL) {
 		/*
 		 * If the cores in the policy are virtual, we need to map them
 		 * to physical core. We look up the vm info and use that for
@@ -479,7 +483,8 @@ update_policy(struct rte_power_channel_packet *pkt)
 			policies[i].pkt = *pkt;
 			get_pcpu_to_control(&policies[i]);
 			/* Check Eth dev only for Traffic policy */
-			if (policies[i].pkt.policy_to_use == TRAFFIC) {
+			if (policies[i].pkt.policy_to_use ==
+					RTE_POWER_POLICY_TRAFFIC) {
 				if (get_pfid(&policies[i]) < 0) {
 					updated = 1;
 					break;
@@ -496,7 +501,8 @@ update_policy(struct rte_power_channel_packet *pkt)
 				policies[i].pkt = *pkt;
 				get_pcpu_to_control(&policies[i]);
 				/* Check Eth dev only for Traffic policy */
-				if (policies[i].pkt.policy_to_use == TRAFFIC) {
+				if (policies[i].pkt.policy_to_use ==
+						RTE_POWER_POLICY_TRAFFIC) {
 					if (get_pfid(&policies[i]) < 0) {
 						updated = 1;
 						break;
@@ -615,7 +621,7 @@ apply_time_profile(struct policy *pol)
 	/* Format the date and time, down to a single second. */
 	strftime(time_string, sizeof(time_string), "%Y-%m-%d %H:%M:%S", ptm);
 
-	for (x = 0; x < HOURS; x++) {
+	for (x = 0; x < RTE_POWER_HOURS_PER_DAY; x++) {
 
 		if (ptm->tm_hour == pol->pkt.timer_policy.busy_hours[x]) {
 			for (count = 0; count < pol->pkt.num_vcpu; count++) {
@@ -648,19 +654,19 @@ apply_workload_profile(struct policy *pol)
 
 	int count;
 
-	if (pol->pkt.workload == HIGH) {
+	if (pol->pkt.workload == RTE_POWER_WL_HIGH) {
 		for (count = 0; count < pol->pkt.num_vcpu; count++) {
 			if (pol->core_share[count].status != 1)
 				power_manager_scale_core_max(
 						pol->core_share[count].pcpu);
 		}
-	} else if (pol->pkt.workload == MEDIUM) {
+	} else if (pol->pkt.workload == RTE_POWER_WL_MEDIUM) {
 		for (count = 0; count < pol->pkt.num_vcpu; count++) {
 			if (pol->core_share[count].status != 1)
 				power_manager_scale_core_med(
 						pol->core_share[count].pcpu);
 		}
-	} else if (pol->pkt.workload == LOW) {
+	} else if (pol->pkt.workload == RTE_POWER_WL_LOW) {
 		for (count = 0; count < pol->pkt.num_vcpu; count++) {
 			if (pol->core_share[count].status != 1)
 				power_manager_scale_core_min(
@@ -676,11 +682,11 @@ apply_policy(struct policy *pol)
 	struct rte_power_channel_packet *pkt = &pol->pkt;
 
 	/*Check policy to use*/
-	if (pkt->policy_to_use == TRAFFIC)
+	if (pkt->policy_to_use == RTE_POWER_POLICY_TRAFFIC)
 		apply_traffic_profile(pol);
-	else if (pkt->policy_to_use == TIME)
+	else if (pkt->policy_to_use == RTE_POWER_POLICY_TIME)
 		apply_time_profile(pol);
-	else if (pkt->policy_to_use == WORKLOAD)
+	else if (pkt->policy_to_use == RTE_POWER_POLICY_WORKLOAD)
 		apply_workload_profile(pol);
 }
 
@@ -726,13 +732,13 @@ send_freq(struct rte_power_channel_packet *pkt,
 	if (get_info_vm(pkt->vm_name, &info) != 0)
 		return -1;
 
-	if (!freq_list && vcore_id >= MAX_VCPU_PER_VM)
+	if (!freq_list && vcore_id >= RTE_POWER_MAX_VCPU_PER_VM)
 		return -1;
 
 	if (!info.allow_query)
 		return -1;
 
-	channel_pkt_freq_list.command = CPU_POWER_FREQ_LIST;
+	channel_pkt_freq_list.command = RTE_POWER_FREQ_LIST;
 	channel_pkt_freq_list.num_vcpu = info.num_vcpus;
 
 	if (freq_list) {
@@ -764,13 +770,13 @@ send_capabilities(struct rte_power_channel_packet *pkt,
 	if (get_info_vm(pkt->vm_name, &info) != 0)
 		return -1;
 
-	if (!list_requested && vcore_id >= MAX_VCPU_PER_VM)
+	if (!list_requested && vcore_id >= RTE_POWER_MAX_VCPU_PER_VM)
 		return -1;
 
 	if (!info.allow_query)
 		return -1;
 
-	channel_pkt_caps_list.command = CPU_POWER_CAPS_LIST;
+	channel_pkt_caps_list.command = RTE_POWER_CAPS_LIST;
 	channel_pkt_caps_list.num_vcpu = info.num_vcpus;
 
 	if (list_requested) {
@@ -828,10 +834,10 @@ process_request(struct rte_power_channel_packet *pkt,
 			CHANNEL_MGR_CHANNEL_PROCESSING) == 0)
 		return -1;
 
-	if (pkt->command == CPU_POWER) {
+	if (pkt->command == RTE_POWER_CPU_POWER) {
 		unsigned int core_num;
 
-		if (pkt->core_type == CORE_TYPE_VIRTUAL)
+		if (pkt->core_type == RTE_POWER_CORE_TYPE_VIRTUAL)
 			core_num = get_pcpu(chan_info, pkt->resource_id);
 		else
 			core_num = pkt->resource_id;
@@ -843,22 +849,22 @@ process_request(struct rte_power_channel_packet *pkt,
 		bool valid_unit = true;
 
 		switch (pkt->unit) {
-		case(CPU_POWER_SCALE_MIN):
+		case(RTE_POWER_SCALE_MIN):
 			scale_res = power_manager_scale_core_min(core_num);
 			break;
-		case(CPU_POWER_SCALE_MAX):
+		case(RTE_POWER_SCALE_MAX):
 			scale_res = power_manager_scale_core_max(core_num);
 			break;
-		case(CPU_POWER_SCALE_DOWN):
+		case(RTE_POWER_SCALE_DOWN):
 			scale_res = power_manager_scale_core_down(core_num);
 			break;
-		case(CPU_POWER_SCALE_UP):
+		case(RTE_POWER_SCALE_UP):
 			scale_res = power_manager_scale_core_up(core_num);
 			break;
-		case(CPU_POWER_ENABLE_TURBO):
+		case(RTE_POWER_ENABLE_TURBO):
 			scale_res = power_manager_enable_turbo_core(core_num);
 			break;
-		case(CPU_POWER_DISABLE_TURBO):
+		case(RTE_POWER_DISABLE_TURBO):
 			scale_res = power_manager_disable_turbo_core(core_num);
 			break;
 		default:
@@ -870,8 +876,8 @@ process_request(struct rte_power_channel_packet *pkt,
 			ret = send_ack_for_received_cmd(pkt,
 					chan_info,
 					scale_res >= 0 ?
-						CPU_POWER_CMD_ACK :
-						CPU_POWER_CMD_NACK);
+						RTE_POWER_CMD_ACK :
+						RTE_POWER_CMD_NACK);
 			if (ret < 0)
 				RTE_LOG(ERR, CHANNEL_MONITOR, "Error during sending ack command.\n");
 		} else
@@ -879,19 +885,19 @@ process_request(struct rte_power_channel_packet *pkt,
 
 	}
 
-	if (pkt->command == PKT_POLICY) {
+	if (pkt->command == RTE_POWER_PKT_POLICY) {
 		RTE_LOG(INFO, CHANNEL_MONITOR, "Processing policy request %s\n",
 				pkt->vm_name);
 		int ret = send_ack_for_received_cmd(pkt,
 				chan_info,
-				CPU_POWER_CMD_ACK);
+				RTE_POWER_CMD_ACK);
 		if (ret < 0)
 			RTE_LOG(ERR, CHANNEL_MONITOR, "Error during sending ack command.\n");
 		update_policy(pkt);
 		policy_is_set = 1;
 	}
 
-	if (pkt->command == PKT_POLICY_REMOVE) {
+	if (pkt->command == RTE_POWER_PKT_POLICY_REMOVE) {
 		ret = remove_policy(pkt);
 		if (ret == 0)
 			RTE_LOG(INFO, CHANNEL_MONITOR,
@@ -901,26 +907,26 @@ process_request(struct rte_power_channel_packet *pkt,
 				 "Policy %s does not exist\n", pkt->vm_name);
 	}
 
-	if (pkt->command == CPU_POWER_QUERY_FREQ_LIST ||
-		pkt->command == CPU_POWER_QUERY_FREQ) {
+	if (pkt->command == RTE_POWER_QUERY_FREQ_LIST ||
+		pkt->command == RTE_POWER_QUERY_FREQ) {
 
 		RTE_LOG(INFO, CHANNEL_MONITOR,
 			"Frequency for %s requested.\n", pkt->vm_name);
 		int ret = send_freq(pkt,
 				chan_info,
-				pkt->command == CPU_POWER_QUERY_FREQ_LIST);
+				pkt->command == RTE_POWER_QUERY_FREQ_LIST);
 		if (ret < 0)
 			RTE_LOG(ERR, CHANNEL_MONITOR, "Error during frequency sending.\n");
 	}
 
-	if (pkt->command == CPU_POWER_QUERY_CAPS_LIST ||
-		pkt->command == CPU_POWER_QUERY_CAPS) {
+	if (pkt->command == RTE_POWER_QUERY_CAPS_LIST ||
+		pkt->command == RTE_POWER_QUERY_CAPS) {
 
 		RTE_LOG(INFO, CHANNEL_MONITOR,
 			"Capabilities for %s requested.\n", pkt->vm_name);
 		int ret = send_capabilities(pkt,
 				chan_info,
-				pkt->command == CPU_POWER_QUERY_CAPS_LIST);
+				pkt->command == RTE_POWER_QUERY_CAPS_LIST);
 		if (ret < 0)
 			RTE_LOG(ERR, CHANNEL_MONITOR, "Error during sending capabilities.\n");
 	}
diff --git a/examples/vm_power_manager/channel_monitor.h b/examples/vm_power_manager/channel_monitor.h
index 0ca6207ad..5d3537b91 100644
--- a/examples/vm_power_manager/channel_monitor.h
+++ b/examples/vm_power_manager/channel_monitor.h
@@ -19,10 +19,10 @@ struct core_share {
 
 struct policy {
 	struct rte_power_channel_packet pkt;
-	uint32_t pfid[MAX_VFS];
-	uint32_t port[MAX_VFS];
+	uint32_t pfid[RTE_POWER_MAX_VFS];
+	uint32_t port[RTE_POWER_MAX_VFS];
 	unsigned int enabled;
-	struct core_share core_share[MAX_VCPU_PER_VM];
+	struct core_share core_share[RTE_POWER_MAX_VCPU_PER_VM];
 };
 
 #ifdef __cplusplus
diff --git a/examples/vm_power_manager/guest_cli/main.c b/examples/vm_power_manager/guest_cli/main.c
index fc7a8c30a..4e17f7fb9 100644
--- a/examples/vm_power_manager/guest_cli/main.c
+++ b/examples/vm_power_manager/guest_cli/main.c
@@ -50,8 +50,8 @@ parse_args(int argc, char **argv)
 	};
 	struct rte_power_channel_packet *policy;
 	unsigned short int hours[MAX_HOURS];
-	unsigned short int cores[MAX_VCPU_PER_VM];
-	unsigned short int ports[MAX_VCPU_PER_VM];
+	unsigned short int cores[RTE_POWER_MAX_VCPU_PER_VM];
+	unsigned short int ports[RTE_POWER_MAX_VCPU_PER_VM];
 	int i, cnt, idx;
 
 	policy = get_policy();
@@ -69,7 +69,8 @@ parse_args(int argc, char **argv)
 		switch (opt) {
 		/* portmask */
 		case 'n':
-			strlcpy(policy->vm_name, optarg, VM_MAX_NAME_SZ);
+			strlcpy(policy->vm_name, optarg,
+					RTE_POWER_VM_MAX_NAME_SZ);
 			printf("Setting VM Name to [%s]\n", policy->vm_name);
 			break;
 		case 'b':
@@ -97,14 +98,15 @@ parse_args(int argc, char **argv)
 			}
 			break;
 		case 'l':
-			cnt = parse_set(optarg, cores, MAX_VCPU_PER_VM);
+			cnt = parse_set(optarg, cores,
+					RTE_POWER_MAX_VCPU_PER_VM);
 			if (cnt < 0) {
 				printf("Invalid value passed to vcpu-list - [%s]\n",
 						optarg);
 				break;
 			}
 			idx = 0;
-			for (i = 0; i < MAX_VCPU_PER_VM; i++) {
+			for (i = 0; i < RTE_POWER_MAX_VCPU_PER_VM; i++) {
 				if (cores[i]) {
 					printf("***Using core %d\n", i);
 					policy->vcpu_to_control[idx++] = i;
@@ -114,14 +116,15 @@ parse_args(int argc, char **argv)
 			printf("Total cores: %d\n", idx);
 			break;
 		case 'p':
-			cnt = parse_set(optarg, ports, MAX_VCPU_PER_VM);
+			cnt = parse_set(optarg, ports,
+					RTE_POWER_MAX_VCPU_PER_VM);
 			if (cnt < 0) {
 				printf("Invalid value passed to port-list - [%s]\n",
 						optarg);
 				break;
 			}
 			idx = 0;
-			for (i = 0; i < MAX_VCPU_PER_VM; i++) {
+			for (i = 0; i < RTE_POWER_MAX_VCPU_PER_VM; i++) {
 				if (ports[i]) {
 					printf("***Using port %d\n", i);
 					if (set_policy_mac(i, idx++) != 0) {
@@ -135,13 +138,17 @@ parse_args(int argc, char **argv)
 			break;
 		case 'o':
 			if (!strcmp(optarg, "TRAFFIC"))
-				policy->policy_to_use = TRAFFIC;
+				policy->policy_to_use =
+						RTE_POWER_POLICY_TRAFFIC;
 			else if (!strcmp(optarg, "TIME"))
-				policy->policy_to_use = TIME;
+				policy->policy_to_use =
+						RTE_POWER_POLICY_TIME;
 			else if (!strcmp(optarg, "WORKLOAD"))
-				policy->policy_to_use = WORKLOAD;
+				policy->policy_to_use =
+						RTE_POWER_POLICY_WORKLOAD;
 			else if (!strcmp(optarg, "BRANCH_RATIO"))
-				policy->policy_to_use = BRANCH_RATIO;
+				policy->policy_to_use =
+						RTE_POWER_POLICY_BRANCH_RATIO;
 			else {
 				printf("Invalid policy specified: %s\n",
 						optarg);
diff --git a/examples/vm_power_manager/guest_cli/vm_power_cli_guest.c b/examples/vm_power_manager/guest_cli/vm_power_cli_guest.c
index 125dfeb10..ec6409abd 100644
--- a/examples/vm_power_manager/guest_cli/vm_power_cli_guest.c
+++ b/examples/vm_power_manager/guest_cli/vm_power_cli_guest.c
@@ -103,10 +103,10 @@ set_policy_defaults(struct rte_power_channel_packet *pkt)
 	pkt->timer_policy.hours_to_use_traffic_profile[0] = 8;
 	pkt->timer_policy.hours_to_use_traffic_profile[1] = 10;
 
-	pkt->core_type = CORE_TYPE_VIRTUAL;
-	pkt->workload = LOW;
-	pkt->policy_to_use = TIME;
-	pkt->command = PKT_POLICY;
+	pkt->core_type = RTE_POWER_CORE_TYPE_VIRTUAL;
+	pkt->workload = RTE_POWER_WL_LOW;
+	pkt->policy_to_use = RTE_POWER_POLICY_TIME;
+	pkt->command = RTE_POWER_PKT_POLICY;
 	strlcpy(pkt->vm_name, "ubuntu2", sizeof(pkt->vm_name));
 
 	return 0;
@@ -169,7 +169,7 @@ receive_freq_list(struct rte_power_channel_packet_freq_list *pkt_freq_list,
 		RTE_LOG(ERR, GUEST_CLI, "Error receiving message.\n");
 		return -1;
 	}
-	if (pkt_freq_list->command != CPU_POWER_FREQ_LIST) {
+	if (pkt_freq_list->command != RTE_POWER_FREQ_LIST) {
 		RTE_LOG(ERR, GUEST_CLI, "Unexpected message received.\n");
 		return -1;
 	}
@@ -203,18 +203,18 @@ cmd_query_freq_list_parsed(void *parsed_result,
 			return;
 		}
 
-		pkt.command = CPU_POWER_QUERY_FREQ_LIST;
+		pkt.command = RTE_POWER_QUERY_FREQ_LIST;
 		strlcpy(pkt.vm_name, policy.vm_name, sizeof(pkt.vm_name));
 		query_list = true;
 	} else {
 		errno = 0;
 		lcore_id = (unsigned int)strtol(res->cpu_num, &ep, 10);
-		if (errno != 0 || lcore_id >= MAX_VCPU_PER_VM ||
+		if (errno != 0 || lcore_id >= RTE_POWER_MAX_VCPU_PER_VM ||
 			ep == res->cpu_num) {
 			cmdline_printf(cl, "Invalid parameter provided.\n");
 			return;
 		}
-		pkt.command = CPU_POWER_QUERY_FREQ;
+		pkt.command = RTE_POWER_QUERY_FREQ;
 		strlcpy(pkt.vm_name, policy.vm_name, sizeof(pkt.vm_name));
 		pkt.resource_id = lcore_id;
 	}
@@ -279,7 +279,7 @@ receive_capabilities(struct rte_power_channel_packet_caps_list *pkt_caps_list,
 		RTE_LOG(ERR, GUEST_CLI, "Error receiving message.\n");
 		return -1;
 	}
-	if (pkt_caps_list->command != CPU_POWER_CAPS_LIST) {
+	if (pkt_caps_list->command != RTE_POWER_CAPS_LIST) {
 		RTE_LOG(ERR, GUEST_CLI, "Unexpected message received.\n");
 		return -1;
 	}
@@ -313,18 +313,18 @@ cmd_query_caps_list_parsed(void *parsed_result,
 			return;
 		}
 
-		pkt.command = CPU_POWER_QUERY_CAPS_LIST;
+		pkt.command = RTE_POWER_QUERY_CAPS_LIST;
 		strlcpy(pkt.vm_name, policy.vm_name, sizeof(pkt.vm_name));
 		query_list = true;
 	} else {
 		errno = 0;
 		lcore_id = (unsigned int)strtol(res->cpu_num, &ep, 10);
-		if (errno != 0 || lcore_id >= MAX_VCPU_PER_VM ||
+		if (errno != 0 || lcore_id >= RTE_POWER_MAX_VCPU_PER_VM ||
 			ep == res->cpu_num) {
 			cmdline_printf(cl, "Invalid parameter provided.\n");
 			return;
 		}
-		pkt.command = CPU_POWER_QUERY_CAPS;
+		pkt.command = RTE_POWER_QUERY_CAPS;
 		strlcpy(pkt.vm_name, policy.vm_name, sizeof(pkt.vm_name));
 		pkt.resource_id = lcore_id;
 	}
@@ -388,10 +388,10 @@ check_response_cmd(unsigned int lcore_id, int *result)
 		return -1;
 
 	switch (pkt.command) {
-	case(CPU_POWER_CMD_ACK):
+	case(RTE_POWER_CMD_ACK):
 		*result = 1;
 		break;
-	case(CPU_POWER_CMD_NACK):
+	case(RTE_POWER_CMD_NACK):
 		*result = 0;
 		break;
 	default:
diff --git a/examples/vm_power_manager/main.c b/examples/vm_power_manager/main.c
index 75d5b5364..799d7b9bc 100644
--- a/examples/vm_power_manager/main.c
+++ b/examples/vm_power_manager/main.c
@@ -394,7 +394,7 @@ main(int argc, char **argv)
 					"Cannot init port %"PRIu8 "\n",
 					portid);
 
-			for (w = 0; w < MAX_VFS; w++) {
+			for (w = 0; w < RTE_POWER_MAX_VFS; w++) {
 				eth.addr_bytes[5] = w + 0xf0;
 
 				ret = -ENOTSUP;
diff --git a/lib/librte_power/guest_channel.c b/lib/librte_power/guest_channel.c
index 9eb2f6330..039cb1872 100644
--- a/lib/librte_power/guest_channel.c
+++ b/lib/librte_power/guest_channel.c
@@ -100,7 +100,7 @@ guest_channel_host_connect(const char *path, unsigned int lcore_id)
 	/* Send a test packet, this command is ignored by the host, but a successful
 	 * send indicates that the host endpoint is monitoring.
 	 */
-	pkt.command = CPU_POWER_CONNECT;
+	pkt.command = RTE_POWER_CPU_POWER_CONNECT;
 	global_fds[lcore_id] = fd;
 	ret = guest_channel_send_msg(&pkt, lcore_id);
 	if (ret != 0) {
diff --git a/lib/librte_power/power_kvm_vm.c b/lib/librte_power/power_kvm_vm.c
index 9ae438489..27f9937aa 100644
--- a/lib/librte_power/power_kvm_vm.c
+++ b/lib/librte_power/power_kvm_vm.c
@@ -29,7 +29,7 @@ power_kvm_vm_init(unsigned int lcore_id)
 				lcore_id, RTE_MAX_LCORE-1);
 		return -1;
 	}
-	pkt[lcore_id].command = CPU_POWER;
+	pkt[lcore_id].command = RTE_POWER_CPU_POWER;
 	pkt[lcore_id].resource_id = lcore_id;
 	return guest_channel_host_connect(FD_PATH, lcore_id);
 }
@@ -90,25 +90,25 @@ send_msg(unsigned int lcore_id, uint32_t scale_direction)
 int
 power_kvm_vm_freq_up(unsigned int lcore_id)
 {
-	return send_msg(lcore_id, CPU_POWER_SCALE_UP);
+	return send_msg(lcore_id, RTE_POWER_SCALE_UP);
 }
 
 int
 power_kvm_vm_freq_down(unsigned int lcore_id)
 {
-	return send_msg(lcore_id, CPU_POWER_SCALE_DOWN);
+	return send_msg(lcore_id, RTE_POWER_SCALE_DOWN);
 }
 
 int
 power_kvm_vm_freq_max(unsigned int lcore_id)
 {
-	return send_msg(lcore_id, CPU_POWER_SCALE_MAX);
+	return send_msg(lcore_id, RTE_POWER_SCALE_MAX);
 }
 
 int
 power_kvm_vm_freq_min(unsigned int lcore_id)
 {
-	return send_msg(lcore_id, CPU_POWER_SCALE_MIN);
+	return send_msg(lcore_id, RTE_POWER_SCALE_MIN);
 }
 
 int
@@ -121,13 +121,13 @@ power_kvm_vm_turbo_status(__rte_unused unsigned int lcore_id)
 int
 power_kvm_vm_enable_turbo(unsigned int lcore_id)
 {
-	return send_msg(lcore_id, CPU_POWER_ENABLE_TURBO);
+	return send_msg(lcore_id, RTE_POWER_ENABLE_TURBO);
 }
 
 int
 power_kvm_vm_disable_turbo(unsigned int lcore_id)
 {
-	return send_msg(lcore_id, CPU_POWER_DISABLE_TURBO);
+	return send_msg(lcore_id, RTE_POWER_DISABLE_TURBO);
 }
 
 struct rte_power_core_capabilities;
diff --git a/lib/librte_power/rte_power_guest_channel.h b/lib/librte_power/rte_power_guest_channel.h
index c9ab7bae8..b9273a025 100644
--- a/lib/librte_power/rte_power_guest_channel.h
+++ b/lib/librte_power/rte_power_guest_channel.h
@@ -11,63 +11,65 @@ extern "C" {
 #include <stdint.h>
 #include <stdbool.h>
 
-#define MAX_VFS 10
-#define VM_MAX_NAME_SZ 32
-#define MAX_VCPU_PER_VM         8
-#define HOURS 24
+#define RTE_POWER_MAX_VFS 10
+#define RTE_POWER_VM_MAX_NAME_SZ 32
+#define RTE_POWER_MAX_VCPU_PER_VM 8
+#define RTE_POWER_HOURS_PER_DAY 24
 
 /* Valid Commands */
-#define CPU_POWER               1
-#define CPU_POWER_CONNECT       2
-#define PKT_POLICY              3
-#define PKT_POLICY_REMOVE       4
+#define RTE_POWER_CPU_POWER               1
+#define RTE_POWER_CPU_POWER_CONNECT       2
+#define RTE_POWER_PKT_POLICY              3
+#define RTE_POWER_PKT_POLICY_REMOVE       4
 
-#define CORE_TYPE_VIRTUAL 0
-#define CORE_TYPE_PHYSICAL 1
+#define RTE_POWER_CORE_TYPE_VIRTUAL 0
+#define RTE_POWER_CORE_TYPE_PHYSICAL 1
 
 /* CPU Power Command Scaling */
-#define CPU_POWER_SCALE_UP      1
-#define CPU_POWER_SCALE_DOWN    2
-#define CPU_POWER_SCALE_MAX     3
-#define CPU_POWER_SCALE_MIN     4
-#define CPU_POWER_ENABLE_TURBO  5
-#define CPU_POWER_DISABLE_TURBO 6
+#define RTE_POWER_SCALE_UP      1
+#define RTE_POWER_SCALE_DOWN    2
+#define RTE_POWER_SCALE_MAX     3
+#define RTE_POWER_SCALE_MIN     4
+#define RTE_POWER_ENABLE_TURBO  5
+#define RTE_POWER_DISABLE_TURBO 6
 
 /* CPU Power Queries */
-#define CPU_POWER_QUERY_FREQ_LIST  7
-#define CPU_POWER_QUERY_FREQ       8
-#define CPU_POWER_QUERY_CAPS_LIST  9
-#define CPU_POWER_QUERY_CAPS       10
-
-/* --- Outgoing messages --- */
+#define RTE_POWER_QUERY_FREQ_LIST  7
+#define RTE_POWER_QUERY_FREQ       8
+#define RTE_POWER_QUERY_CAPS_LIST  9
+#define RTE_POWER_QUERY_CAPS       10
 
 /* Generic Power Command Response */
-#define CPU_POWER_CMD_ACK       1
-#define CPU_POWER_CMD_NACK      2
+#define RTE_POWER_CMD_ACK       1
+#define RTE_POWER_CMD_NACK      2
 
 /* CPU Power Query Responses */
-#define CPU_POWER_FREQ_LIST     3
-#define CPU_POWER_CAPS_LIST     4
+#define RTE_POWER_FREQ_LIST     3
+#define RTE_POWER_CAPS_LIST     4
 
-struct rte_power_timer_profile {
-	int busy_hours[HOURS];
-	int quiet_hours[HOURS];
-	int hours_to_use_traffic_profile[HOURS];
+struct rte_power_traffic_policy {
+	uint32_t min_packet_thresh;
+	uint32_t avg_max_packet_thresh;
+	uint32_t max_max_packet_thresh;
 };
 
-enum rte_power_workload_level {HIGH, MEDIUM, LOW};
+struct rte_power_timer_profile {
+	int busy_hours[RTE_POWER_HOURS_PER_DAY];
+	int quiet_hours[RTE_POWER_HOURS_PER_DAY];
+	int hours_to_use_traffic_profile[RTE_POWER_HOURS_PER_DAY];
+};
 
-enum rte_power_policy {
-	TRAFFIC,
-	TIME,
-	WORKLOAD,
-	BRANCH_RATIO
+enum rte_power_workload_level {
+	RTE_POWER_WL_HIGH,
+	RTE_POWER_WL_MEDIUM,
+	RTE_POWER_WL_LOW
 };
 
-struct rte_power_traffic_policy {
-	uint32_t min_packet_thresh;
-	uint32_t avg_max_packet_thresh;
-	uint32_t max_max_packet_thresh;
+enum rte_power_policy {
+	RTE_POWER_POLICY_TRAFFIC,
+	RTE_POWER_POLICY_TIME,
+	RTE_POWER_POLICY_WORKLOAD,
+	RTE_POWER_POLICY_BRANCH_RATIO
 };
 
 struct rte_power_turbo_status {
@@ -78,12 +80,12 @@ struct rte_power_channel_packet {
 	uint64_t resource_id; /**< core_num, device */
 	uint32_t unit;        /**< scale down/up/min/max */
 	uint32_t command;     /**< Power, IO, etc */
-	char vm_name[VM_MAX_NAME_SZ];
+	char vm_name[RTE_POWER_VM_MAX_NAME_SZ];
 
-	uint64_t vfid[MAX_VFS];
+	uint64_t vfid[RTE_POWER_MAX_VFS];
 	int nb_mac_to_monitor;
 	struct rte_power_traffic_policy traffic_policy;
-	uint8_t vcpu_to_control[MAX_VCPU_PER_VM];
+	uint8_t vcpu_to_control[RTE_POWER_MAX_VCPU_PER_VM];
 	uint8_t num_vcpu;
 	struct rte_power_timer_profile timer_policy;
 	bool core_type;
@@ -96,9 +98,9 @@ struct rte_power_channel_packet_freq_list {
 	uint64_t resource_id; /**< core_num, device */
 	uint32_t unit;        /**< scale down/up/min/max */
 	uint32_t command;     /**< Power, IO, etc */
-	char vm_name[VM_MAX_NAME_SZ];
+	char vm_name[RTE_POWER_VM_MAX_NAME_SZ];
 
-	uint32_t freq_list[MAX_VCPU_PER_VM];
+	uint32_t freq_list[RTE_POWER_MAX_VCPU_PER_VM];
 	uint8_t num_vcpu;
 };
 
@@ -106,10 +108,10 @@ struct rte_power_channel_packet_caps_list {
 	uint64_t resource_id; /**< core_num, device */
 	uint32_t unit;        /**< scale down/up/min/max */
 	uint32_t command;     /**< Power, IO, etc */
-	char vm_name[VM_MAX_NAME_SZ];
+	char vm_name[RTE_POWER_VM_MAX_NAME_SZ];
 
-	uint64_t turbo[MAX_VCPU_PER_VM];
-	uint64_t priority[MAX_VCPU_PER_VM];
+	uint64_t turbo[RTE_POWER_MAX_VCPU_PER_VM];
+	uint64_t priority[RTE_POWER_MAX_VCPU_PER_VM];
 	uint8_t num_vcpu;
 };
 
-- 
2.17.1


^ permalink raw reply	[flat|nested] 69+ messages in thread

* [dpdk-dev] [PATCH v5 5/6] power: add new header file to export list
  2021-01-29 10:21             ` [dpdk-dev] [PATCH v5 0/6] power: fix make build for power apps David Hunt
                                 ` (3 preceding siblings ...)
  2021-01-29 10:21               ` [dpdk-dev] [PATCH v5 4/6] power: rename defines David Hunt
@ 2021-01-29 10:21               ` David Hunt
  2021-01-29 10:21               ` [dpdk-dev] [PATCH v5 6/6] power: clean up includes David Hunt
  2021-01-29 10:30               ` [dpdk-dev] [PATCH v5 0/6] power: fix make build for power apps Thomas Monjalon
  6 siblings, 0 replies; 69+ messages in thread
From: David Hunt @ 2021-01-29 10:21 UTC (permalink / raw)
  To: dev; +Cc: david.hunt, stable, Bruce Richardson

From: Bruce Richardson <bruce.richardson@intel.com>

Adjust meson.build so that 'ninja install' copies the new header
file into the installation directory.

Fixes: 210c383e247b ("power: packet format for vm power management")
Fixes: cd0d5547e873 ("power: vm communication channels in guest")
Cc: stable@dpdk.org

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: David Hunt <david.hunt@intel.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
 lib/librte_power/meson.build | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/librte_power/meson.build b/lib/librte_power/meson.build
index 4b4cf1b90..541569528 100644
--- a/lib/librte_power/meson.build
+++ b/lib/librte_power/meson.build
@@ -10,5 +10,6 @@ sources = files('rte_power.c', 'power_acpi_cpufreq.c',
 		'rte_power_empty_poll.c',
 		'power_pstate_cpufreq.c',
 		'power_common.c')
-headers = files('rte_power.h','rte_power_empty_poll.h')
+headers = files('rte_power.h','rte_power_empty_poll.h',
+	'rte_power_guest_channel.h')
 deps += ['timer']
-- 
2.17.1


^ permalink raw reply	[flat|nested] 69+ messages in thread

* [dpdk-dev] [PATCH v5 6/6] power: clean up includes
  2021-01-29 10:21             ` [dpdk-dev] [PATCH v5 0/6] power: fix make build for power apps David Hunt
                                 ` (4 preceding siblings ...)
  2021-01-29 10:21               ` [dpdk-dev] [PATCH v5 5/6] power: add new header file to export list David Hunt
@ 2021-01-29 10:21               ` David Hunt
  2021-01-29 10:30               ` [dpdk-dev] [PATCH v5 0/6] power: fix make build for power apps Thomas Monjalon
  6 siblings, 0 replies; 69+ messages in thread
From: David Hunt @ 2021-01-29 10:21 UTC (permalink / raw)
  To: dev; +Cc: david.hunt, stable, Bruce Richardson

From: Bruce Richardson <bruce.richardson@intel.com>

re-organise the including of the new public header file and
remove un-needed includes

Fixes: 210c383e247b ("power: packet format for vm power management")
Fixes: cd0d5547e873 ("power: vm communication channels in guest")
Cc: stable@dpdk.org

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: David Hunt <david.hunt@intel.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
 examples/vm_power_manager/channel_manager.c              | 1 -
 examples/vm_power_manager/channel_monitor.c              | 1 -
 examples/vm_power_manager/channel_monitor.h              | 2 +-
 examples/vm_power_manager/guest_cli/vm_power_cli_guest.c | 1 -
 examples/vm_power_manager/guest_cli/vm_power_cli_guest.h | 2 --
 examples/vm_power_manager/vm_power_cli.c                 | 1 -
 lib/librte_power/guest_channel.c                         | 2 +-
 lib/librte_power/guest_channel.h                         | 2 --
 lib/librte_power/power_kvm_vm.c                          | 2 +-
 lib/librte_power/rte_power.h                             | 1 +
 lib/librte_power/rte_power_guest_channel.h               | 3 ---
 11 files changed, 4 insertions(+), 14 deletions(-)

diff --git a/examples/vm_power_manager/channel_manager.c b/examples/vm_power_manager/channel_manager.c
index 58a243b23..458e37167 100644
--- a/examples/vm_power_manager/channel_manager.c
+++ b/examples/vm_power_manager/channel_manager.c
@@ -27,7 +27,6 @@
 #include <libvirt/libvirt.h>
 
 #include "channel_manager.h"
-#include "rte_power_guest_channel.h"
 #include "channel_monitor.h"
 #include "power_manager.h"
 
diff --git a/examples/vm_power_manager/channel_monitor.c b/examples/vm_power_manager/channel_monitor.c
index 7bb33e026..99f81544d 100644
--- a/examples/vm_power_manager/channel_monitor.c
+++ b/examples/vm_power_manager/channel_monitor.c
@@ -35,7 +35,6 @@
 
 #include <libvirt/libvirt.h>
 #include "channel_monitor.h"
-#include "rte_power_guest_channel.h"
 #include "channel_manager.h"
 #include "power_manager.h"
 #include "oob_monitor.h"
diff --git a/examples/vm_power_manager/channel_monitor.h b/examples/vm_power_manager/channel_monitor.h
index 5d3537b91..9184a8327 100644
--- a/examples/vm_power_manager/channel_monitor.h
+++ b/examples/vm_power_manager/channel_monitor.h
@@ -5,8 +5,8 @@
 #ifndef CHANNEL_MONITOR_H_
 #define CHANNEL_MONITOR_H_
 
+#include <rte_power.h>
 #include "channel_manager.h"
-#include "rte_power_guest_channel.h"
 
 struct core_share {
 	unsigned int pcpu;
diff --git a/examples/vm_power_manager/guest_cli/vm_power_cli_guest.c b/examples/vm_power_manager/guest_cli/vm_power_cli_guest.c
index ec6409abd..0bf5774ff 100644
--- a/examples/vm_power_manager/guest_cli/vm_power_cli_guest.c
+++ b/examples/vm_power_manager/guest_cli/vm_power_cli_guest.c
@@ -19,7 +19,6 @@
 #include <rte_ethdev.h>
 
 #include <rte_power.h>
-#include <guest_channel.h>
 
 #include "vm_power_cli_guest.h"
 
diff --git a/examples/vm_power_manager/guest_cli/vm_power_cli_guest.h b/examples/vm_power_manager/guest_cli/vm_power_cli_guest.h
index 5d285ca9d..b578ec072 100644
--- a/examples/vm_power_manager/guest_cli/vm_power_cli_guest.h
+++ b/examples/vm_power_manager/guest_cli/vm_power_cli_guest.h
@@ -9,8 +9,6 @@
 extern "C" {
 #endif
 
-#include "rte_power_guest_channel.h"
-
 struct rte_power_channel_packet *get_policy(void);
 
 int set_policy_mac(int port, int idx);
diff --git a/examples/vm_power_manager/vm_power_cli.c b/examples/vm_power_manager/vm_power_cli.c
index f7e1b596e..1a55e553b 100644
--- a/examples/vm_power_manager/vm_power_cli.c
+++ b/examples/vm_power_manager/vm_power_cli.c
@@ -21,7 +21,6 @@
 #include "channel_manager.h"
 #include "channel_monitor.h"
 #include "power_manager.h"
-#include "rte_power_guest_channel.h"
 
 struct cmd_quit_result {
 	cmdline_fixed_string_t quit;
diff --git a/lib/librte_power/guest_channel.c b/lib/librte_power/guest_channel.c
index 039cb1872..2f7507a03 100644
--- a/lib/librte_power/guest_channel.c
+++ b/lib/librte_power/guest_channel.c
@@ -15,9 +15,9 @@
 
 
 #include <rte_log.h>
+#include <rte_power.h>
 
 #include "guest_channel.h"
-#include "rte_power_guest_channel.h"
 
 #define RTE_LOGTYPE_GUEST_CHANNEL RTE_LOGTYPE_USER1
 
diff --git a/lib/librte_power/guest_channel.h b/lib/librte_power/guest_channel.h
index 7d3a909d9..24f609df3 100644
--- a/lib/librte_power/guest_channel.h
+++ b/lib/librte_power/guest_channel.h
@@ -8,8 +8,6 @@
 extern "C" {
 #endif
 
-#include <rte_power_guest_channel.h>
-
 /**
  * Check if any Virtio-Serial VM end-points exist in path.
  *
diff --git a/lib/librte_power/power_kvm_vm.c b/lib/librte_power/power_kvm_vm.c
index 27f9937aa..ab7d4b8ce 100644
--- a/lib/librte_power/power_kvm_vm.c
+++ b/lib/librte_power/power_kvm_vm.c
@@ -6,8 +6,8 @@
 
 #include <rte_log.h>
 
-#include "guest_channel.h"
 #include "rte_power_guest_channel.h"
+#include "guest_channel.h"
 #include "power_kvm_vm.h"
 #include "power_common.h"
 
diff --git a/lib/librte_power/rte_power.h b/lib/librte_power/rte_power.h
index bbbde4dfb..c8086bf6b 100644
--- a/lib/librte_power/rte_power.h
+++ b/lib/librte_power/rte_power.h
@@ -14,6 +14,7 @@
 #include <rte_byteorder.h>
 #include <rte_log.h>
 #include <rte_string_fns.h>
+#include <rte_power_guest_channel.h>
 
 #ifdef __cplusplus
 extern "C" {
diff --git a/lib/librte_power/rte_power_guest_channel.h b/lib/librte_power/rte_power_guest_channel.h
index b9273a025..adc973817 100644
--- a/lib/librte_power/rte_power_guest_channel.h
+++ b/lib/librte_power/rte_power_guest_channel.h
@@ -8,9 +8,6 @@
 extern "C" {
 #endif
 
-#include <stdint.h>
-#include <stdbool.h>
-
 #define RTE_POWER_MAX_VFS 10
 #define RTE_POWER_VM_MAX_NAME_SZ 32
 #define RTE_POWER_MAX_VCPU_PER_VM 8
-- 
2.17.1


^ permalink raw reply	[flat|nested] 69+ messages in thread

* Re: [dpdk-dev] [dpdk-stable] [PATCH v4 0/6] power: fix make build for power apps
  2021-01-21 17:21         ` [dpdk-dev] [PATCH v4 0/6] power: fix make build for power apps David Hunt
                             ` (5 preceding siblings ...)
  2021-01-21 17:22           ` [dpdk-dev] [PATCH v4 6/6] power: clean up includes David Hunt
@ 2021-01-29 10:27           ` Thomas Monjalon
  2021-02-24 14:54           ` [dpdk-dev] [PATCH] power: remove duplicated symbols from map file Ferruh Yigit
  7 siblings, 0 replies; 69+ messages in thread
From: Thomas Monjalon @ 2021-01-29 10:27 UTC (permalink / raw)
  To: David Hunt, bruce.richardson; +Cc: dev, stable

21/01/2021 18:21, David Hunt:
> The guest channel message definitions and functions in guest_channel.h
> are needed by applications and need to be made public.
> 
> This worked pre-20.11, but now with all the meson/ninja changes, making
> these apps externally no longer works. To fix, we need to move the
> header file with the API definitions for the channel commands public,
> and rename the functions accordingly.
> 
> The main change is to rename channel_commands.h to
> rte_power_guest_channel.h so that it gets picked up by the installer
> and copied to /usr/local/include. Other changes include renaming #defines
> to have RTE_ at the beginning instead of CPU_. Finally we refactor the
> code to work with those changes.
> 
> ---
> v2 changes
>  - re-worked from monolithic patch to a 6 patch patchset for easier review
> v3 changes
>   - Ensure both functions added to the API are tagged as experimental
> v4 changes
>   - add @internal tag on 2 functions for Doxygen
>   - add @warning EXPERIMENTAL tag on 2 functions for Doxygen
>   - improve description of lcore param in API docs
>   - Improve maintainability sizeof's
>   - add the 2 added functions to the version.map file

Applied, thanks for the clean-up.




^ permalink raw reply	[flat|nested] 69+ messages in thread

* Re: [dpdk-dev] [PATCH v5 0/6] power: fix make build for power apps
  2021-01-29 10:21             ` [dpdk-dev] [PATCH v5 0/6] power: fix make build for power apps David Hunt
                                 ` (5 preceding siblings ...)
  2021-01-29 10:21               ` [dpdk-dev] [PATCH v5 6/6] power: clean up includes David Hunt
@ 2021-01-29 10:30               ` Thomas Monjalon
  6 siblings, 0 replies; 69+ messages in thread
From: Thomas Monjalon @ 2021-01-29 10:30 UTC (permalink / raw)
  To: David Hunt; +Cc: dev, stable

29/01/2021 11:21, David Hunt:
> The guest channel message definitions and functions in guest_channel.h
> are needed by applications and need to be made public.
> 
> This worked pre-20.11, but now with all the meson/ninja changes, making
> these apps externally no longer works. To fix, we need to move the
> header file with the API definitions for the channel commands public,
> and rename the functions accordingly.
> 
> The main change is to rename channel_commands.h to
> rte_power_guest_channel.h so that it gets picked up by the installer
> and copied to /usr/local/include. Other changes include renaming #defines
> to have RTE_ at the beginning instead of CPU_. Finally we refactor the
> code to work with those changes.
> 
> ---
> v2 changes
>  - re-worked from monolithic patch to a 6 patch patchset for easier review
> v3 changes
>   - Ensure both functions added to the API are tagged as experimental
> v4 changes
>   - add @internal tag on 2 functions for Doxygen
>   - add @warning EXPERIMENTAL tag on 2 functions for Doxygen
>   - improve description of lcore param in API docs
>   - Improve maintainability sizeof's
>   - add the 2 added functions to the version.map file
> v5 changes
>   - moved version.map additions from patch 3 to patch 2

I already applied a modified v4 with the changes requested by Anatoly that you missed in this v5.




^ permalink raw reply	[flat|nested] 69+ messages in thread

* Re: [dpdk-dev] [dpdk-stable] [PATCH v4 2/6] power: make channel msg functions public
  2021-01-21 17:21           ` [dpdk-dev] [PATCH v4 2/6] power: make channel msg functions public David Hunt
  2021-01-22 12:12             ` Burakov, Anatoly
@ 2021-02-22  9:53             ` Ferruh Yigit
  1 sibling, 0 replies; 69+ messages in thread
From: Ferruh Yigit @ 2021-02-22  9:53 UTC (permalink / raw)
  To: David Hunt, dev
  Cc: stable, Bruce Richardson, Anatoly Burakov, David Marchand,
	Thomas Monjalon

On 1/21/2021 5:21 PM, David Hunt wrote:
> From: Bruce Richardson <bruce.richardson@intel.com>
> 
> Move the 2 public functions into rte_power_guest_channel.h
> 
> Fixes: 210c383e247b ("power: packet format for vm power management")
> Fixes: cd0d5547e873 ("power: vm communication channels in guest")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> Signed-off-by: David Hunt <david.hunt@intel.com>

<...>

> index ef3b064a8..c500c0cda 100644
> --- a/lib/librte_power/rte_power_guest_channel.h
> +++ b/lib/librte_power/rte_power_guest_channel.h
> @@ -116,6 +116,56 @@ struct channel_packet_caps_list {
>   	uint8_t num_vcpu;
>   };
>   
> +/**
> + * @internal
> + *
> + * @warning
> + * @b EXPERIMENTAL: this API may change without prior notice.
> + *
> + * Send a message contained in pkt over the Virtio-Serial to the host endpoint.
> + *
> + * @param pkt
> + *  Pointer to a populated struct channel_packet.
> + *
> + * @param lcore_id
> + *  Use channel specific to this lcore_id.
> + *
> + * @return
> + *  - 0 on success.
> + *  - Negative on error.
> + */
> +__rte_experimental
> +int rte_power_guest_channel_send_msg(struct channel_packet *pkt,
> +			unsigned int lcore_id);
> +
> +/**
> + * @internal
> + *
> + * @warning
> + * @b EXPERIMENTAL: this API may change without prior notice.
> + *
> + * Receive a message contained in pkt over the Virtio-Serial
> + * from the host endpoint.
> + *
> + * @param pkt
> + *  Pointer to channel_packet or
> + *  channel_packet_freq_list struct.
> + *
> + * @param pkt_len
> + *  Size of expected data packet.
> + *
> + * @param lcore_id
> + *  Use channel specific to this lcore_id.
> + *
> + * @return
> + *  - 0 on success.
> + *  - Negative on error.
> + */
> +__rte_experimental
> +int rte_power_guest_channel_receive_msg(void *pkt,
> +		size_t pkt_len,
> +		unsigned int lcore_id);
> +

As far as I can see these function are public, so why they have '@internal' tag?

^ permalink raw reply	[flat|nested] 69+ messages in thread

* Re: [dpdk-dev] [dpdk-stable] [PATCH v4 3/6] power: rename public structs
  2021-01-21 17:21           ` [dpdk-dev] [PATCH v4 3/6] power: rename public structs David Hunt
                               ` (2 preceding siblings ...)
  2021-01-28 22:57             ` [dpdk-dev] [dpdk-stable] " Thomas Monjalon
@ 2021-02-22  9:56             ` Ferruh Yigit
  3 siblings, 0 replies; 69+ messages in thread
From: Ferruh Yigit @ 2021-02-22  9:56 UTC (permalink / raw)
  To: David Hunt, dev
  Cc: stable, Bruce Richardson, Anatoly Burakov, David Marchand,
	Thomas Monjalon

On 1/21/2021 5:21 PM, David Hunt wrote:
> From: Bruce Richardson <bruce.richardson@intel.com>
> 
> rename the public structs to have an rte_power_ prefix and
> add them to version.map in experimental section.
> 
> Fixes: 210c383e247b ("power: packet format for vm power management")
> Fixes: cd0d5547e873 ("power: vm communication channels in guest")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> Signed-off-by: David Hunt <david.hunt@intel.com>
> 

<...>

> diff --git a/lib/librte_power/version.map b/lib/librte_power/version.map
> index 69ca9af61..13f0af3b2 100644
> --- a/lib/librte_power/version.map
> +++ b/lib/librte_power/version.map
> @@ -34,4 +34,8 @@ EXPERIMENTAL {
>   	rte_power_guest_channel_receive_msg;
>   	rte_power_poll_stat_fetch;
>   	rte_power_poll_stat_update;
> +
> +	# added in 21.02
> +	rte_power_guest_channel_receive_msg;
> +	rte_power_guest_channel_send_msg;
>   };

These two new symbols are already in the .map file, which is causing a build 
error [1], need to remove the duplicate.

And one of the above symbols is already in the non-experimental section, I guess 
that was a mistake but just to double check, we are not downgrading an existing 
mature API to experimental API, right?



[1]
https://travis-ci.com/github/ovsrobot/dpdk/jobs/484119344

^ permalink raw reply	[flat|nested] 69+ messages in thread

* [dpdk-dev] [PATCH] power: remove duplicated symbols from map file
  2021-01-21 17:21         ` [dpdk-dev] [PATCH v4 0/6] power: fix make build for power apps David Hunt
                             ` (6 preceding siblings ...)
  2021-01-29 10:27           ` [dpdk-dev] [dpdk-stable] [PATCH v4 0/6] power: fix make build for power apps Thomas Monjalon
@ 2021-02-24 14:54           ` Ferruh Yigit
  2021-02-25  9:11             ` David Marchand
  2021-02-25 10:54             ` [dpdk-dev] [PATCH v2] " Ferruh Yigit
  7 siblings, 2 replies; 69+ messages in thread
From: Ferruh Yigit @ 2021-02-24 14:54 UTC (permalink / raw)
  To: David Hunt, Ray Kinsella, Neil Horman, Anatoly Burakov, Bruce Richardson
  Cc: Ferruh Yigit, dev, stable, Aaron Conole, David Marchand,
	Juraj Linkeš

This is also causing build error, like:
https://travis-ci.com/github/ovsrobot/dpdk/jobs/482121104

Also '@internal' marker removed from doxygen comment, since public API
should not be internal.

Fixes: 4d3892dcd77b ("power: make channel message functions public")
Cc: stable@dpdk.org

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
Cc: Aaron Conole <aconole@redhat.com>
Cc: Bruce Richardson <bruce.richardson@intel.com>
Cc: David Marchand <david.marchand@redhat.com>
Cc: Anatoly Burakov <anatoly.burakov@intel.com>
Cc: Juraj Linkeš <juraj.linkes@pantheon.tech>
---
 lib/librte_power/rte_power_guest_channel.h | 4 ----
 lib/librte_power/version.map               | 2 --
 2 files changed, 6 deletions(-)

diff --git a/lib/librte_power/rte_power_guest_channel.h b/lib/librte_power/rte_power_guest_channel.h
index ed4fbfdcd38a..7586e9491f11 100644
--- a/lib/librte_power/rte_power_guest_channel.h
+++ b/lib/librte_power/rte_power_guest_channel.h
@@ -119,8 +119,6 @@ struct rte_power_channel_packet_caps_list {
 };
 
 /**
- * @internal
- *
  * @warning
  * @b EXPERIMENTAL: this API may change without prior notice.
  *
@@ -141,8 +139,6 @@ int rte_power_guest_channel_send_msg(struct rte_power_channel_packet *pkt,
 			unsigned int lcore_id);
 
 /**
- * @internal
- *
  * @warning
  * @b EXPERIMENTAL: this API may change without prior notice.
  *
diff --git a/lib/librte_power/version.map b/lib/librte_power/version.map
index 3ba9390241d2..bce5110dd5b4 100644
--- a/lib/librte_power/version.map
+++ b/lib/librte_power/version.map
@@ -12,7 +12,6 @@ DPDK_21 {
 	rte_power_get_capabilities;
 	rte_power_get_env;
 	rte_power_get_freq;
-	rte_power_guest_channel_send_msg;
 	rte_power_init;
 	rte_power_set_env;
 	rte_power_set_freq;
@@ -31,7 +30,6 @@ EXPERIMENTAL {
 	rte_power_empty_poll_stat_free;
 	rte_power_empty_poll_stat_init;
 	rte_power_empty_poll_stat_update;
-	rte_power_guest_channel_receive_msg;
 	rte_power_poll_stat_fetch;
 	rte_power_poll_stat_update;
 
-- 
2.29.2


^ permalink raw reply	[flat|nested] 69+ messages in thread

* Re: [dpdk-dev] [PATCH] power: remove duplicated symbols from map file
  2021-02-24 14:54           ` [dpdk-dev] [PATCH] power: remove duplicated symbols from map file Ferruh Yigit
@ 2021-02-25  9:11             ` David Marchand
  2021-02-25 10:41               ` Ferruh Yigit
  2021-02-25 10:54             ` [dpdk-dev] [PATCH v2] " Ferruh Yigit
  1 sibling, 1 reply; 69+ messages in thread
From: David Marchand @ 2021-02-25  9:11 UTC (permalink / raw)
  To: Ferruh Yigit
  Cc: David Hunt, Ray Kinsella, Neil Horman, Anatoly Burakov,
	Bruce Richardson, dev, dpdk stable, Aaron Conole,
	Juraj Linkeš

Hello Ferruh,

On Wed, Feb 24, 2021 at 3:55 PM Ferruh Yigit <ferruh.yigit@intel.com> wrote:
>
> This is also causing build error, like:
> https://travis-ci.com/github/ovsrobot/dpdk/jobs/482121104
>
> Also '@internal' marker removed from doxygen comment, since public API
> should not be internal.
>
> Fixes: 4d3892dcd77b ("power: make channel message functions public")
> Cc: stable@dpdk.org
>
> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
> ---
> Cc: Aaron Conole <aconole@redhat.com>
> Cc: Bruce Richardson <bruce.richardson@intel.com>
> Cc: David Marchand <david.marchand@redhat.com>
> Cc: Anatoly Burakov <anatoly.burakov@intel.com>
> Cc: Juraj Linkeš <juraj.linkes@pantheon.tech>
> ---
>  lib/librte_power/rte_power_guest_channel.h | 4 ----
>  lib/librte_power/version.map               | 2 --
>  2 files changed, 6 deletions(-)
>
> diff --git a/lib/librte_power/rte_power_guest_channel.h b/lib/librte_power/rte_power_guest_channel.h
> index ed4fbfdcd38a..7586e9491f11 100644
> --- a/lib/librte_power/rte_power_guest_channel.h
> +++ b/lib/librte_power/rte_power_guest_channel.h
> @@ -119,8 +119,6 @@ struct rte_power_channel_packet_caps_list {
>  };
>
>  /**
> - * @internal
> - *
>   * @warning
>   * @b EXPERIMENTAL: this API may change without prior notice.
>   *
> @@ -141,8 +139,6 @@ int rte_power_guest_channel_send_msg(struct rte_power_channel_packet *pkt,
>                         unsigned int lcore_id);
>
>  /**
> - * @internal
> - *
>   * @warning
>   * @b EXPERIMENTAL: this API may change without prior notice.
>   *
> diff --git a/lib/librte_power/version.map b/lib/librte_power/version.map
> index 3ba9390241d2..bce5110dd5b4 100644
> --- a/lib/librte_power/version.map
> +++ b/lib/librte_power/version.map
> @@ -12,7 +12,6 @@ DPDK_21 {
>         rte_power_get_capabilities;
>         rte_power_get_env;
>         rte_power_get_freq;
> -       rte_power_guest_channel_send_msg;

This symbol was marked stable so far.
Did I miss something?
I would just remove the experimental tagging for this symbol which is
incorrect in v21.02.

Something like:
diff --git a/lib/librte_power/rte_power_guest_channel.h
b/lib/librte_power/rte_power_guest_channel.h
index ed4fbfdcd3..b5de1bd243 100644
--- a/lib/librte_power/rte_power_guest_channel.h
+++ b/lib/librte_power/rte_power_guest_channel.h
@@ -119,11 +119,6 @@ struct rte_power_channel_packet_caps_list {
 };

 /**
- * @internal
- *
- * @warning
- * @b EXPERIMENTAL: this API may change without prior notice.
- *
  * Send a message contained in pkt over the Virtio-Serial to the host endpoint.
  *
  * @param pkt
@@ -136,13 +131,10 @@ struct rte_power_channel_packet_caps_list {
  *  - 0 on success.
  *  - Negative on error.
  */
-__rte_experimental
 int rte_power_guest_channel_send_msg(struct rte_power_channel_packet *pkt,
                        unsigned int lcore_id);

 /**
- * @internal
- *
  * @warning
  * @b EXPERIMENTAL: this API may change without prior notice.
  *
diff --git a/lib/librte_power/version.map b/lib/librte_power/version.map
index 3ba9390241..b004e3e4a9 100644
--- a/lib/librte_power/version.map
+++ b/lib/librte_power/version.map
@@ -38,6 +38,4 @@ EXPERIMENTAL {
        # added in 21.02
        rte_power_ethdev_pmgmt_queue_disable;
        rte_power_ethdev_pmgmt_queue_enable;
-       rte_power_guest_channel_receive_msg;
-       rte_power_guest_channel_send_msg;
 };



Sidenote, we can probably catch these duplicates during build.
For duplicate entries with the same version, this is easy.
I'll see if I can catch the other case too.


--
David Marchand


^ permalink raw reply	[flat|nested] 69+ messages in thread

* Re: [dpdk-dev] [PATCH] power: remove duplicated symbols from map file
  2021-02-25  9:11             ` David Marchand
@ 2021-02-25 10:41               ` Ferruh Yigit
  2021-02-25 10:44                 ` David Marchand
  0 siblings, 1 reply; 69+ messages in thread
From: Ferruh Yigit @ 2021-02-25 10:41 UTC (permalink / raw)
  To: David Marchand
  Cc: David Hunt, Ray Kinsella, Neil Horman, Anatoly Burakov,
	Bruce Richardson, dev, dpdk stable, Aaron Conole,
	Juraj Linkeš,
	Thomas Monjalon

On 2/25/2021 9:11 AM, David Marchand wrote:
> Hello Ferruh,
> 
> On Wed, Feb 24, 2021 at 3:55 PM Ferruh Yigit <ferruh.yigit@intel.com> wrote:
>>
>> This is also causing build error, like:
>> https://travis-ci.com/github/ovsrobot/dpdk/jobs/482121104
>>
>> Also '@internal' marker removed from doxygen comment, since public API
>> should not be internal.
>>
>> Fixes: 4d3892dcd77b ("power: make channel message functions public")
>> Cc: stable@dpdk.org
>>
>> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
>> ---
>> Cc: Aaron Conole <aconole@redhat.com>
>> Cc: Bruce Richardson <bruce.richardson@intel.com>
>> Cc: David Marchand <david.marchand@redhat.com>
>> Cc: Anatoly Burakov <anatoly.burakov@intel.com>
>> Cc: Juraj Linkeš <juraj.linkes@pantheon.tech>
>> ---
>>   lib/librte_power/rte_power_guest_channel.h | 4 ----
>>   lib/librte_power/version.map               | 2 --
>>   2 files changed, 6 deletions(-)
>>
>> diff --git a/lib/librte_power/rte_power_guest_channel.h b/lib/librte_power/rte_power_guest_channel.h
>> index ed4fbfdcd38a..7586e9491f11 100644
>> --- a/lib/librte_power/rte_power_guest_channel.h
>> +++ b/lib/librte_power/rte_power_guest_channel.h
>> @@ -119,8 +119,6 @@ struct rte_power_channel_packet_caps_list {
>>   };
>>
>>   /**
>> - * @internal
>> - *
>>    * @warning
>>    * @b EXPERIMENTAL: this API may change without prior notice.
>>    *
>> @@ -141,8 +139,6 @@ int rte_power_guest_channel_send_msg(struct rte_power_channel_packet *pkt,
>>                          unsigned int lcore_id);
>>
>>   /**
>> - * @internal
>> - *
>>    * @warning
>>    * @b EXPERIMENTAL: this API may change without prior notice.
>>    *
>> diff --git a/lib/librte_power/version.map b/lib/librte_power/version.map
>> index 3ba9390241d2..bce5110dd5b4 100644
>> --- a/lib/librte_power/version.map
>> +++ b/lib/librte_power/version.map
>> @@ -12,7 +12,6 @@ DPDK_21 {
>>          rte_power_get_capabilities;
>>          rte_power_get_env;
>>          rte_power_get_freq;
>> -       rte_power_guest_channel_send_msg;
> 
> This symbol was marked stable so far.
> Did I miss something?
> I would just remove the experimental tagging for this symbol which is
> incorrect in v21.02.
> 

You are right,

The header that has the declares the API was not public before the v21.02, so I 
assumed the symbol is internal and added to the stable section by mistake, but 
the intention seems to have it as public API.

I will keep the 'rte_power_guest_channel_send_msg' API, but 
'rte_power_guest_channel_receive_msg' is already experimental, so will keep it 
as it is.

> Something like:
> diff --git a/lib/librte_power/rte_power_guest_channel.h
> b/lib/librte_power/rte_power_guest_channel.h
> index ed4fbfdcd3..b5de1bd243 100644
> --- a/lib/librte_power/rte_power_guest_channel.h
> +++ b/lib/librte_power/rte_power_guest_channel.h
> @@ -119,11 +119,6 @@ struct rte_power_channel_packet_caps_list {
>   };
> 
>   /**
> - * @internal
> - *
> - * @warning
> - * @b EXPERIMENTAL: this API may change without prior notice.
> - *
>    * Send a message contained in pkt over the Virtio-Serial to the host endpoint.
>    *
>    * @param pkt
> @@ -136,13 +131,10 @@ struct rte_power_channel_packet_caps_list {
>    *  - 0 on success.
>    *  - Negative on error.
>    */
> -__rte_experimental
>   int rte_power_guest_channel_send_msg(struct rte_power_channel_packet *pkt,
>                          unsigned int lcore_id);
> 
>   /**
> - * @internal
> - *
>    * @warning
>    * @b EXPERIMENTAL: this API may change without prior notice.
>    *
> diff --git a/lib/librte_power/version.map b/lib/librte_power/version.map
> index 3ba9390241..b004e3e4a9 100644
> --- a/lib/librte_power/version.map
> +++ b/lib/librte_power/version.map
> @@ -38,6 +38,4 @@ EXPERIMENTAL {
>          # added in 21.02
>          rte_power_ethdev_pmgmt_queue_disable;
>          rte_power_ethdev_pmgmt_queue_enable;
> -       rte_power_guest_channel_receive_msg;
> -       rte_power_guest_channel_send_msg;
>   };
> 
> 
> 
> Sidenote, we can probably catch these duplicates during build.
> For duplicate entries with the same version, this is easy.
> I'll see if I can catch the other case too.
> 

Wasn't there a script for it already, I slightly remember it but not sure, cc'ed 
Thomas, perhaps he remembers.



^ permalink raw reply	[flat|nested] 69+ messages in thread

* Re: [dpdk-dev] [PATCH] power: remove duplicated symbols from map file
  2021-02-25 10:41               ` Ferruh Yigit
@ 2021-02-25 10:44                 ` David Marchand
  0 siblings, 0 replies; 69+ messages in thread
From: David Marchand @ 2021-02-25 10:44 UTC (permalink / raw)
  To: Ferruh Yigit
  Cc: David Hunt, Ray Kinsella, Neil Horman, Anatoly Burakov,
	Bruce Richardson, dev, dpdk stable, Aaron Conole,
	Juraj Linkeš,
	Thomas Monjalon

On Thu, Feb 25, 2021 at 11:41 AM Ferruh Yigit <ferruh.yigit@intel.com> wrote:
> > Sidenote, we can probably catch these duplicates during build.
> > For duplicate entries with the same version, this is easy.
> > I'll see if I can catch the other case too.
> >
>
> Wasn't there a script for it already, I slightly remember it but not sure, cc'ed
> Thomas, perhaps he remembers.

Yes, and the patch is ready, will send later.


-- 
David Marchand


^ permalink raw reply	[flat|nested] 69+ messages in thread

* [dpdk-dev] [PATCH v2] power: remove duplicated symbols from map file
  2021-02-24 14:54           ` [dpdk-dev] [PATCH] power: remove duplicated symbols from map file Ferruh Yigit
  2021-02-25  9:11             ` David Marchand
@ 2021-02-25 10:54             ` Ferruh Yigit
  2021-02-25 14:38               ` David Marchand
  1 sibling, 1 reply; 69+ messages in thread
From: Ferruh Yigit @ 2021-02-25 10:54 UTC (permalink / raw)
  To: David Hunt, Ray Kinsella, Neil Horman, Bruce Richardson, Anatoly Burakov
  Cc: Ferruh Yigit, dev, stable, Aaron Conole, David Marchand,
	Juraj Linkeš

This is causing build error, like:
https://travis-ci.com/github/ovsrobot/dpdk/jobs/482121104

Also '@internal' marker removed from doxygen comment, since public API
should not be internal.
Experimental tag removed from 'rte_power_guest_channel_send_msg()'

Fixes: 4d3892dcd77b ("power: make channel message functions public")
Cc: stable@dpdk.org

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
Cc: Aaron Conole <aconole@redhat.com>
Cc: Bruce Richardson <bruce.richardson@intel.com>
Cc: David Marchand <david.marchand@redhat.com>
Cc: Anatoly Burakov <anatoly.burakov@intel.com>
Cc: Juraj Linkeš <juraj.linkes@pantheon.tech>

v2:
* Keep old symbols, remove the ones added in 21.02
---
 lib/librte_power/rte_power_guest_channel.h | 8 --------
 lib/librte_power/version.map               | 2 --
 2 files changed, 10 deletions(-)

diff --git a/lib/librte_power/rte_power_guest_channel.h b/lib/librte_power/rte_power_guest_channel.h
index ed4fbfdcd38a..b5de1bd24318 100644
--- a/lib/librte_power/rte_power_guest_channel.h
+++ b/lib/librte_power/rte_power_guest_channel.h
@@ -119,11 +119,6 @@ struct rte_power_channel_packet_caps_list {
 };
 
 /**
- * @internal
- *
- * @warning
- * @b EXPERIMENTAL: this API may change without prior notice.
- *
  * Send a message contained in pkt over the Virtio-Serial to the host endpoint.
  *
  * @param pkt
@@ -136,13 +131,10 @@ struct rte_power_channel_packet_caps_list {
  *  - 0 on success.
  *  - Negative on error.
  */
-__rte_experimental
 int rte_power_guest_channel_send_msg(struct rte_power_channel_packet *pkt,
 			unsigned int lcore_id);
 
 /**
- * @internal
- *
  * @warning
  * @b EXPERIMENTAL: this API may change without prior notice.
  *
diff --git a/lib/librte_power/version.map b/lib/librte_power/version.map
index 3ba9390241d2..b004e3e4a9c1 100644
--- a/lib/librte_power/version.map
+++ b/lib/librte_power/version.map
@@ -38,6 +38,4 @@ EXPERIMENTAL {
 	# added in 21.02
 	rte_power_ethdev_pmgmt_queue_disable;
 	rte_power_ethdev_pmgmt_queue_enable;
-	rte_power_guest_channel_receive_msg;
-	rte_power_guest_channel_send_msg;
 };
-- 
2.29.2


^ permalink raw reply	[flat|nested] 69+ messages in thread

* Re: [dpdk-dev] [PATCH v2] power: remove duplicated symbols from map file
  2021-02-25 10:54             ` [dpdk-dev] [PATCH v2] " Ferruh Yigit
@ 2021-02-25 14:38               ` David Marchand
  2021-03-02 12:42                 ` David Marchand
  0 siblings, 1 reply; 69+ messages in thread
From: David Marchand @ 2021-02-25 14:38 UTC (permalink / raw)
  To: Ferruh Yigit
  Cc: David Hunt, Ray Kinsella, Neil Horman, Bruce Richardson,
	Anatoly Burakov, dev, dpdk stable, Aaron Conole,
	Juraj Linkeš

On Thu, Feb 25, 2021 at 11:55 AM Ferruh Yigit <ferruh.yigit@intel.com> wrote:
>
> This is causing build error, like:
> https://travis-ci.com/github/ovsrobot/dpdk/jobs/482121104
>
> Also '@internal' marker removed from doxygen comment, since public API
> should not be internal.
> Experimental tag removed from 'rte_power_guest_channel_send_msg()'
>
> Fixes: 4d3892dcd77b ("power: make channel message functions public")
> Cc: stable@dpdk.org
>
> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>

Reviewed-by: David Marchand <david.marchand@redhat.com>


-- 
David Marchand


^ permalink raw reply	[flat|nested] 69+ messages in thread

* Re: [dpdk-dev] [PATCH v2] power: remove duplicated symbols from map file
  2021-02-25 14:38               ` David Marchand
@ 2021-03-02 12:42                 ` David Marchand
  0 siblings, 0 replies; 69+ messages in thread
From: David Marchand @ 2021-03-02 12:42 UTC (permalink / raw)
  To: Ferruh Yigit
  Cc: David Hunt, Ray Kinsella, Neil Horman, Bruce Richardson,
	Anatoly Burakov, dev, dpdk stable, Aaron Conole,
	Juraj Linkeš

On Thu, Feb 25, 2021 at 3:38 PM David Marchand
<david.marchand@redhat.com> wrote:
>
> On Thu, Feb 25, 2021 at 11:55 AM Ferruh Yigit <ferruh.yigit@intel.com> wrote:
> >
> > This is causing build error, like:
> > https://travis-ci.com/github/ovsrobot/dpdk/jobs/482121104
> >
> > Also '@internal' marker removed from doxygen comment, since public API
> > should not be internal.
> > Experimental tag removed from 'rte_power_guest_channel_send_msg()'
> >
> > Fixes: 4d3892dcd77b ("power: make channel message functions public")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
>
> Reviewed-by: David Marchand <david.marchand@redhat.com>

Applied, thanks Ferruh.

Hopefully, with the update to Graviton2, Travis jobs will run fine now.


-- 
David Marchand


^ permalink raw reply	[flat|nested] 69+ messages in thread

end of thread, other threads:[~2021-03-02 12:42 UTC | newest]

Thread overview: 69+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-17 11:36 [dpdk-dev] [PATCH v1] power: fix make build for power apps David Hunt
2021-01-08 14:30 ` [dpdk-dev] [PATCH 0/6] " David Hunt
2021-01-08 14:30   ` [dpdk-dev] [PATCH v2 1/6] power: create guest channel public header file David Hunt
2021-01-20 13:55     ` [dpdk-dev] [PATCH v3 0/6] power: fix make build for power apps David Hunt
2021-01-20 13:55       ` [dpdk-dev] [PATCH v3 1/6] power: create guest channel public header file David Hunt
2021-01-20 15:09         ` Burakov, Anatoly
2021-01-20 15:12           ` David Hunt
2021-01-21 17:21         ` [dpdk-dev] [PATCH v4 0/6] power: fix make build for power apps David Hunt
2021-01-21 17:21           ` [dpdk-dev] [PATCH v4 1/6] power: create guest channel public header file David Hunt
2021-01-29 10:21             ` [dpdk-dev] [PATCH v5 0/6] power: fix make build for power apps David Hunt
2021-01-29 10:21               ` [dpdk-dev] [PATCH v5 1/6] power: create guest channel public header file David Hunt
2021-01-29 10:21               ` [dpdk-dev] [PATCH v5 2/6] power: make channel msg functions public David Hunt
2021-01-29 10:21               ` [dpdk-dev] [PATCH v5 3/6] power: rename public structs David Hunt
2021-01-29 10:21               ` [dpdk-dev] [PATCH v5 4/6] power: rename defines David Hunt
2021-01-29 10:21               ` [dpdk-dev] [PATCH v5 5/6] power: add new header file to export list David Hunt
2021-01-29 10:21               ` [dpdk-dev] [PATCH v5 6/6] power: clean up includes David Hunt
2021-01-29 10:30               ` [dpdk-dev] [PATCH v5 0/6] power: fix make build for power apps Thomas Monjalon
2021-01-21 17:21           ` [dpdk-dev] [PATCH v4 2/6] power: make channel msg functions public David Hunt
2021-01-22 12:12             ` Burakov, Anatoly
2021-02-22  9:53             ` [dpdk-dev] [dpdk-stable] " Ferruh Yigit
2021-01-21 17:21           ` [dpdk-dev] [PATCH v4 3/6] power: rename public structs David Hunt
2021-01-22 12:15             ` Burakov, Anatoly
2021-01-22 12:18               ` Burakov, Anatoly
2021-01-22 12:18             ` Burakov, Anatoly
2021-01-28 22:57             ` [dpdk-dev] [dpdk-stable] " Thomas Monjalon
2021-02-22  9:56             ` Ferruh Yigit
2021-01-21 17:21           ` [dpdk-dev] [PATCH v4 4/6] power: rename defines David Hunt
2021-01-22 13:50             ` Burakov, Anatoly
2021-01-21 17:22           ` [dpdk-dev] [PATCH v4 5/6] power: add new header file to export list David Hunt
2021-01-22 13:51             ` Burakov, Anatoly
2021-01-21 17:22           ` [dpdk-dev] [PATCH v4 6/6] power: clean up includes David Hunt
2021-01-22 13:53             ` Burakov, Anatoly
2021-01-29 10:27           ` [dpdk-dev] [dpdk-stable] [PATCH v4 0/6] power: fix make build for power apps Thomas Monjalon
2021-02-24 14:54           ` [dpdk-dev] [PATCH] power: remove duplicated symbols from map file Ferruh Yigit
2021-02-25  9:11             ` David Marchand
2021-02-25 10:41               ` Ferruh Yigit
2021-02-25 10:44                 ` David Marchand
2021-02-25 10:54             ` [dpdk-dev] [PATCH v2] " Ferruh Yigit
2021-02-25 14:38               ` David Marchand
2021-03-02 12:42                 ` David Marchand
2021-01-20 13:55       ` [dpdk-dev] [PATCH v3 2/6] power: make channel msg functions public David Hunt
2021-01-20 14:26         ` Burakov, Anatoly
2021-01-20 15:08           ` David Hunt
2021-01-20 15:23             ` Burakov, Anatoly
2021-01-20 13:55       ` [dpdk-dev] [PATCH v3 3/6] power: rename public structs David Hunt
2021-01-20 14:27         ` Burakov, Anatoly
2021-01-20 15:03           ` David Hunt
2021-01-20 13:55       ` [dpdk-dev] [PATCH v3 4/6] power: rename defines David Hunt
2021-01-20 13:55       ` [dpdk-dev] [PATCH v3 5/6] power: add new header file to export list David Hunt
2021-01-20 14:28         ` Burakov, Anatoly
2021-01-20 15:01           ` David Hunt
2021-01-20 15:17             ` Burakov, Anatoly
2021-01-20 15:08           ` Bruce Richardson
2021-01-20 15:18             ` Burakov, Anatoly
2021-01-20 15:29               ` David Hunt
2021-01-20 15:43                 ` Burakov, Anatoly
2021-01-20 13:55       ` [dpdk-dev] [PATCH v3 6/6] power: clean up includes David Hunt
2021-01-08 14:30   ` [dpdk-dev] [PATCH v2 2/6] power: make channel msg functions public David Hunt
2021-01-19 14:31     ` [dpdk-dev] [dpdk-stable] " Thomas Monjalon
2021-01-19 14:51       ` David Hunt
2021-01-08 14:30   ` [dpdk-dev] [PATCH v2 3/6] power: rename public structs David Hunt
2021-01-08 14:30   ` [dpdk-dev] [PATCH v2 4/6] power: rename defines David Hunt
2021-01-08 14:30   ` [dpdk-dev] [PATCH v2 5/6] power: add new header file to export list David Hunt
2021-01-08 14:30   ` [dpdk-dev] [PATCH v2 6/6] power: clean up includes David Hunt
2021-01-13 11:08   ` [dpdk-dev] [PATCH 0/6] power: fix make build for power apps Burakov, Anatoly
2021-01-13 11:14     ` David Hunt
2021-01-13 11:18       ` Burakov, Anatoly
2021-01-13 13:25         ` David Hunt
2021-01-13 17:30           ` Burakov, Anatoly

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).