FD.io VPP  v17.10-9-gd594711
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 /** \brief Create memory interface
17  @param client_index - opaque cookie to identify the sender
18  @param context - sender context, to match reply w/ request
19  @param role - role of the interface in the connection (master/slave)
20  @param mode - interface mode
21  @param rx_queues - number of rx queues (only valid for slave)
22  #param tx_queues - number of tx queues (only valid for slave)
23  @param id - 32bit integer used to authenticate and match opposite sides
24  of the connection
25  @param socket_filename - filename of the socket to be used for connection
26  establishment
27  @param ring_size - the number of entries of RX/TX rings
28  @param buffer_size - size of the buffer allocated for each ring entry
29  @param hw_addr - interface MAC address
30 */
32 {
35 
36  u8 role; /* 0 = master, 1 = slave */
37  u8 mode; /* 0 = ethernet, 1 = ip, 2 = punt/inject */
38  u8 rx_queues; /* optional, default is 1 */
39  u8 tx_queues; /* optional, default is 1 */
40  u32 id; /* optional, default is 0 */
41  u8 socket_filename[128]; /* optional, default is "/var/vpp/memif.sock" */
42  u8 secret[24]; /* optional, default is "" */
43  u32 ring_size; /* optional, default is 1024 entries, must be power of 2 */
44  u16 buffer_size; /* optional, default is 2048 bytes */
45  u8 hw_addr[6]; /* optional, randomly generated if not defined */
46 };
47 
48 /** \brief Create memory interface response
49  @param context - sender context, to match reply w/ request
50  @param retval - return value for request
51  @param sw_if_index - software index of the newly created interface
52 */
53 define memif_create_reply
54 {
58 };
59 
60 /** \brief Delete memory interface
61  @param client_index - opaque cookie to identify the sender
62  @param context - sender context, to match reply w/ request
63  @param sw_if_index - software index of the interface to delete
64 */
65 autoreply define memif_delete
66 {
69 
71 };
72 
73 /** \brief Memory interface details structure
74  @param context - sender context, to match reply w/ request (memif_dump)
75  @param sw_if_index - index of the interface
76  @param if_name - name of the interface
77  @param hw_addr - interface MAC address
78  @param id - id associated with the interface
79  @param role - role of the interface in the connection (master/slave)
80  @param mode - interface mode
81  @param socket_filename - name of the socket used by this interface
82  to establish new connections
83  @param ring_size - the number of entries of RX/TX rings
84  @param buffer_size - size of the buffer allocated for each ring entry
85  @param admin_up_down - interface administrative status
86  @param link_up_down - interface link status
87 
88 */
89 define memif_details
90 {
92 
94  u8 if_name[64];
95  u8 hw_addr[6];
96 
97  /* memif specific parameters */
99  u8 role; /* 0 = master, 1 = slave */
100  u8 mode; /* 0 = ethernet, 1 = ip, 2 = punt/inject */
101  u8 socket_filename[128];
103  u16 buffer_size; /* optional, default is 2048 bytes */
104 
105  /* 1 = up, 0 = down */
108 };
109 
110 /** \brief Dump all memory interfaces
111  @param client_index - opaque cookie to identify the sender
112  @param context - sender context, to match reply w/ request
113 */
114 define memif_dump
115 {
118 };
119 
120 /*
121  * Local Variables:
122  * eval: (c-set-style "gnu")
123  * End:
124  */
int i32
Definition: types.h:81
unsigned int u32
Definition: types.h:88
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:526
unsigned short u16
Definition: types.h:57
unsigned char u8
Definition: types.h:56
int memif_delete(memif_conn_handle_t *conn)
Memif delete.
Definition: main.c:1072