doc: add Meson coding style to contributors guide
[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 /**
12  * Check if any Virtio-Serial VM end-points exist in path.
13  *
14  * @param path
15  *  The path to the serial device on the filesystem
16  *
17  * @return
18  *  - 1 if at least one potential end-point found.
19  *  - 0 if no end-points found.
20  */
21 int guest_channel_host_check_exists(const char *path);
22
23 /**
24  * Connect to the Virtio-Serial VM end-point located in path. It is
25  * thread safe for unique lcore_ids. This function must be only called once from
26  * each lcore.
27  *
28  * @param path
29  *  The path to the serial device on the filesystem
30  *
31  * @param lcore_id
32  *  lcore_id.
33  *
34  * @return
35  *  - 0 on success.
36  *  - Negative on error.
37  */
38 int guest_channel_host_connect(const char *path, unsigned int lcore_id);
39
40 /**
41  * Disconnect from an already connected Virtio-Serial Endpoint.
42  *
43  *
44  * @param lcore_id
45  *  lcore_id.
46  *
47  */
48 void guest_channel_host_disconnect(unsigned int lcore_id);
49
50 /**
51  * Send a message contained in pkt over the Virtio-Serial to the host endpoint.
52  *
53  * @param pkt
54  *  Pointer to a populated struct guest_agent_pkt
55  *
56  * @param lcore_id
57  *  lcore_id.
58  *
59  * @return
60  *  - 0 on success.
61  *  - Negative on channel not connected.
62  *  - errno on write to channel error.
63  */
64 int guest_channel_send_msg(struct rte_power_channel_packet *pkt,
65                 unsigned int lcore_id);
66
67 /**
68  * Read a message contained in pkt over the Virtio-Serial
69  * from the host endpoint.
70  *
71  * @param pkt
72  *  Pointer to rte_power_channel_packet or
73  *  rte_power_channel_packet_freq_list struct.
74  *
75  * @param pkt_len
76  *  Size of expected data 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(void *pkt,
86                 size_t pkt_len,
87                 unsigned int lcore_id);
88
89
90 #ifdef __cplusplus
91 }
92 #endif
93
94 #endif