New upstream version 18.11-rc1
[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 #define PKT_POLICY_REMOVE       4
23
24 /* CPU Power Command Scaling */
25 #define CPU_POWER_SCALE_UP      1
26 #define CPU_POWER_SCALE_DOWN    2
27 #define CPU_POWER_SCALE_MAX     3
28 #define CPU_POWER_SCALE_MIN     4
29 #define CPU_POWER_ENABLE_TURBO  5
30 #define CPU_POWER_DISABLE_TURBO 6
31 #define HOURS 24
32
33 #define MAX_VFS 10
34 #define VM_MAX_NAME_SZ 32
35
36 #define MAX_VCPU_PER_VM         8
37
38 struct t_boost_status {
39         bool tbEnabled;
40 };
41
42 struct timer_profile {
43         int busy_hours[HOURS];
44         int quiet_hours[HOURS];
45         int hours_to_use_traffic_profile[HOURS];
46 };
47
48 enum workload {HIGH, MEDIUM, LOW};
49 enum policy_to_use {
50         TRAFFIC,
51         TIME,
52         WORKLOAD,
53         BRANCH_RATIO
54 };
55
56 struct traffic {
57         uint32_t min_packet_thresh;
58         uint32_t avg_max_packet_thresh;
59         uint32_t max_max_packet_thresh;
60 };
61
62 #define CORE_TYPE_VIRTUAL 0
63 #define CORE_TYPE_PHYSICAL 1
64
65 struct channel_packet {
66         uint64_t resource_id; /**< core_num, device */
67         uint32_t unit;        /**< scale down/up/min/max */
68         uint32_t command;     /**< Power, IO, etc */
69         char vm_name[VM_MAX_NAME_SZ];
70
71         uint64_t vfid[MAX_VFS];
72         int nb_mac_to_monitor;
73         struct traffic traffic_policy;
74         uint8_t vcpu_to_control[MAX_VCPU_PER_VM];
75         uint8_t num_vcpu;
76         struct timer_profile timer_policy;
77         bool core_type;
78         enum workload workload;
79         enum policy_to_use policy_to_use;
80         struct t_boost_status t_boost_status;
81 };
82
83
84 #ifdef __cplusplus
85 }
86 #endif
87
88 #endif /* CHANNEL_COMMANDS_H_ */