FD.io VPP  v21.10.1-2-g0a485f517
Vector Packet Processing
memif.api
Go to the documentation of this file.
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 
23 {
26 };
27 
29 {
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 */
45 {
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  option vat_help = "[add|del] id <id> filename <file>";
52 };
53 
54 /** \brief Create memory interface
55  @param client_index - opaque cookie to identify the sender
56  @param context - sender context, to match reply w/ request
57  @param role - role of the interface in the connection (master/slave)
58  @param mode - interface mode
59  @param rx_queues - number of rx queues (only valid for slave)
60  @param tx_queues - number of tx queues (only valid for slave)
61  @param id - 32bit integer used to authenticate and match opposite sides
62  of the connection
63  @param socket_id - socket filename id to be used for connection
64  establishment
65  @param ring_size - the number of entries of RX/TX rings
66  @param buffer_size - size of the buffer allocated for each ring entry
67  @param no_zero_copy - if true, disable zero copy
68  @param hw_addr - interface MAC address
69  @param secret - optional, default is "", max length 24
70 */
72 {
75 
76  vl_api_memif_role_t role; /* 0 = master, 1 = slave */
77  vl_api_memif_mode_t mode; /* 0 = ethernet, 1 = ip, 2 = punt/inject */
78  u8 rx_queues; /* optional, default is 1 */
79  u8 tx_queues; /* optional, default is 1 */
80  u32 id; /* optional, default is 0 */
81  u32 socket_id; /* optional, default is 0, "/var/vpp/memif.sock" */
82  u32 ring_size; /* optional, default is 1024 entries, must be power of 2 */
83  u16 buffer_size; /* optional, default is 2048 bytes */
84  bool no_zero_copy; /* disable zero copy */
85  vl_api_mac_address_t hw_addr; /* optional, randomly generated if zero */
86  string secret[24]; /* optional, default is "", max length 24 */
87  option vat_help = "[id <id>] [socket-id <id>] [ring_size <size>] [buffer_size <size>] [hw_addr <mac_address>] [secret <string>] [mode ip] <master|slave>";
88 };
89 
90 /** \brief Create memory interface response
91  @param context - sender context, to match reply w/ request
92  @param retval - return value for request
93  @param sw_if_index - software index of the newly created interface
94 */
95 define memif_create_reply
96 {
99  vl_api_interface_index_t sw_if_index;
100 };
101 
102 /** \brief Delete memory interface
103  @param client_index - opaque cookie to identify the sender
104  @param context - sender context, to match reply w/ request
105  @param sw_if_index - software index of the interface to delete
106 */
107 autoreply define memif_delete
108 {
111 
112  vl_api_interface_index_t sw_if_index;
113  option vat_help = "<sw_if_index>";
114 };
115 
116 /** \brief Memory interface details structure
117  @param context - sender context, to match reply w/ request
118  @param socket_id - u32 used to identify the given socket filename
119  @param socket_filename - corresponding NUL terminated socket filename
120 */
121 define memif_socket_filename_details
122 {
125  string socket_filename[108];
126 };
127 
128 /** \brief Dump the table of socket ids and corresponding filenames
129  @param client_index - opaque cookie to identify the sender
130  @param context - sender context, to match reply w/ request
131 */
132 define memif_socket_filename_dump
133 {
136 };
137 
138 /** \brief Memory interface details structure
139  @param context - sender context, to match reply w/ request (memif_dump)
140  @param sw_if_index - index of the interface
141  @param hw_addr - interface MAC address
142  @param id - id associated with the interface
143  @param role - role of the interface in the connection (master/slave)
144  @param mode - interface mode
145  @param zero_copy - zero copy flag present
146  @param socket_id - id of the socket filename used by this interface
147  to establish new connections
148  @param ring_size - the number of entries of RX/TX rings
149  @param buffer_size - size of the buffer allocated for each ring entry
150  @param flags - interface_status flags
151  @param if_name - name of the interface
152 
153 */
154 define memif_details
155 {
157 
158  vl_api_interface_index_t sw_if_index;
159  vl_api_mac_address_t hw_addr;
160 
161  /* memif specific parameters */
163  vl_api_memif_role_t role; /* 0 = master, 1 = slave */
164  vl_api_memif_mode_t mode; /* 0 = ethernet, 1 = ip, 2 = punt/inject */
165  bool zero_copy;
168  u16 buffer_size; /* optional, default is 2048 bytes */
169 
170  vl_api_if_status_flags_t flags;
171 
172  string if_name[64];
173 };
174 
175 /** \brief Dump all memory interfaces
176  @param client_index - opaque cookie to identify the sender
177  @param context - sender context, to match reply w/ request
178 */
179 define memif_dump
180 {
183 };
184 
185 /*
186  * Local Variables:
187  * eval: (c-set-style "gnu")
188  * End:
189  */
vl_api_memif_details_t::role
vl_api_memif_role_t role
Definition: memif.api:163
vl_api_memif_socket_filename_dump_t::client_index
u32 client_index
Definition: memif.api:134
vl_api_memif_create_t::socket_id
u32 socket_id
Definition: memif.api:81
vl_api_memif_socket_filename_add_del_t::socket_filename
string socket_filename[108]
Definition: memif.api:50
memif_socket_filename_add_del
int memif_socket_filename_add_del(u8 is_add, u32 sock_id, u8 *sock_filename)
Definition: memif.c:690
vl_api_memif_create_t::secret
string secret[24]
Definition: memif.api:86
vl_api_memif_create_t::rx_queues
u8 rx_queues
Definition: memif.api:78
memif_role
memif_role
Definition: memif.api:22
vl_api_memif_create_t::no_zero_copy
bool no_zero_copy
Definition: memif.api:84
vl_api_memif_details_t::if_name
string if_name[64]
Definition: memif.api:172
vl_api_memif_delete_t::client_index
u32 client_index
Definition: memif.api:109
memif_create
int memif_create(memif_conn_handle_t *conn, memif_conn_args_t *args, memif_connection_update_t *on_connect, memif_connection_update_t *on_disconnect, memif_interrupt_t *on_interrupt, void *private_ctx)
Memory interface create function.
Definition: main.c:1065
vl_api_memif_details_t::zero_copy
bool zero_copy
Definition: memif.api:165
vl_api_memif_delete_t::context
u32 context
Definition: memif.api:110
u16
unsigned short u16
Definition: types.h:57
vl_api_memif_create_t::buffer_size
u16 buffer_size
Definition: memif.api:83
vl_api_memif_create_t::mode
vl_api_memif_mode_t mode
Definition: memif.api:77
vl_api_memif_socket_filename_details_t
Memory interface details structure.
Definition: memif.api:121
vl_api_memif_socket_filename_details_t::socket_id
u32 socket_id
Definition: memif.api:124
vl_api_memif_details_t::socket_id
u32 socket_id
Definition: memif.api:166
vl_api_memif_delete_t::sw_if_index
vl_api_interface_index_t sw_if_index
Definition: memif.api:112
vl_api_memif_create_t::client_index
u32 client_index
Definition: memif.api:73
vl_api_memif_create_t::id
u32 id
Definition: memif.api:80
i32
signed int i32
Definition: types.h:77
vl_api_memif_create_t::context
u32 context
Definition: memif.api:74
memif_mode
memif_mode
Definition: memif.api:28
vl_api_memif_dump_t::context
u32 context
Definition: memif.api:182
vl_api_memif_details_t::buffer_size
u16 buffer_size
Definition: memif.api:168
vl_api_memif_create_reply_t::sw_if_index
vl_api_interface_index_t sw_if_index
Definition: memif.api:99
vl_api_memif_socket_filename_add_del_t::is_add
bool is_add
Definition: memif.api:48
vl_api_memif_socket_filename_dump_t::context
u32 context
Definition: memif.api:135
vl_api_memif_create_t::vat_help
option vat_help
Definition: memif.api:87
vl_api_memif_details_t::mode
vl_api_memif_mode_t mode
Definition: memif.api:164
vl_api_memif_socket_filename_details_t::socket_filename
string socket_filename[108]
Definition: memif.api:125
vl_api_memif_details_t::id
u32 id
Definition: memif.api:162
vl_api_memif_create_t::hw_addr
vl_api_mac_address_t hw_addr
Definition: memif.api:85
vl_api_memif_create_t::role
vl_api_memif_role_t role
Definition: memif.api:76
vl_api_memif_details_t::flags
vl_api_if_status_flags_t flags
Definition: memif.api:170
vl_api_memif_dump_t::client_index
u32 client_index
Definition: memif.api:181
vl_api_memif_socket_filename_add_del_t::vat_help
option vat_help
Definition: memif.api:51
vl_api_memif_create_t::tx_queues
u8 tx_queues
Definition: memif.api:79
vl_api_memif_details_t::ring_size
u32 ring_size
Definition: memif.api:167
vl_api_memif_create_t
Create memory interface.
Definition: memif.api:71
vl_api_memif_socket_filename_details_t::context
u32 context
Definition: memif.api:123
MEMIF_MODE_API_ETHERNET
@ MEMIF_MODE_API_ETHERNET
Definition: memif.api:30
vl_api_memif_details_t::context
u32 context
Definition: memif.api:156
vl_api_memif_socket_filename_add_del_t::context
u32 context
Definition: memif.api:47
vl_api_memif_create_reply_t::context
u32 context
Definition: memif.api:97
MEMIF_MODE_API_IP
@ MEMIF_MODE_API_IP
Definition: memif.api:31
u32
unsigned int u32
Definition: types.h:88
vl_api_memif_dump_t
Dump all memory interfaces.
Definition: memif.api:179
vl_api_memif_create_reply_t::retval
i32 retval
Definition: memif.api:98
vl_api_memif_create_reply_t
Create memory interface response.
Definition: memif.api:95
MEMIF_ROLE_API_SLAVE
@ MEMIF_ROLE_API_SLAVE
Definition: memif.api:25
vl_api_memif_details_t::sw_if_index
vl_api_interface_index_t sw_if_index
Definition: memif.api:158
vl_api_memif_socket_filename_add_del_t::socket_id
u32 socket_id
Definition: memif.api:49
memif_delete
int memif_delete(memif_conn_handle_t *conn)
Memif delete.
Definition: main.c:1784
u8
unsigned char u8
Definition: types.h:56
vl_api_memif_delete_t
Delete memory interface.
Definition: memif.api:107
MEMIF_ROLE_API_MASTER
@ MEMIF_ROLE_API_MASTER
Definition: memif.api:24
vl_api_memif_socket_filename_add_del_t::client_index
u32 client_index
Definition: memif.api:46
vl_api_memif_details_t::hw_addr
vl_api_mac_address_t hw_addr
Definition: memif.api:159
vl_api_memif_socket_filename_add_del_t
Create or remove named socket file for memif interfaces.
Definition: memif.api:44
MEMIF_MODE_API_PUNT_INJECT
@ MEMIF_MODE_API_PUNT_INJECT
Definition: memif.api:32
vl_api_memif_delete_t::vat_help
option vat_help
Definition: memif.api:113
vl_api_memif_create_t::ring_size
u32 ring_size
Definition: memif.api:82
vl_api_memif_details_t
Memory interface details structure.
Definition: memif.api:154
vl_api_memif_socket_filename_dump_t
Dump the table of socket ids and corresponding filenames.
Definition: memif.api:132
version
option version
Definition: memif.api:17