}
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;
}
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;
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;
}
static int
-update_policy(struct channel_packet *pkt)
+update_policy(struct rte_power_channel_packet *pkt)
{
unsigned int updated = 0;
}
static int
-remove_policy(struct channel_packet *pkt __rte_unused)
+remove_policy(struct rte_power_channel_packet *pkt __rte_unused)
{
unsigned int i;
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)
}
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)
}
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;
}
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;
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;
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;
/*
* 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);
};
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;
{ "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];
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;
int
set_policy_mac(int port, int idx)
{
- struct channel_packet *policy;
+ struct rte_power_channel_packet *policy;
union PFID pfid;
int ret;
}
int
-set_policy_defaults(struct channel_packet *pkt)
+set_policy_defaults(struct rte_power_channel_packet *pkt)
{
int ret;
};
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);
}
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");
{
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")) {
};
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");
{
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")) {
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);
};
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;
#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);
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;
}
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;
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);
* - 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);
/**
* Read 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.
+ * Pointer to rte_power_channel_packet or
+ * rte_power_channel_packet_freq_list struct.
*
* @param pkt_len
* Size of expected data packet.
#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)
#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
#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
#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 */
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 */
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 */
* - 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);
/**