power: extend guest channel API for reading
[dpdk.git] / lib / librte_power / guest_channel.h
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2010-2014 Intel Corporation
3  */
4 #ifndef _GUEST_CHANNEL_H
5 #define _GUEST_CHANNEL_H
6
7 #ifdef __cplusplus
8 extern "C" {
9 #endif
10
11 #include <channel_commands.h>
12
13 /**
14  * Connect to the Virtio-Serial VM end-point located in path. It is
15  * thread safe for unique lcore_ids. This function must be only called once from
16  * each lcore.
17  *
18  * @param path
19  *  The path to the serial device on the filesystem
20  * @param lcore_id
21  *  lcore_id.
22  *
23  * @return
24  *  - 0 on success.
25  *  - Negative on error.
26  */
27 int guest_channel_host_connect(const char *path, unsigned int lcore_id);
28
29 /**
30  * Disconnect from an already connected Virtio-Serial Endpoint.
31  *
32  *
33  * @param lcore_id
34  *  lcore_id.
35  *
36  */
37 void guest_channel_host_disconnect(unsigned int lcore_id);
38
39 /**
40  * Send a message contained in pkt over the Virtio-Serial to the host endpoint.
41  *
42  * @param pkt
43  *  Pointer to a populated struct guest_agent_pkt
44  *
45  * @param lcore_id
46  *  lcore_id.
47  *
48  * @return
49  *  - 0 on success.
50  *  - Negative on channel not connected.
51  *  - errno on write to channel error.
52  */
53 int guest_channel_send_msg(struct channel_packet *pkt, unsigned int lcore_id);
54
55 /**
56  * Send a message contained in pkt over the Virtio-Serial to the host endpoint.
57  *
58  * @param pkt
59  *  Pointer to a populated struct channel_packet
60  *
61  * @param lcore_id
62  *  lcore_id.
63  *
64  * @return
65  *  - 0 on success.
66  *  - Negative on error.
67  */
68 int rte_power_guest_channel_send_msg(struct channel_packet *pkt,
69                         unsigned int lcore_id);
70
71 /**
72  * Read a message contained in pkt over the Virtio-Serial
73  * from the host endpoint.
74  *
75  * @param pkt
76  *  Pointer to a populated struct channel_packet
77  *
78  * @param lcore_id
79  *  lcore_id.
80  *
81  * @return
82  *  - 0 on success.
83  *  - Negative on error.
84  */
85 int power_guest_channel_read_msg(struct channel_packet *pkt,
86                 unsigned int lcore_id);
87
88 /**
89  * Receive a message contained in pkt over the Virtio-Serial
90  * from the host endpoint.
91  *
92  * @param pkt
93  *  Pointer to a populated struct channel_packet
94  *
95  * @param lcore_id
96  *  lcore_id.
97  *
98  * @return
99  *  - 0 on success.
100  *  - Negative on error.
101  */
102 __rte_experimental
103 int
104 rte_power_guest_channel_receive_msg(struct channel_packet *pkt,
105                         unsigned int lcore_id);
106
107 #ifdef __cplusplus
108 }
109 #endif
110
111 #endif