Add support for API client to receive L2 MAC events
[vpp.git] / src / vnet / l2 / l2.api
1 /* Hey Emacs use -*- mode: C -*- */
2 /*
3  * Copyright (c) 2016 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 /** \brief Reply to l2_xconnect_dump 
18     @param context - sender context which was passed in the request
19     @param rx_sw_if_index - Receive interface index
20     @param tx_sw_if_index - Transmit interface index
21  */
22 define l2_xconnect_details
23 {
24   u32 context;
25   u32 rx_sw_if_index;
26   u32 tx_sw_if_index;
27 };
28
29 /** \brief Dump L2 XConnects
30     @param client_index - opaque cookie to identify the sender
31     @param context - sender context, to match reply w/ request
32 */
33 define l2_xconnect_dump
34 {
35   u32 client_index;
36   u32 context;
37 };
38
39 /** \brief l2 fib table details structure
40     @param bd_id - the l2 fib / bridge domain table id
41     @param mac - the entry's mac address
42     @param sw_if_index - index of the interface
43     @param static_mac - the entry is statically configured.
44     @param filter_mac - the entry is a mac filter entry.
45     @param bvi_mac - the mac address is a bridge virtual interface
46 */
47 define l2_fib_table_details
48 {
49   u32 context;
50   u32 bd_id;
51   u64 mac;
52   u32 sw_if_index;
53   u8 static_mac;
54   u8 filter_mac;
55   u8 bvi_mac;
56 };
57
58 /** \brief Dump l2 fib (aka bridge domain) table
59     @param client_index - opaque cookie to identify the sender
60     @param bd_id - the l2 fib / bridge domain table identifier
61 */
62 define l2_fib_table_dump
63 {
64   u32 client_index;
65   u32 context;
66   u32 bd_id;
67 };
68
69 /** \brief L2 fib clear table request, clear all mac entries in the l2 fib
70     @param client_index - opaque cookie to identify the sender
71     @param context - sender context, to match reply w/ request
72 */
73 autoreply define l2_fib_clear_table
74 {
75   u32 client_index;
76   u32 context;
77 };
78
79 /** \brief L2 FIB flush all  entries
80     @param client_index - opaque cookie to identify the sender
81     @param context - sender context, to match reply w/ request
82 */
83 autoreply define l2fib_flush_all
84 {
85   u32 client_index;
86   u32 context;
87 };
88
89 /** \brief L2 FIB flush bridge domain entries
90     @param client_index - opaque cookie to identify the sender
91     @param context - sender context, to match reply w/ request
92     @param bd_id - the entry's bridge domain id
93 */
94 autoreply define l2fib_flush_bd
95 {
96   u32 client_index;
97   u32 context;
98   u32 bd_id;
99 };
100
101 /** \brief L2 FIB flush interface entries
102     @param client_index - opaque cookie to identify the sender
103     @param context - sender context, to match reply w/ request
104     @param bd_id - the entry's bridge domain id
105 */
106 autoreply define l2fib_flush_int
107 {
108   u32 client_index;
109   u32 context;
110   u32 sw_if_index;
111 };
112
113 /** \brief L2 FIB add entry request
114     @param client_index - opaque cookie to identify the sender
115     @param context - sender context, to match reply w/ request
116     @param mac - the entry's mac address
117     @param bd_id - the entry's bridge domain id
118     @param sw_if_index - the interface
119     @param is_add - If non zero add the entry, else delete it
120     @param static_mac - 
121     @param filter_mac -
122 */
123 autoreply define l2fib_add_del
124 {
125   u32 client_index;
126   u32 context;
127   u64 mac;
128   u32 bd_id;
129   u32 sw_if_index;
130   u8 is_add;
131   u8 static_mac;
132   u8 filter_mac;
133   u8 bvi_mac;
134 };
135
136 /** \brief Register to recive L2 MAC events for leanred and aged MAC
137     Will also change MAC learn limit to L2LEARN_INFORM_LIMIT
138     @param client_index - opaque cookie to identify the sender
139     @param context - sender context, to match reply w/ request
140     @param learn_limit - MAC learn limit, 0 => default to 1000
141     @param scan_delay - event scan delay in 10 msec unit, 0 => default to 100 msec
142     @param max_macs_in_event - in units of 10 mac entries, 0 => default to 100 entries
143     @param enable_disable - 1 => register for MAC events, 0 => cancel registration
144     @param pid - sender's pid
145 */
146 autoreply define want_l2_macs_events
147 {
148   u32 client_index;
149   u32 context;
150   u32 learn_limit;
151   u8  scan_delay;
152   u8  max_macs_in_event;
153   u8  enable_disable;
154   u32 pid;
155 };
156
157 /** \brief Entry for learned or aged MAC in L2 MAC Events
158     @param sw_if_index - sw_if_index in the domain
159     @param mac_addr - mac_address
160     @is_del - 0 => newly learned MAC, 1 => aged out MAC
161 */
162 typeonly define mac_entry
163 {
164   u32 sw_if_index;
165   u8  mac_addr[6];
166   u8  is_del;
167   u8  spare;
168 };
169
170 /** \brief L2 MAC event for a list of learned or aged MACs
171     @param client_index - opaque cookie to identify the sender
172     @param pid - client pid registered to receive notification
173     @param n_macs - number of learned/aged MAC enntries
174     @param mac - array of learned/aged MAC entries
175 */
176 define l2_macs_event
177 {
178   u32 client_index;
179   u32 pid;
180   u32 n_macs;
181   vl_api_mac_entry_t mac[n_macs];
182 };
183
184 /** \brief Set interface L2 flags (such as L2_LEARN, L2_FWD, 
185     L2_FLOOD, L2_UU_FLOOD, or L2_ARP_TERM bits). This can be used
186     to disable one or more of the features represented by the
187     flag bits on an interface to override what is set as default
188     for all interfaces in the bridge domain
189     @param client_index - opaque cookie to identify the sender
190     @param context - sender context, to match reply w/ request
191     @param sw_if_index - interface 
192     @param is_set - if non-zero, set the bits, else clear them
193     @param feature_bitmap - non-zero bits (as above) to set or clear
194 */
195 define l2_flags
196 {
197   u32 client_index;
198   u32 context;
199   u32 sw_if_index;
200   u8 is_set;
201   u32 feature_bitmap;
202 };
203
204 /** \brief Set interface L2 flags response
205     @param context - sender context, to match reply w/ request
206     @param retval - return code for the set l2 bits request
207     @param resulting_feature_bitmap - the internal l2 feature bitmap after the request is implemented
208 */
209 define l2_flags_reply
210 {
211   u32 context;
212   i32 retval;
213   u32 resulting_feature_bitmap;
214 };
215
216 /** \brief L2 bridge domain set mac age
217     @param client_index - opaque cookie to identify the sender
218     @param context - sender context, to match reply w/ request
219     @param bd_id - the bridge domain to create
220     @param mac_age - mac aging time in min, 0 for disabled
221 */
222 autoreply define bridge_domain_set_mac_age
223 {
224   u32 client_index;
225   u32 context;
226   u32 bd_id;
227   u8 mac_age;
228 };
229
230 /** \brief L2 bridge domain add or delete request
231     @param client_index - opaque cookie to identify the sender
232     @param context - sender context, to match reply w/ request
233     @param bd_id - the bridge domain to create
234     @param flood - enable/disable bcast/mcast flooding in the bd
235     @param uu_flood - enable/disable uknown unicast flood in the bd
236     @param forward - enable/disable forwarding on all interfaces in the bd
237     @param learn - enable/disable learning on all interfaces in the bd
238     @param arp_term - enable/disable arp termination in the bd
239     @param mac_age - mac aging time in min, 0 for disabled
240     @param is_add - add or delete flag
241 */
242 autoreply define bridge_domain_add_del
243 {
244   u32 client_index;
245   u32 context;
246   u32 bd_id;
247   u8 flood;
248   u8 uu_flood;
249   u8 forward;
250   u8 learn;
251   u8 arp_term;
252   u8 mac_age;
253   u8 is_add;
254 };
255
256 /** \brief L2 bridge domain request operational state details
257     @param client_index - opaque cookie to identify the sender
258     @param context - sender context, to match reply w/ request
259     @param bd_id - the bridge domain id desired or ~0 to request all bds
260 */
261 define bridge_domain_dump
262 {
263   u32 client_index;
264   u32 context;
265   u32 bd_id;
266 };
267
268 /** \brief L2 bridge domain sw interface operational state response
269     @param bd_id - the bridge domain id
270     @param sw_if_index - sw_if_index in the domain
271     @param shg - split horizon group for the interface
272 */
273 typeonly manual_print manual_endian define bridge_domain_sw_if
274 {
275   u32 context;
276   u32 sw_if_index;
277   u8 shg;
278 };
279
280 /** \brief L2 bridge domain operational state response
281     @param bd_id - the bridge domain id
282     @param flood - bcast/mcast flooding state on all interfaces in the bd
283     @param uu_flood - uknown unicast flooding state on all interfaces in the bd
284     @param forward - forwarding state on all interfaces in the bd
285     @param learn - learning state on all interfaces in the bd
286     @param arp_term - arp termination state on all interfaces in the bd
287     @param mac_age - mac aging time in min, 0 for disabled
288     @param n_sw_ifs - number of sw_if_index's in the domain
289 */
290 manual_print manual_endian define bridge_domain_details
291 {
292   u32 context;
293   u32 bd_id;
294   u8 flood;
295   u8 uu_flood;
296   u8 forward;
297   u8 learn;
298   u8 arp_term;
299   u8 mac_age;
300   u32 bvi_sw_if_index;
301   u32 n_sw_ifs;
302   vl_api_bridge_domain_sw_if_t sw_if_details[n_sw_ifs];
303 };
304
305 /** \brief Set bridge flags (such as L2_LEARN, L2_FWD, L2_FLOOD, 
306     L2_UU_FLOOD, or L2_ARP_TERM bits) request
307     @param client_index - opaque cookie to identify the sender
308     @param context - sender context, to match reply w/ request
309     @param bd_id - the bridge domain to set the flags for
310     @param is_set - if non-zero, set the flags, else clear them
311     @param feature_bitmap - bits (as above) that are non-zero to set or clear
312 */
313 define bridge_flags
314 {
315   u32 client_index;
316   u32 context;
317   u32 bd_id;
318   u8 is_set;
319   u32 feature_bitmap;
320 };
321
322 /** \brief Set bridge flags response
323     @param context - sender context, to match reply w/ request
324     @param retval - return code for the set bridge flags request
325     @param resulting_feature_bitmap - the internal L2 feature bitmap after the request is implemented
326 */
327 define bridge_flags_reply
328 {
329   u32 context;
330   i32 retval;
331   u32 resulting_feature_bitmap;
332 };
333
334 /** \brief L2 interface vlan tag rewrite configure request
335     @param client_index - opaque cookie to identify the sender
336     @param context - sender context, to match reply w/ request
337     @param sw_if_index - interface the operation is applied to
338     @param vtr_op - Choose from l2_vtr_op_t enum values
339     @param push_dot1q - first pushed flag dot1q id set, else dot1ad
340     @param tag1 - Needed for any push or translate vtr op
341     @param tag2 - Needed for any push 2 or translate x-2 vtr ops
342 */
343 autoreply define l2_interface_vlan_tag_rewrite
344 {
345   u32 client_index;
346   u32 context;
347   u32 sw_if_index;
348   u32 vtr_op;
349   u32 push_dot1q;               // ethertype of first pushed tag is dot1q/dot1ad
350   u32 tag1;                     // first pushed tag
351   u32 tag2;                     // second pushed tag
352 };
353
354 /** \brief L2 interface pbb tag rewrite configure request
355     @param client_index - opaque cookie to identify the sender
356     @param context - sender context, to match reply w/ request
357     @param sw_if_index - interface the operation is applied to
358     @param vtr_op - Choose from l2_vtr_op_t enum values
359     @param inner_tag - needed for translate_qinq vtr op only
360     @param outer_tag - needed for translate_qinq vtr op only 
361     @param b_dmac - B-tag remote mac address, needed for any push or translate_qinq vtr op
362     @param b_smac - B-tag local mac address, needed for any push or translate qinq vtr op
363     @param b_vlanid - B-tag vlanid, needed for any push or translate qinq vtr op
364     @param i_sid - I-tag service id, needed for any push or translate qinq vtr op
365 */
366 autoreply define l2_interface_pbb_tag_rewrite
367 {
368   u32 client_index;
369   u32 context;
370   u32 sw_if_index;
371   u32 vtr_op;
372   u16 outer_tag;
373   u8  b_dmac[6];
374   u8  b_smac[6];
375   u16 b_vlanid;
376   u32 i_sid;
377 };
378
379 /*
380  * Local Variables:
381  * eval: (c-set-style "gnu")
382  * End:
383  */