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