FD.io VPP  v18.07.1-19-g511ce25
Vector Packet Processing
memif.api
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017 Cisco and/or its affiliates.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at:
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 option version = "2.0.0";
17 
18 /** \brief Create or remove named socket file for memif interfaces
19  @param client_index - opaque cookie to identify the sender
20  @param context - sender context, to match reply w/ request
21  @param is_add - 0 = remove, 1 = add association
22  @param socket_id - non-0 32-bit integer used to identify a socket file
23  @param socket_filename - filename of the socket to be used for connection
24  establishment; id 0 always maps to default "/var/vpp/memif.sock";
25  no socket filename needed when is_add == 0.
26 */
28 {
31  u8 is_add; /* 0 = remove, 1 = add association */
32  u32 socket_id; /* unique non-0 id for given socket file name */
33  u8 socket_filename[128]; /* NUL terminated filename */
34 };
35 
36 /** \brief Create memory interface
37  @param client_index - opaque cookie to identify the sender
38  @param context - sender context, to match reply w/ request
39  @param role - role of the interface in the connection (master/slave)
40  @param mode - interface mode
41  @param rx_queues - number of rx queues (only valid for slave)
42  @param tx_queues - number of tx queues (only valid for slave)
43  @param id - 32bit integer used to authenticate and match opposite sides
44  of the connection
45  @param socket_id - socket filename id to be used for connection
46  establishment
47  @param ring_size - the number of entries of RX/TX rings
48  @param buffer_size - size of the buffer allocated for each ring entry
49  @param hw_addr - interface MAC address
50 */
52 {
55 
56  u8 role; /* 0 = master, 1 = slave */
57  u8 mode; /* 0 = ethernet, 1 = ip, 2 = punt/inject */
58  u8 rx_queues; /* optional, default is 1 */
59  u8 tx_queues; /* optional, default is 1 */
60  u32 id; /* optional, default is 0 */
61  u32 socket_id; /* optional, default is 0, "/var/vpp/memif.sock" */
62  u8 secret[24]; /* optional, default is "" */
63  u32 ring_size; /* optional, default is 1024 entries, must be power of 2 */
64  u16 buffer_size; /* optional, default is 2048 bytes */
65  u8 hw_addr[6]; /* optional, randomly generated if not defined */
66 };
67 
68 /** \brief Create memory interface response
69  @param context - sender context, to match reply w/ request
70  @param retval - return value for request
71  @param sw_if_index - software index of the newly created interface
72 */
73 define memif_create_reply
74 {
78 };
79 
80 /** \brief Delete memory interface
81  @param client_index - opaque cookie to identify the sender
82  @param context - sender context, to match reply w/ request
83  @param sw_if_index - software index of the interface to delete
84 */
85 autoreply define memif_delete
86 {
89 
91 };
92 
93 /** \brief Memory interface details structure
94  @param context - sender context, to match reply w/ request
95  @param socket_id - u32 used to identify the given socket filename
96  @param socket_filename - correpsonding NUL terminated socket filename
97 */
98 define memif_socket_filename_details
99 {
102  u8 socket_filename[128];
103 };
104 
105 /** \brief Dump the table of socket ids and corresponding filenames
106  @param client_index - opaque cookie to identify the sender
107  @param context - sender context, to match reply w/ request
108 */
109 define memif_socket_filename_dump
110 {
113 };
114 
115 /** \brief Memory interface details structure
116  @param context - sender context, to match reply w/ request (memif_dump)
117  @param sw_if_index - index of the interface
118  @param if_name - name of the interface
119  @param hw_addr - interface MAC address
120  @param id - id associated with the interface
121  @param role - role of the interface in the connection (master/slave)
122  @param mode - interface mode
123  @param socket_id - id of the socket filename used by this interface
124  to establish new connections
125  @param ring_size - the number of entries of RX/TX rings
126  @param buffer_size - size of the buffer allocated for each ring entry
127  @param admin_up_down - interface administrative status
128  @param link_up_down - interface link status
129 
130 */
131 define memif_details
132 {
134 
136  u8 if_name[64];
137  u8 hw_addr[6];
138 
139  /* memif specific parameters */
141  u8 role; /* 0 = master, 1 = slave */
142  u8 mode; /* 0 = ethernet, 1 = ip, 2 = punt/inject */
145  u16 buffer_size; /* optional, default is 2048 bytes */
146 
147  /* 1 = up, 0 = down */
150 };
151 
152 /** \brief Dump all memory interfaces
153  @param client_index - opaque cookie to identify the sender
154  @param context - sender context, to match reply w/ request
155 */
156 define memif_dump
157 {
160 };
161 
162 /*
163  * Local Variables:
164  * eval: (c-set-style "gnu")
165  * End:
166  */
option version
Definition: memif.api:16
unsigned char u8
Definition: types.h:56
unsigned int u32
Definition: types.h:88
unsigned short u16
Definition: types.h:57
int memif_socket_filename_add_del(u8 is_add, u32 sock_id, u8 *sock_filename)
Definition: memif.c:621
signed int i32
Definition: types.h:81
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:595
int memif_delete(memif_conn_handle_t *conn)
Memif delete.
Definition: main.c:1184