1 /* Hey Emacs use -*- mode: C -*- */
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:
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 option version = "3.1.0";
19 import "vnet/interface_types.api";
20 import "vnet/ethernet/ethernet_types.api";
24 MEMIF_ROLE_API_MASTER = 0,
25 MEMIF_ROLE_API_SLAVE = 1,
30 MEMIF_MODE_API_ETHERNET = 0,
31 MEMIF_MODE_API_IP = 1,
32 MEMIF_MODE_API_PUNT_INJECT = 2,
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.
44 autoreply define memif_socket_filename_add_del
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>";
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
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
68 define memif_socket_filename_add_del_v2
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>";
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
83 define memif_socket_filename_add_del_v2_reply
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
99 @param socket_id - socket filename id to be used for connection
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
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>";
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
133 define memif_create_reply
139 vl_api_interface_index_t sw_if_index;
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
151 @param socket_id - socket filename id to be used for connection
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
160 define memif_create_v2
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>";
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
185 define memif_create_v2_reply
189 vl_api_interface_index_t sw_if_index;
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
197 autoreply define memif_delete
202 vl_api_interface_index_t sw_if_index;
203 option vat_help = "<sw_if_index>";
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
211 define memif_socket_filename_details
215 string socket_filename[108];
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
222 define memif_socket_filename_dump
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
248 vl_api_interface_index_t sw_if_index;
249 vl_api_mac_address_t hw_addr;
251 /* memif specific parameters */
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 */
258 u16 buffer_size; /* optional, default is 2048 bytes */
260 vl_api_if_status_flags_t flags;
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
277 * eval: (c-set-style "gnu")