net/memif: fix Unix domain address length
[dpdk.git] / examples / vm_power_manager / channel_monitor.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2010-2014 Intel Corporation
3  */
4
5 #ifndef CHANNEL_MONITOR_H_
6 #define CHANNEL_MONITOR_H_
7
8 #include "channel_manager.h"
9 #include "channel_commands.h"
10
11 struct core_share {
12         unsigned int pcpu;
13         /*
14          * 1 CORE SHARE
15          * 0 NOT SHARED
16          */
17         int status;
18 };
19
20 struct policy {
21         struct channel_packet pkt;
22         uint32_t pfid[MAX_VFS];
23         uint32_t port[MAX_VFS];
24         unsigned int enabled;
25         struct core_share core_share[MAX_VCPU_PER_VM];
26 };
27
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31
32 /**
33  * Setup the Channel Monitor resources required to initialize epoll.
34  * Must be called first before calling other functions.
35  *
36  * @return
37  *  - 0 on success.
38  *  - Negative on error.
39  */
40 int channel_monitor_init(void);
41
42 /**
43  * Run the channel monitor, loops forever on on epoll_wait.
44  *
45  *
46  * @return
47  *  None
48  */
49 void run_channel_monitor(void);
50
51 /**
52  * Exit the Channel Monitor, exiting the epoll_wait loop and events processing.
53  *
54  * @return
55  *  - 0 on success.
56  *  - Negative on error.
57  */
58 void channel_monitor_exit(void);
59
60 /**
61  * Add an open channel to monitor via epoll. A pointer to struct channel_info
62  * will be registered with epoll for event processing.
63  * It is thread-safe.
64  *
65  * @param chan_info
66  *  Pointer to struct channel_info pointer.
67  *
68  * @return
69  *  - 0 on success.
70  *  - Negative on error.
71  */
72 int add_channel_to_monitor(struct channel_info **chan_info);
73
74 /**
75  * Remove a previously added channel from epoll control.
76  *
77  * @param chan_info
78  *  Pointer to struct channel_info.
79  *
80  * @return
81  *  - 0 on success.
82  *  - Negative on error.
83  */
84 int remove_channel_from_monitor(struct channel_info *chan_info);
85
86 #ifdef __cplusplus
87 }
88 #endif
89
90
91 #endif /* CHANNEL_MONITOR_H_ */