From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id D0AF9A0524 for ; Thu, 4 Feb 2021 12:37:00 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C309E240773; Thu, 4 Feb 2021 12:37:00 +0100 (CET) Received: from youngberry.canonical.com (youngberry.canonical.com [91.189.89.112]) by mails.dpdk.org (Postfix) with ESMTP id 458FD240767 for ; Thu, 4 Feb 2021 12:36:59 +0100 (CET) Received: from 2.general.paelzer.uk.vpn ([10.172.196.173] helo=localhost.localdomain) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1l7cwV-0005XL-00; Thu, 04 Feb 2021 11:36:59 +0000 From: Christian Ehrhardt To: Bruce Richardson Cc: David Hunt , Anatoly Burakov , dpdk stable Date: Thu, 4 Feb 2021 12:29:01 +0100 Message-Id: <20210204112954.2488123-86-christian.ehrhardt@canonical.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210204112954.2488123-1-christian.ehrhardt@canonical.com> References: <20210204112954.2488123-1-christian.ehrhardt@canonical.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'power: rename public structs' has been queued to stable release 19.11.7 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" Hi, FYI, your patch has been queued to stable release 19.11.7 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 02/06/21. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/cpaelzer/dpdk-stable-queue This queued commit can be viewed at: https://github.com/cpaelzer/dpdk-stable-queue/commit/042faf584653819d5aa5e2e29dbd5f850e08748c Thanks. Christian Ehrhardt --- >From 042faf584653819d5aa5e2e29dbd5f850e08748c Mon Sep 17 00:00:00 2001 From: Bruce Richardson Date: Thu, 21 Jan 2021 17:21:58 +0000 Subject: [PATCH] power: rename public structs [ upstream commit bd5b6720fe6588ff2d48c70879f355243466f155 ] 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") Signed-off-by: Bruce Richardson Signed-off-by: David Hunt Acked-by: Anatoly Burakov --- 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 4788d50cfa..ab68b8eb5b 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 4a526ff670..0ca6207ad8 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 f63b3c988a..fc7a8c30af 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 f9b47186ee..3260dbd2bb 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 0f82bac604..03af2cda7c 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(__attribute__((unused)) void *arg); diff --git a/lib/librte_power/guest_channel.c b/lib/librte_power/guest_channel.c index 6eba632393..373589863d 100644 --- a/lib/librte_power/guest_channel.c +++ b/lib/librte_power/guest_channel.c @@ -29,7 +29,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; @@ -93,7 +93,8 @@ error: } 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; @@ -123,7 +124,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 a55d5e6d4c..756b16c91d 100644 --- a/lib/librte_power/guest_channel.h +++ b/lib/librte_power/guest_channel.h @@ -51,15 +51,16 @@ 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); /** * 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. diff --git a/lib/librte_power/power_kvm_vm.c b/lib/librte_power/power_kvm_vm.c index fa177b57ec..899d738a99 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 diff --git a/lib/librte_power/rte_power_guest_channel.h b/lib/librte_power/rte_power_guest_channel.h index c500c0cda6..c9ab7bae81 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 #include -/* --- 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.30.0 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2021-02-04 12:04:31.602467216 +0100 +++ 0086-power-rename-public-structs.patch 2021-02-04 12:04:28.086789783 +0100 @@ -1 +1 @@ -From bd5b6720fe6588ff2d48c70879f355243466f155 Mon Sep 17 00:00:00 2001 +From 042faf584653819d5aa5e2e29dbd5f850e08748c Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit bd5b6720fe6588ff2d48c70879f355243466f155 ] + @@ -10 +11,0 @@ -Cc: stable@dpdk.org @@ -28 +29 @@ -index 08306105d3..1b6041b6f8 100644 +index 4788d50cfa..ab68b8eb5b 100644 @@ -192 +193 @@ -index cf1636e784..125dfeb10a 100644 +index f9b47186ee..3260dbd2bb 100644 @@ -323 +324 @@ -index 2299d23dce..5d285ca9de 100644 +index 0f82bac604..03af2cda7c 100644 @@ -338 +339 @@ - void run_cli(__rte_unused void *arg); + void run_cli(__attribute__((unused)) void *arg); @@ -341 +342 @@ -index 4cb5ae1ddf..9eb2f63306 100644 +index 6eba632393..373589863d 100644 @@ -344 +345 @@ -@@ -55,7 +55,7 @@ int +@@ -29,7 +29,7 @@ int @@ -353 +354 @@ -@@ -119,7 +119,8 @@ error: +@@ -93,7 +93,8 @@ error: @@ -363 +364 @@ -@@ -149,7 +150,7 @@ guest_channel_send_msg(struct channel_packet *pkt, unsigned int lcore_id) +@@ -123,7 +124,7 @@ guest_channel_send_msg(struct channel_packet *pkt, unsigned int lcore_id) @@ -373 +374 @@ -index 83186cfbba..a1db4b0580 100644 +index a55d5e6d4c..756b16c91d 100644 @@ -376 +377 @@ -@@ -63,15 +63,16 @@ void guest_channel_host_disconnect(unsigned int lcore_id); +@@ -51,15 +51,16 @@ void guest_channel_host_disconnect(unsigned int lcore_id); @@ -397 +398 @@ -index 649ebe85c4..9ae438489e 100644 +index fa177b57ec..899d738a99 100644 @@ -406,0 +408 @@ + @@ -408 +409,0 @@ - power_kvm_vm_check_supported(void)