6a61ee110aee77aa4d9f69d0cbd4746272cde723
[vpp.git] / src / plugins / memif / memif.api
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 */
27 autoreply define memif_socket_filename_add_del
28 {
29   u32 client_index;
30   u32 context;
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 */
51 define memif_create
52 {
53   u32 client_index;
54   u32 context;
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 {
75   u32 context;
76   i32 retval;
77   u32 sw_if_index;
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 {
87   u32 client_index;
88   u32 context;
89
90   u32 sw_if_index;
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 {
100   u32 context;
101   u32 socket_id;
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 {
111   u32 client_index;
112   u32 context;
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 {
133   u32 context;
134
135   u32 sw_if_index;
136   u8 if_name[64];
137   u8 hw_addr[6];
138
139   /* memif specific parameters */
140   u32 id;
141   u8 role; /* 0 = master, 1 = slave */
142   u8 mode; /* 0 = ethernet, 1 = ip, 2 = punt/inject */
143   u32 socket_id;
144   u32 ring_size;
145   u16 buffer_size; /* optional, default is 2048 bytes */
146
147   /* 1 = up, 0 = down */
148   u8 admin_up_down;
149   u8 link_up_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 {
158   u32 client_index;
159   u32 context;
160 };
161
162 /*
163  * Local Variables:
164  * eval: (c-set-style "gnu")
165  * End:
166  */