power: extend guest channel for frequency query
[dpdk.git] / lib / librte_power / channel_commands.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2010-2014 Intel Corporation
3  */
4
5 #ifndef CHANNEL_COMMANDS_H_
6 #define CHANNEL_COMMANDS_H_
7
8 #ifdef __cplusplus
9 extern "C" {
10 #endif
11
12 #include <stdint.h>
13 #include <stdbool.h>
14
15 /* --- Incoming messages --- */
16
17 /* Valid Commands */
18 #define CPU_POWER               1
19 #define CPU_POWER_CONNECT       2
20 #define PKT_POLICY              3
21 #define PKT_POLICY_REMOVE       4
22
23 /* CPU Power Command Scaling */
24 #define CPU_POWER_SCALE_UP      1
25 #define CPU_POWER_SCALE_DOWN    2
26 #define CPU_POWER_SCALE_MAX     3
27 #define CPU_POWER_SCALE_MIN     4
28 #define CPU_POWER_ENABLE_TURBO  5
29 #define CPU_POWER_DISABLE_TURBO 6
30
31 /* CPU Power Queries */
32 #define CPU_POWER_QUERY_FREQ_LIST  7
33 #define CPU_POWER_QUERY_FREQ       8
34
35 /* --- Outgoing messages --- */
36
37 /* Generic Power Command Response */
38 #define CPU_POWER_CMD_ACK       1
39 #define CPU_POWER_CMD_NACK      2
40
41 /* CPU Power Query Responses */
42 #define CPU_POWER_FREQ_LIST     3
43
44 #define HOURS 24
45
46 #define MAX_VFS 10
47 #define VM_MAX_NAME_SZ 32
48
49 #define MAX_VCPU_PER_VM         8
50
51 struct t_boost_status {
52         bool tbEnabled;
53 };
54
55 struct timer_profile {
56         int busy_hours[HOURS];
57         int quiet_hours[HOURS];
58         int hours_to_use_traffic_profile[HOURS];
59 };
60
61 enum workload {HIGH, MEDIUM, LOW};
62 enum policy_to_use {
63         TRAFFIC,
64         TIME,
65         WORKLOAD,
66         BRANCH_RATIO
67 };
68
69 struct traffic {
70         uint32_t min_packet_thresh;
71         uint32_t avg_max_packet_thresh;
72         uint32_t max_max_packet_thresh;
73 };
74
75 #define CORE_TYPE_VIRTUAL 0
76 #define CORE_TYPE_PHYSICAL 1
77
78 struct channel_packet {
79         uint64_t resource_id; /**< core_num, device */
80         uint32_t unit;        /**< scale down/up/min/max */
81         uint32_t command;     /**< Power, IO, etc */
82         char vm_name[VM_MAX_NAME_SZ];
83
84         uint64_t vfid[MAX_VFS];
85         int nb_mac_to_monitor;
86         struct traffic traffic_policy;
87         uint8_t vcpu_to_control[MAX_VCPU_PER_VM];
88         uint8_t num_vcpu;
89         struct timer_profile timer_policy;
90         bool core_type;
91         enum workload workload;
92         enum policy_to_use policy_to_use;
93         struct t_boost_status t_boost_status;
94 };
95
96 struct channel_packet_freq_list {
97         uint64_t resource_id; /**< core_num, device */
98         uint32_t unit;        /**< scale down/up/min/max */
99         uint32_t command;     /**< Power, IO, etc */
100         char vm_name[VM_MAX_NAME_SZ];
101
102         uint32_t freq_list[MAX_VCPU_PER_VM];
103         uint8_t num_vcpu;
104 };
105
106
107 #ifdef __cplusplus
108 }
109 #endif
110
111 #endif /* CHANNEL_COMMANDS_H_ */