New upstream version 18.08
[deb_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 /* Maximum number of channels per VM */
16 #define CHANNEL_CMDS_MAX_VM_CHANNELS 64
17
18 /* Valid Commands */
19 #define CPU_POWER               1
20 #define CPU_POWER_CONNECT       2
21 #define PKT_POLICY              3
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 #define HOURS 24
31
32 #define MAX_VFS 10
33 #define VM_MAX_NAME_SZ 32
34
35 #define MAX_VCPU_PER_VM         8
36
37 struct t_boost_status {
38         bool tbEnabled;
39 };
40
41 struct timer_profile {
42         int busy_hours[HOURS];
43         int quiet_hours[HOURS];
44         int hours_to_use_traffic_profile[HOURS];
45 };
46
47 enum workload {HIGH, MEDIUM, LOW};
48 enum policy_to_use {
49         TRAFFIC,
50         TIME,
51         WORKLOAD,
52         BRANCH_RATIO
53 };
54
55 struct traffic {
56         uint32_t min_packet_thresh;
57         uint32_t avg_max_packet_thresh;
58         uint32_t max_max_packet_thresh;
59 };
60
61 struct channel_packet {
62         uint64_t resource_id; /**< core_num, device */
63         uint32_t unit;        /**< scale down/up/min/max */
64         uint32_t command;     /**< Power, IO, etc */
65         char vm_name[VM_MAX_NAME_SZ];
66
67         uint64_t vfid[MAX_VFS];
68         int nb_mac_to_monitor;
69         struct traffic traffic_policy;
70         uint8_t vcpu_to_control[MAX_VCPU_PER_VM];
71         uint8_t num_vcpu;
72         struct timer_profile timer_policy;
73         enum workload workload;
74         enum policy_to_use policy_to_use;
75         struct t_boost_status t_boost_status;
76 };
77
78
79 #ifdef __cplusplus
80 }
81 #endif
82
83 #endif /* CHANNEL_COMMANDS_H_ */