memif: API cleanup
[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.0.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   u32 client_index;
47   u32 context;
48   bool is_add;          /* 0 = remove, 1 = add association */
49   u32 socket_id;        /* unique non-0 id for given socket file name */
50   string socket_filename[108];  /* NUL terminated filename */
51 };
52
53 /** \brief Create memory interface
54     @param client_index - opaque cookie to identify the sender
55     @param context - sender context, to match reply w/ request
56     @param role - role of the interface in the connection (master/slave)
57     @param mode - interface mode
58     @param rx_queues - number of rx queues (only valid for slave)
59     @param tx_queues - number of tx queues (only valid for slave)
60     @param id - 32bit integer used to authenticate and match opposite sides
61            of the connection
62     @param socket_id - socket filename id to be used for connection
63            establishment
64     @param ring_size - the number of entries of RX/TX rings
65     @param buffer_size - size of the buffer allocated for each ring entry
66     @param no_zero_copy - if true, disable zero copy
67     @param hw_addr - interface MAC address
68     @param secret - optional, default is "", max length 24
69 */
70 define memif_create
71 {
72   u32 client_index;
73   u32 context;
74
75   vl_api_memif_role_t role; /* 0 = master, 1 = slave */
76   vl_api_memif_mode_t mode; /* 0 = ethernet, 1 = ip, 2 = punt/inject */
77   u8 rx_queues; /* optional, default is 1 */
78   u8 tx_queues; /* optional, default is 1 */
79   u32 id; /* optional, default is 0 */
80   u32 socket_id; /* optional, default is 0, "/var/vpp/memif.sock" */
81   u32 ring_size; /* optional, default is 1024 entries, must be power of 2 */
82   u16 buffer_size; /* optional, default is 2048 bytes */
83   bool no_zero_copy; /* disable zero copy */
84   vl_api_mac_address_t hw_addr; /* optional, randomly generated if zero */
85   string secret[24]; /* optional, default is "", max length 24 */
86 };
87
88 /** \brief Create memory interface response
89     @param context - sender context, to match reply w/ request
90     @param retval - return value for request
91     @param sw_if_index - software index of the newly created interface
92 */
93 define memif_create_reply
94 {
95   u32 context;
96   i32 retval;
97   vl_api_interface_index_t sw_if_index;
98 };
99
100 /** \brief Delete memory interface
101     @param client_index - opaque cookie to identify the sender
102     @param context - sender context, to match reply w/ request
103     @param sw_if_index - software index of the interface to delete
104 */
105 autoreply define memif_delete
106 {
107   u32 client_index;
108   u32 context;
109
110   vl_api_interface_index_t sw_if_index;
111 };
112
113 /** \brief Memory interface details structure
114     @param context - sender context, to match reply w/ request
115     @param socket_id - u32 used to identify the given socket filename
116     @param socket_filename - correpsonding NUL terminated socket filename
117 */
118 define memif_socket_filename_details
119 {
120   u32 context;
121   u32 socket_id;
122   string socket_filename[108];
123 };
124
125 /** \brief Dump the table of socket ids and corresponding filenames
126     @param client_index - opaque cookie to identify the sender
127     @param context - sender context, to match reply w/ request
128 */
129 define memif_socket_filename_dump
130 {
131   u32 client_index;
132   u32 context;
133 };
134
135 /** \brief Memory interface details structure
136     @param context - sender context, to match reply w/ request (memif_dump)
137     @param sw_if_index - index of the interface
138     @param hw_addr - interface MAC address
139     @param id - id associated with the interface
140     @param role - role of the interface in the connection (master/slave)
141     @param mode - interface mode
142     @param zero_copy - zero copy flag present
143     @param socket_id - id of the socket filename used by this interface
144            to establish new connections
145     @param ring_size - the number of entries of RX/TX rings
146     @param buffer_size - size of the buffer allocated for each ring entry
147     @param flags - interface_status flags
148     @param if_name - name of the interface
149
150 */
151 define memif_details
152 {
153   u32 context;
154
155   vl_api_interface_index_t sw_if_index;
156   vl_api_mac_address_t hw_addr;
157
158   /* memif specific parameters */
159   u32 id;
160   vl_api_memif_role_t role; /* 0 = master, 1 = slave */
161   vl_api_memif_mode_t mode; /* 0 = ethernet, 1 = ip, 2 = punt/inject */
162   bool zero_copy;
163   u32 socket_id;
164   u32 ring_size;
165   u16 buffer_size; /* optional, default is 2048 bytes */
166
167   vl_api_if_status_flags_t flags;
168
169   string if_name[64];
170 };
171
172 /** \brief Dump all memory interfaces
173     @param client_index - opaque cookie to identify the sender
174     @param context - sender context, to match reply w/ request
175 */
176 define memif_dump
177 {
178   u32 client_index;
179   u32 context;
180 };
181
182 /*
183  * Local Variables:
184  * eval: (c-set-style "gnu")
185  * End:
186  */