hs-test: fixed timed out tests passing in the CI
[vpp.git] / src / plugins / memif / memif.api
1 /* Hey Emacs use -*- mode: C -*- */
2 /*
3  * Copyright (c) 2017 Cisco and/or its affiliates.
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at:
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 option version = "3.1.0";
18
19 import "vnet/interface_types.api";
20 import "vnet/ethernet/ethernet_types.api";
21
22 enum memif_role
23 {
24   MEMIF_ROLE_API_MASTER = 0,
25   MEMIF_ROLE_API_SLAVE = 1,
26 };
27
28 enum memif_mode
29 {
30   MEMIF_MODE_API_ETHERNET = 0,
31   MEMIF_MODE_API_IP = 1,
32   MEMIF_MODE_API_PUNT_INJECT = 2,
33 };
34
35 /** \brief Create or remove named socket file for memif interfaces
36     @param client_index - opaque cookie to identify the sender
37     @param context - sender context, to match reply w/ request
38     @param is_add - 0 = remove, 1 = add association
39     @param socket_id - non-0 32-bit integer used to identify a socket file
40     @param socket_filename - filename of the socket to be used for connection
41            establishment; id 0 always maps to default "/var/vpp/memif.sock";
42            no socket filename needed when is_add == 0.
43 */
44 autoreply define memif_socket_filename_add_del
45 {
46   option deprecated;
47
48   u32 client_index;
49   u32 context;
50   bool is_add;          /* 0 = remove, 1 = add association */
51   u32 socket_id;        /* unique non-0 id for given socket file name */
52   string socket_filename[108];  /* NUL terminated filename */
53   option vat_help = "[add|del] id <id> filename <file>";
54 };
55
56 /** \brief Create or remove named socket file for memif interfaces
57     @param client_index - opaque cookie to identify the sender
58     @param context - sender context, to match reply w/ request
59     @param is_add - 0 = remove, 1 = add association
60     @param socket_id - non-0 32-bit integer used to identify a socket file
61           ~0 means autogenerate
62     @param socket_filename - filename of the socket to be used for connection
63            establishment; id 0 always maps to default "/var/vpp/memif.sock";
64            no socket filename needed when is_add == 0.
65            socket_filename starting with '@' will create an abstract socket
66            in the given namespace
67 */
68 define memif_socket_filename_add_del_v2
69 {
70   u32 client_index;
71   u32 context;
72   bool is_add;                          /* 0 = remove, 1 = add association */
73   u32 socket_id [default=0xffffffff];   /* unique non-0 id for given socket file name */
74   string socket_filename[];             /* NUL terminated filename */
75   option vat_help = "[add|del] id <id> filename <file>";
76 };
77
78 /** \brief Create memory interface socket file response
79     @param context - sender context, to match reply w/ request
80     @param retval - return value for request
81     @param socket_id - non-0 32-bit integer used to identify a socket file
82 */
83 define memif_socket_filename_add_del_v2_reply
84 {
85   u32 context;
86   i32 retval;
87   u32 socket_id;
88 };
89
90 /** \brief Create memory interface
91     @param client_index - opaque cookie to identify the sender
92     @param context - sender context, to match reply w/ request
93     @param role - role of the interface in the connection (master/slave)
94     @param mode - interface mode
95     @param rx_queues - number of rx queues (only valid for slave)
96     @param tx_queues - number of tx queues (only valid for slave)
97     @param id - 32bit integer used to authenticate and match opposite sides
98            of the connection
99     @param socket_id - socket filename id to be used for connection
100            establishment
101     @param ring_size - the number of entries of RX/TX rings
102     @param buffer_size - size of the buffer allocated for each ring entry
103     @param no_zero_copy - if true, disable zero copy
104     @param hw_addr - interface MAC address
105     @param secret - optional, default is "", max length 24
106 */
107 define memif_create
108 {
109   option deprecated;
110
111   u32 client_index;
112   u32 context;
113
114   vl_api_memif_role_t role; /* 0 = master, 1 = slave */
115   vl_api_memif_mode_t mode; /* 0 = ethernet, 1 = ip, 2 = punt/inject */
116   u8 rx_queues; /* optional, default is 1 */
117   u8 tx_queues; /* optional, default is 1 */
118   u32 id; /* optional, default is 0 */
119   u32 socket_id; /* optional, default is 0, "/var/vpp/memif.sock" */
120   u32 ring_size; /* optional, default is 1024 entries, must be power of 2 */
121   u16 buffer_size; /* optional, default is 2048 bytes */
122   bool no_zero_copy; /* disable zero copy */
123   vl_api_mac_address_t hw_addr; /* optional, randomly generated if zero */
124   string secret[24]; /* optional, default is "", max length 24 */
125   option vat_help = "[id <id>] [socket-id <id>] [ring_size <size>] [buffer_size <size>] [hw_addr <mac_address>] [secret <string>] [mode ip] <master|slave>";
126 };
127
128 /** \brief Create memory interface response
129     @param context - sender context, to match reply w/ request
130     @param retval - return value for request
131     @param sw_if_index - software index of the newly created interface
132 */
133 define memif_create_reply
134 {
135   option deprecated;
136
137   u32 context;
138   i32 retval;
139   vl_api_interface_index_t sw_if_index;
140 };
141
142 /** \brief Create memory interface
143     @param client_index - opaque cookie to identify the sender
144     @param context - sender context, to match reply w/ request
145     @param role - role of the interface in the connection (master/slave)
146     @param mode - interface mode
147     @param rx_queues - number of rx queues (only valid for slave)
148     @param tx_queues - number of tx queues (only valid for slave)
149     @param id - 32bit integer used to authenticate and match opposite sides
150            of the connection
151     @param socket_id - socket filename id to be used for connection
152            establishment
153     @param ring_size - the number of entries of RX/TX rings
154     @param buffer_size - size of the buffer allocated for each ring entry
155     @param no_zero_copy - if true, disable zero copy
156     @param use_dma - if true, use dma accelerate memory copy
157     @param hw_addr - interface MAC address
158     @param secret - optional, default is "", max length 24
159 */
160 define memif_create_v2
161 {
162   u32 client_index;
163   u32 context;
164
165   vl_api_memif_role_t role; /* 0 = master, 1 = slave */
166   vl_api_memif_mode_t mode; /* 0 = ethernet, 1 = ip, 2 = punt/inject */
167   u8 rx_queues; /* optional, default is 1 */
168   u8 tx_queues; /* optional, default is 1 */
169   u32 id; /* optional, default is 0 */
170   u32 socket_id; /* optional, default is 0, "/var/vpp/memif.sock" */
171   u32 ring_size; /* optional, default is 1024 entries, must be power of 2 */
172   u16 buffer_size; /* optional, default is 2048 bytes */
173   bool no_zero_copy; /* disable zero copy */
174   bool use_dma; /* use dma acceleration */
175   vl_api_mac_address_t hw_addr; /* optional, randomly generated if zero */
176   string secret[24]; /* optional, default is "", max length 24 */
177   option vat_help = "[id <id>] [socket-id <id>] [ring_size <size>] [buffer_size <size>] [hw_addr <mac_address>] [secret <string>] [mode ip] <master|slave>";
178 };
179
180 /** \brief Create memory interface response
181     @param context - sender context, to match reply w/ request
182     @param retval - return value for request
183     @param sw_if_index - software index of the newly created interface
184 */
185 define memif_create_v2_reply
186 {
187   u32 context;
188   i32 retval;
189   vl_api_interface_index_t sw_if_index;
190 };
191
192 /** \brief Delete memory interface
193     @param client_index - opaque cookie to identify the sender
194     @param context - sender context, to match reply w/ request
195     @param sw_if_index - software index of the interface to delete
196 */
197 autoreply define memif_delete
198 {
199   u32 client_index;
200   u32 context;
201
202   vl_api_interface_index_t sw_if_index;
203   option vat_help = "<sw_if_index>";
204 };
205
206 /** \brief Memory interface details structure
207     @param context - sender context, to match reply w/ request
208     @param socket_id - u32 used to identify the given socket filename
209     @param socket_filename - corresponding NUL terminated socket filename
210 */
211 define memif_socket_filename_details
212 {
213   u32 context;
214   u32 socket_id;
215   string socket_filename[108];
216 };
217
218 /** \brief Dump the table of socket ids and corresponding filenames
219     @param client_index - opaque cookie to identify the sender
220     @param context - sender context, to match reply w/ request
221 */
222 define memif_socket_filename_dump
223 {
224   u32 client_index;
225   u32 context;
226 };
227
228 /** \brief Memory interface details structure
229     @param context - sender context, to match reply w/ request (memif_dump)
230     @param sw_if_index - index of the interface
231     @param hw_addr - interface MAC address
232     @param id - id associated with the interface
233     @param role - role of the interface in the connection (master/slave)
234     @param mode - interface mode
235     @param zero_copy - zero copy flag present
236     @param socket_id - id of the socket filename used by this interface
237            to establish new connections
238     @param ring_size - the number of entries of RX/TX rings
239     @param buffer_size - size of the buffer allocated for each ring entry
240     @param flags - interface_status flags
241     @param if_name - name of the interface
242
243 */
244 define memif_details
245 {
246   u32 context;
247
248   vl_api_interface_index_t sw_if_index;
249   vl_api_mac_address_t hw_addr;
250
251   /* memif specific parameters */
252   u32 id;
253   vl_api_memif_role_t role; /* 0 = master, 1 = slave */
254   vl_api_memif_mode_t mode; /* 0 = ethernet, 1 = ip, 2 = punt/inject */
255   bool zero_copy;
256   u32 socket_id;
257   u32 ring_size;
258   u16 buffer_size; /* optional, default is 2048 bytes */
259
260   vl_api_if_status_flags_t flags;
261
262   string if_name[64];
263 };
264
265 /** \brief Dump all memory interfaces
266     @param client_index - opaque cookie to identify the sender
267     @param context - sender context, to match reply w/ request
268 */
269 define memif_dump
270 {
271   u32 client_index;
272   u32 context;
273 };
274
275 /*
276  * Local Variables:
277  * eval: (c-set-style "gnu")
278  * End:
279  */