interface: callback to manage extra MAC addresses
[vpp.git] / src / vnet / interface.api
1 /* Hey Emacs use -*- mode: C -*- */
2 /*
3  * Copyright (c) 2018 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.2.0";
18
19 import "vnet/interface_types.api";
20 import "vnet/ethernet/ethernet_types.api";
21 import "vnet/ip/ip_types.api";
22
23 service {
24   rpc want_interface_events returns want_interface_events_reply
25     events sw_interface_event;
26 };
27
28 /** \brief Set flags on the interface
29     @param client_index - opaque cookie to identify the sender
30     @param context - sender context, to match reply w/ request
31     @param sw_if_index - index of the interface to set flags on
32     @param flags - interface_status flags
33         (only IF_STATUS_API_FLAG_ADMIN_UP used in config)
34 */
35 autoreply define sw_interface_set_flags
36 {
37   u32 client_index;
38   u32 context;
39   vl_api_interface_index_t sw_if_index;
40   vl_api_if_status_flags_t flags;
41 };
42
43 /** \brief Set interface physical MTU
44     @param client_index - opaque cookie to identify the sender
45     @param context - sender context, to match reply w/ request
46     @param sw_if_index - index of the interface to set MTU on
47     @param mtu - MTU
48 */
49 autoreply define hw_interface_set_mtu
50 {
51   u32 client_index;
52   u32 context;
53   vl_api_interface_index_t sw_if_index;
54   u16 mtu;
55 };
56
57 /** \brief Set interface L3 MTU */
58 autoreply define sw_interface_set_mtu
59 {
60   u32 client_index;
61   u32 context;
62   vl_api_interface_index_t sw_if_index;
63   u32 mtu[4]; /* vl_api_mtu_proto_t 0 - L3, 1 - IP4, 2 - IP6, 3 - MPLS */
64 };
65
66 /** \brief Set IP4 directed broadcast
67     The directed broadcast enabled a packet sent to the interface's
68     subnet address will be broadcast on the interface
69     @param sw_if_index
70     @param enable
71 */
72 autoreply define sw_interface_set_ip_directed_broadcast
73 {
74   u32 client_index;
75   u32 context;
76   vl_api_interface_index_t sw_if_index;
77   bool  enable;
78 };
79
80 /** \brief Interface Event generated by want_interface_events
81     @param client_index - opaque cookie to identify the sender
82     @param pid - client pid registered to receive notification
83     @param sw_if_index - index of the interface of the event
84     @param flags - interface_status flags
85     @param deleted - interface was deleted
86 */
87 define sw_interface_event
88 {
89   u32 client_index;
90   u32 pid;
91   vl_api_interface_index_t sw_if_index;
92   vl_api_if_status_flags_t flags;
93   bool deleted;
94 };
95
96 /** \brief Register for interface events
97     @param client_index - opaque cookie to identify the sender
98     @param context - sender context, to match reply w/ request
99     @param enable_disable - 1 => register for events, 0 => cancel registration
100     @param pid - sender's pid
101 */
102 autoreply define want_interface_events
103 {
104   u32 client_index;
105   u32 context;
106   u32 enable_disable;
107   u32 pid;
108 };
109
110 /** \brief Interface details structure (fix this)
111     @param sw_if_index - index of the interface
112     @param sup_sw_if_index - index of parent interface if any, else same as sw_if_index
113     @param l2_address - the interface's l2 address
114     @param flags - interface_status flags
115     @param type - interface type
116     @param link_duplex - 1 if half duplex, 2 if full duplex
117     @param link_speed - value in kbps
118     @param link_MTU - max. transmission unit
119     @param sub_id - A number 0-N to uniquely identify this subif on super if
120     @param sub_number_of_tags - Number of tags (0 - 2)
121     @param sub_outer_vlan_id
122     @param sub_inner_vlan_id
123     @param sub_if_flags - sub interface flags
124     @param vtr_op - vlan tag rewrite operation
125     @param vtr_push_dot1q
126     @param vtr_tag1
127     @param vtr_tag2
128     @param pbb_outer_tag - translate pbb s-tag
129     @param pbb_b_dmac[6] - B-tag remote mac address
130     @param pbb_b_smac[6] - B-tag local mac address
131     @param pbb_b_vlanid - B-tag vlanid
132     @param pbb_i_sid - I-tag service id
133     @param interface_name - name of the interface
134     @param tag - an ascii tag
135 */
136 define sw_interface_details
137 {
138   u32 context;
139   vl_api_interface_index_t sw_if_index;
140
141   /* index of sup interface (e.g. hw interface).
142      equal to sw_if_index for super hw interface. */
143   u32 sup_sw_if_index;
144
145   /* Layer 2 address, if applicable */
146   vl_api_mac_address_t l2_address;
147
148   vl_api_if_status_flags_t flags;
149
150   vl_api_if_type_t type;
151
152   /* 1 = half duplex, 2 = full duplex */
153   vl_api_link_duplex_t link_duplex;
154
155   /* link speed in kbps */
156   u32 link_speed;
157
158   /* MTU */
159   u16 link_mtu;
160
161   /* Per protocol MTUs */
162   u32 mtu[4]; /* vl_api_mtu_proto_t 0 - L3, 1 - IP4, 2 - IP6, 3 - MPLS */
163
164   /* Subinterface ID. A number 0-N to uniquely identify this subinterface under the super interface */
165   u32 sub_id;
166
167   /* Number of tags 0-2 */
168   u8 sub_number_of_tags;
169   u16 sub_outer_vlan_id;
170   u16 sub_inner_vlan_id;
171
172   vl_api_sub_if_flags_t sub_if_flags;
173
174   /* vlan tag rewrite state */
175   u32 vtr_op;
176   u32 vtr_push_dot1q;           // ethertype of first pushed tag is dot1q/dot1ad
177   u32 vtr_tag1;                 // first pushed tag
178   u32 vtr_tag2;                 // second pushed tag
179
180   /* pbb tag rewrite info */
181   u16 outer_tag;
182   vl_api_mac_address_t  b_dmac;
183   vl_api_mac_address_t  b_smac;
184   u16 b_vlanid;
185   u32 i_sid;
186
187   /* Interface name */
188   string interface_name[64];
189   string tag[64];
190 };
191
192 /** \brief Request all or filtered subset of sw_interface_details
193     @param client_index - opaque cookie to identify the sender
194     @param context - sender context, to match reply w/ request
195     @param sw_if_index - index of the interface to dump info on, 0 or ~0 if on all
196       TODO: Support selecting only index==0 when CSIT is ready.
197     @param name_filter_valid - 1 if requesting a filtered subset of records else 0
198       if name filter is set as valid, sw_if_index value is ignored and all interfaces are examined
199     @param name_filter - interface name substring filter. Eg. loop1 returns [loop1, loop10]
200 */
201 define sw_interface_dump
202 {
203   u32 client_index;
204   u32 context;
205   vl_api_interface_index_t sw_if_index;
206   bool name_filter_valid;
207   string name_filter[];
208 };
209
210 /** \brief Set or delete one or all ip addresses on a specified interface
211     @param client_index - opaque cookie to identify the sender
212     @param context - sender context, to match reply w/ request
213     @param sw_if_index - index of the interface to add/del addresses
214     @param is_add - add address if non-zero, else delete
215     @param del_all - if non-zero delete all addresses on the interface
216     @param prefix - address + a prefix length for the implied connected route
217 */
218 autoreply define sw_interface_add_del_address
219 {
220   u32 client_index;
221   u32 context;
222   vl_api_interface_index_t sw_if_index;
223   bool is_add;
224
225   bool del_all;
226   vl_api_address_with_prefix_t prefix;
227 };
228
229 /** \brief Associate the specified interface with a fib table
230     @param client_index - opaque cookie to identify the sender
231     @param context - sender context, to match reply w/ request
232     @param sw_if_index - index of the interface
233     @param is_ipv6 - if non-zero ipv6, else ipv4
234     @param vrf_id - fib table/vrf id to associate the interface with
235 */
236 autoreply define sw_interface_set_table
237 {
238   u32 client_index;
239   u32 context;
240   vl_api_interface_index_t sw_if_index;
241   bool is_ipv6;
242   u32 vrf_id;
243 };
244
245 /** \brief Get VRF id assigned to interface
246     @param client_index - opaque cookie to identify the sender
247     @param context - sender context, to match reply w/ request
248     @param sw_if_index - index of the interface
249 */
250 define sw_interface_get_table
251 {
252   u32 client_index;
253   u32 context;
254   vl_api_interface_index_t sw_if_index;
255   bool is_ipv6;
256 };
257
258 /** \brief Reply to get_sw_interface_vrf
259     @param context - sender context which was passed in the request
260     @param vrf_id - VRF id assigned to the interface
261 */
262 define sw_interface_get_table_reply
263 {
264   u32 context;
265   i32 retval;
266   u32 vrf_id;
267 };
268
269 /** \brief Set unnumbered interface add / del request
270     @param client_index - opaque cookie to identify the sender
271     @param context - sender context, to match reply w/ request
272     @param sw_if_index - interface with an IP address
273     @param unnumbered_sw_if_index - interface which will use the address
274     @param is_add - if non-zero set the association, else unset it
275 */
276 autoreply define sw_interface_set_unnumbered
277 {
278   u32 client_index;
279   u32 context;
280   vl_api_interface_index_t sw_if_index;         /* use this intfc address */
281   vl_api_interface_index_t unnumbered_sw_if_index;      /* on this interface */
282   bool is_add;
283 };
284
285 /** \brief Clear interface statistics
286     @param client_index - opaque cookie to identify the sender
287     @param context - sender context, to match reply w/ request
288     @param sw_if_index - index of the interface to clear statistics
289 */
290 autoreply define sw_interface_clear_stats
291 {
292   u32 client_index;
293   u32 context;
294   vl_api_interface_index_t sw_if_index;
295 };
296
297 /** \brief Set / clear software interface tag
298     @param client_index - opaque cookie to identify the sender
299     @param context - sender context, to match reply w/ request
300     @param sw_if_index - the interface
301     @param add_del - 1 = add, 0 = delete
302     @param tag - an ascii tag
303 */
304 autoreply define sw_interface_tag_add_del
305 {
306   u32 client_index;
307   u32 context;
308   bool is_add;
309   vl_api_interface_index_t sw_if_index;
310   string tag[64];
311 };
312
313 /** \brief Add or delete a secondary MAC address on an interface
314     @param client_index - opaque cookie to identify the sender
315     @param context - sender context, to match reply w/ request
316     @param sw_if_index - the interface whose MAC will be set
317     @param mac_addr - the new MAC address
318     @param is_add - 0 to delete, != 0 to add
319 */
320 autoreply define sw_interface_add_del_mac_address
321 {
322     u32 client_index;
323     u32 context;
324     u32 sw_if_index;
325     vl_api_mac_address_t addr;
326     u8 is_add;
327 };
328
329 /** \brief Set an interface's MAC address
330     @param client_index - opaque cookie to identify the sender
331     @param context - sender context, to match reply w/ request
332     @param sw_if_index - the interface whose MAC will be set
333     @param mac_addr - the new MAC address
334 */
335 autoreply define sw_interface_set_mac_address
336 {
337   u32 client_index;
338   u32 context;
339   vl_api_interface_index_t sw_if_index;
340   vl_api_mac_address_t mac_address;
341 };
342
343 /** \brief Get interface's MAC address
344     @param client_index - opaque cookie to identify the sender
345     @param context - sender context, to match reply w/ request
346     @param sw_if_index - the interface whose MAC will be returned
347 */
348 define sw_interface_get_mac_address
349 {
350   u32 client_index;
351   u32 context;
352   vl_api_interface_index_t sw_if_index;
353 };
354
355 /** \brief Reply for get interface's MAC address request
356     @param context - returned sender context, to match reply w/ request
357     @param retval - return code
358     @param mac_addr - returned interface's MAC address
359 */
360 define sw_interface_get_mac_address_reply
361 {
362   u32 context;
363   i32 retval;
364   vl_api_mac_address_t mac_address;
365 };
366
367 /** \brief Set an interface's rx-mode
368     @param client_index - opaque cookie to identify the sender
369     @param context - sender context, to match reply w/ request
370     @param sw_if_index - the interface whose rx-mode will be set
371     @param queue_id_valid - 1 = the queue_id field is valid. 0 means all
372       queue_id's
373     @param queue_id - the queue number whose rx-mode will be set. Only valid
374       if queue_id_valid is 1
375     @param mode - polling=1, interrupt=2, adaptive=3
376 */
377 autoreply define sw_interface_set_rx_mode
378 {
379   u32 client_index;
380   u32 context;
381   vl_api_interface_index_t sw_if_index;
382   bool queue_id_valid;
383   u32 queue_id;
384   vl_api_rx_mode_t mode;
385 };
386
387 /** \brief Set an interface's rx-placement
388     Rx-Queue placement on specific thread is operational for only hardware
389     interface. It will not set queue - thread placement for sub-interfaces,
390     p2p and pipe interfaces.
391     @param client_index - opaque cookie to identify the sender
392     @param context - sender context, to match reply w/ request
393     @param sw_if_index - the interface whose rx-placement will be set
394     @param queue_id - the queue number whose rx-placement will be set.
395     @param worker_id - the worker number whom rx-placement will be at.
396     @param is_main - flag to set rx-placement to main thread
397 */
398 autoreply define sw_interface_set_rx_placement
399 {
400     u32 client_index;
401     u32 context;
402     vl_api_interface_index_t sw_if_index;
403     u32 queue_id;
404     u32 worker_id;
405     bool is_main;
406 };
407
408 /** \brief dump the rx queue placement of interface(s)
409     @param sw_if_index - optional interface index for which queue placement to
410       be requested. sw_if_index = ~0 will dump placement information for all
411       interfaces. It will not dump information related to sub-interfaces, p2p
412       and pipe interfaces.
413 */
414 define sw_interface_rx_placement_dump
415 {
416   u32 client_index;
417   u32 context;
418   vl_api_interface_index_t sw_if_index;
419 };
420
421 /** \brief show the interface's queue - thread placement
422     This api is used to display the interface and queue worker
423     thread placement. One message per rx-queue per interface will
424     be sent to client.
425     Each message will contain information about rx-queue id of an
426     interface, interface index, thread on which this rx-queue is
427     placed and mode of rx-queue.
428     @param client_index - opaque cookie to identify the sender
429     @param context - sender context, to match reply w/ request
430     @param sw_if_index - the interface whose rx-placement will be dumped
431     @param queue_id - the queue id
432     @param worker_id - the worker id on which queue_id is placed,
433                        worker_id = 0 means main thread.
434     @param mode - polling=1, interrupt=2, adaptive=3
435 */
436 define sw_interface_rx_placement_details
437 {
438   u32 client_index;
439   u32 context;
440   vl_api_interface_index_t sw_if_index;
441   u32 queue_id;
442   u32 worker_id;
443   vl_api_rx_mode_t mode;
444 };
445
446 /* Gross kludge, DGMS */
447 autoreply define interface_name_renumber
448 {
449   u32 client_index;
450   u32 context;
451   vl_api_interface_index_t sw_if_index;
452   u32 new_show_dev_instance;
453 };
454
455 define create_subif
456 {
457   u32 client_index;
458   u32 context;
459   vl_api_interface_index_t sw_if_index;
460   u32 sub_id;
461
462   vl_api_sub_if_flags_t sub_if_flags;
463   u16 outer_vlan_id;
464   u16 inner_vlan_id;
465 };
466
467 define create_subif_reply
468 {
469   u32 context;
470   i32 retval;
471   vl_api_interface_index_t sw_if_index;
472 };
473
474 /** \brief Create a new subinterface with the given vlan id
475     @param client_index - opaque cookie to identify the sender
476     @param context - sender context, to match reply w/ request
477     @param sw_if_index - software index of the new vlan's parent interface
478     @param vlan_id - vlan tag of the new interface
479 */
480 define create_vlan_subif
481 {
482   u32 client_index;
483   u32 context;
484   vl_api_interface_index_t sw_if_index;
485   u32 vlan_id;
486 };
487
488 /** \brief Reply for the vlan subinterface create request
489     @param context - returned sender context, to match reply w/ request
490     @param retval - return code
491     @param sw_if_index - software index allocated for the new subinterface
492 */
493 define create_vlan_subif_reply
494 {
495   u32 context;
496   i32 retval;
497   vl_api_interface_index_t sw_if_index;
498 };
499
500 /** \brief Delete sub interface request
501     @param client_index - opaque cookie to identify the sender
502     @param context - sender context, to match reply w/ request
503     @param sw_if_index - sw index of the interface that was created by create_subif
504 */
505 autoreply define delete_subif {
506   u32 client_index;
507   u32 context;
508   vl_api_interface_index_t sw_if_index;
509 };
510
511 /** \brief Create loopback interface request
512     @param client_index - opaque cookie to identify the sender
513     @param context - sender context, to match reply w/ request
514     @param mac_address - mac addr to assign to the interface if none-zero
515 */
516 define create_loopback
517 {
518   u32 client_index;
519   u32 context;
520   vl_api_mac_address_t mac_address;
521 };
522
523 /** \brief Create loopback interface response
524     @param context - sender context, to match reply w/ request
525     @param sw_if_index - sw index of the interface that was created
526     @param retval - return code for the request
527 */
528 define create_loopback_reply
529 {
530   u32 context;
531   i32 retval;
532   vl_api_interface_index_t sw_if_index;
533 };
534
535 /** \brief Create loopback interface instance request
536     @param client_index - opaque cookie to identify the sender
537     @param context - sender context, to match reply w/ request
538     @param mac_address - mac addr to assign to the interface if none-zero
539     @param is_specified - if non-0, a specific user_instance is being requested
540     @param user_instance - requested instance, ~0 => dynamically allocate
541 */
542 define create_loopback_instance
543 {
544   u32 client_index;
545   u32 context;
546   vl_api_mac_address_t mac_address;
547   bool is_specified;
548   u32 user_instance;
549 };
550
551 /** \brief Create loopback interface instance response
552     @param context - sender context, to match reply w/ request
553     @param sw_if_index - sw index of the interface that was created
554     @param retval - return code for the request
555 */
556 define create_loopback_instance_reply
557 {
558   u32 context;
559   i32 retval;
560   vl_api_interface_index_t sw_if_index;
561 };
562
563 /** \brief Delete loopback interface request
564     @param client_index - opaque cookie to identify the sender
565     @param context - sender context, to match reply w/ request
566     @param sw_if_index - sw index of the interface that was created
567 */
568 autoreply define delete_loopback
569 {
570   u32 client_index;
571   u32 context;
572   vl_api_interface_index_t sw_if_index;
573 };
574
575 /** \brief Enable or disable detailed interface stats
576     @param client_index - opaque cookie to identify the sender
577     @param context - sender context, to match reply w/ request
578     @param sw_if_index - The interface to collect detail stats on. ~0 implies
579                          all interfaces.
580     @param enable_disable - set to 1 to enable, 0 to disable detailed stats
581 */
582 autoreply define collect_detailed_interface_stats
583 {
584   u32 client_index;
585   u32 context;
586   vl_api_interface_index_t sw_if_index;
587   bool  enable_disable;
588 };
589
590 /*
591  * Local Variables:
592  * eval: (c-set-style "gnu")
593  * End:
594  */