mempool: fix slow allocation of large mempools
[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 #define CPU_POWER_QUERY_CAPS_LIST  9
35 #define CPU_POWER_QUERY_CAPS       10
36
37 /* --- Outgoing messages --- */
38
39 /* Generic Power Command Response */
40 #define CPU_POWER_CMD_ACK       1
41 #define CPU_POWER_CMD_NACK      2
42
43 /* CPU Power Query Responses */
44 #define CPU_POWER_FREQ_LIST     3
45 #define CPU_POWER_CAPS_LIST     4
46
47 #define HOURS 24
48
49 #define MAX_VFS 10
50 #define VM_MAX_NAME_SZ 32
51
52 #define MAX_VCPU_PER_VM         8
53
54 struct t_boost_status {
55         bool tbEnabled;
56 };
57
58 struct timer_profile {
59         int busy_hours[HOURS];
60         int quiet_hours[HOURS];
61         int hours_to_use_traffic_profile[HOURS];
62 };
63
64 enum workload {HIGH, MEDIUM, LOW};
65 enum policy_to_use {
66         TRAFFIC,
67         TIME,
68         WORKLOAD,
69         BRANCH_RATIO
70 };
71
72 struct traffic {
73         uint32_t min_packet_thresh;
74         uint32_t avg_max_packet_thresh;
75         uint32_t max_max_packet_thresh;
76 };
77
78 #define CORE_TYPE_VIRTUAL 0
79 #define CORE_TYPE_PHYSICAL 1
80
81 struct channel_packet {
82         uint64_t resource_id; /**< core_num, device */
83         uint32_t unit;        /**< scale down/up/min/max */
84         uint32_t command;     /**< Power, IO, etc */
85         char vm_name[VM_MAX_NAME_SZ];
86
87         uint64_t vfid[MAX_VFS];
88         int nb_mac_to_monitor;
89         struct traffic traffic_policy;
90         uint8_t vcpu_to_control[MAX_VCPU_PER_VM];
91         uint8_t num_vcpu;
92         struct timer_profile timer_policy;
93         bool core_type;
94         enum workload workload;
95         enum policy_to_use policy_to_use;
96         struct t_boost_status t_boost_status;
97 };
98
99 struct channel_packet_freq_list {
100         uint64_t resource_id; /**< core_num, device */
101         uint32_t unit;        /**< scale down/up/min/max */
102         uint32_t command;     /**< Power, IO, etc */
103         char vm_name[VM_MAX_NAME_SZ];
104
105         uint32_t freq_list[MAX_VCPU_PER_VM];
106         uint8_t num_vcpu;
107 };
108
109 struct channel_packet_caps_list {
110         uint64_t resource_id; /**< core_num, device */
111         uint32_t unit;        /**< scale down/up/min/max */
112         uint32_t command;     /**< Power, IO, etc */
113         char vm_name[VM_MAX_NAME_SZ];
114
115         uint64_t turbo[MAX_VCPU_PER_VM];
116         uint64_t priority[MAX_VCPU_PER_VM];
117         uint8_t num_vcpu;
118 };
119
120
121 #ifdef __cplusplus
122 }
123 #endif
124
125 #endif /* CHANNEL_COMMANDS_H_ */