DPDK 23.11.2
Loading...
Searching...
No Matches
rte_power_guest_channel.h
1/* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2010-2021 Intel Corporation
3 */
4#ifndef RTE_POWER_GUEST_CHANNEL_H
5#define RTE_POWER_GUEST_CHANNEL_H
6
7#include <stdint.h>
8#include <stddef.h>
9#include <stdbool.h>
10
11#ifdef __cplusplus
12extern "C" {
13#endif
14
15#define RTE_POWER_MAX_VFS 10
16#define RTE_POWER_VM_MAX_NAME_SZ 32
17#define RTE_POWER_MAX_VCPU_PER_VM 8
18#define RTE_POWER_HOURS_PER_DAY 24
19
20/* Valid Commands */
21#define RTE_POWER_CPU_POWER 1
22#define RTE_POWER_CPU_POWER_CONNECT 2
23#define RTE_POWER_PKT_POLICY 3
24#define RTE_POWER_PKT_POLICY_REMOVE 4
25
26#define RTE_POWER_CORE_TYPE_VIRTUAL 0
27#define RTE_POWER_CORE_TYPE_PHYSICAL 1
28
29/* CPU Power Command Scaling */
30#define RTE_POWER_SCALE_UP 1
31#define RTE_POWER_SCALE_DOWN 2
32#define RTE_POWER_SCALE_MAX 3
33#define RTE_POWER_SCALE_MIN 4
34#define RTE_POWER_ENABLE_TURBO 5
35#define RTE_POWER_DISABLE_TURBO 6
36
37/* CPU Power Queries */
38#define RTE_POWER_QUERY_FREQ_LIST 7
39#define RTE_POWER_QUERY_FREQ 8
40#define RTE_POWER_QUERY_CAPS_LIST 9
41#define RTE_POWER_QUERY_CAPS 10
42
43/* Generic Power Command Response */
44#define RTE_POWER_CMD_ACK 1
45#define RTE_POWER_CMD_NACK 2
46
47/* CPU Power Query Responses */
48#define RTE_POWER_FREQ_LIST 3
49#define RTE_POWER_CAPS_LIST 4
50
51struct rte_power_traffic_policy {
52 uint32_t min_packet_thresh;
53 uint32_t avg_max_packet_thresh;
54 uint32_t max_max_packet_thresh;
55};
56
57struct rte_power_timer_profile {
58 int busy_hours[RTE_POWER_HOURS_PER_DAY];
59 int quiet_hours[RTE_POWER_HOURS_PER_DAY];
60 int hours_to_use_traffic_profile[RTE_POWER_HOURS_PER_DAY];
61};
62
63enum rte_power_workload_level {
64 RTE_POWER_WL_HIGH,
65 RTE_POWER_WL_MEDIUM,
66 RTE_POWER_WL_LOW
67};
68
69enum rte_power_policy {
70 RTE_POWER_POLICY_TRAFFIC,
71 RTE_POWER_POLICY_TIME,
72 RTE_POWER_POLICY_WORKLOAD,
73 RTE_POWER_POLICY_BRANCH_RATIO
74};
75
77 bool tbEnabled;
78};
79
80struct rte_power_channel_packet {
81 uint64_t resource_id;
82 uint32_t unit;
83 uint32_t command;
84 char vm_name[RTE_POWER_VM_MAX_NAME_SZ];
85
86 uint64_t vfid[RTE_POWER_MAX_VFS];
87 int nb_mac_to_monitor;
88 struct rte_power_traffic_policy traffic_policy;
89 uint8_t vcpu_to_control[RTE_POWER_MAX_VCPU_PER_VM];
90 uint8_t num_vcpu;
91 struct rte_power_timer_profile timer_policy;
92 bool core_type;
93 enum rte_power_workload_level workload;
94 enum rte_power_policy policy_to_use;
95 struct rte_power_turbo_status t_boost_status;
96};
97
98struct rte_power_channel_packet_freq_list {
99 uint64_t resource_id;
100 uint32_t unit;
101 uint32_t command;
102 char vm_name[RTE_POWER_VM_MAX_NAME_SZ];
103
104 uint32_t freq_list[RTE_POWER_MAX_VCPU_PER_VM];
105 uint8_t num_vcpu;
106};
107
108struct rte_power_channel_packet_caps_list {
109 uint64_t resource_id;
110 uint32_t unit;
111 uint32_t command;
112 char vm_name[RTE_POWER_VM_MAX_NAME_SZ];
113
114 uint64_t turbo[RTE_POWER_MAX_VCPU_PER_VM];
115 uint64_t priority[RTE_POWER_MAX_VCPU_PER_VM];
116 uint8_t num_vcpu;
117};
118
132int rte_power_guest_channel_send_msg(struct rte_power_channel_packet *pkt,
133 unsigned int lcore_id);
134
153int rte_power_guest_channel_receive_msg(void *pkt,
154 size_t pkt_len,
155 unsigned int lcore_id);
156
157
158#ifdef __cplusplus
159}
160#endif
161
162#endif /* RTE_POWER_GUEST_CHANNEL_H_ */
rte_power_freq_change_t rte_power_turbo_status