1 /* Hey Emacs use -*- mode: C -*- */
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:
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 option version = "3.2.3";
19 import "vnet/interface_types.api";
20 import "vnet/ethernet/ethernet_types.api";
21 import "vnet/ip/ip_types.api";
24 rpc want_interface_events returns want_interface_events_reply
25 events sw_interface_event;
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)
35 autoreply define sw_interface_set_flags
39 vl_api_interface_index_t sw_if_index;
40 vl_api_if_status_flags_t flags;
43 /** \brief Set interface promiscuous mode
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 flags on
47 @param promisc_on - promiscuous mode is on ?
49 autoreply define sw_interface_set_promisc
53 vl_api_interface_index_t sw_if_index;
57 /** \brief Set interface physical MTU
58 @param client_index - opaque cookie to identify the sender
59 @param context - sender context, to match reply w/ request
60 @param sw_if_index - index of the interface to set MTU on
63 autoreply define hw_interface_set_mtu
67 vl_api_interface_index_t sw_if_index;
71 /** \brief Set interface L3 MTU */
72 autoreply define sw_interface_set_mtu
76 vl_api_interface_index_t sw_if_index;
77 u32 mtu[4]; /* vl_api_mtu_proto_t 0 - L3, 1 - IP4, 2 - IP6, 3 - MPLS */
80 /** \brief Set IP4 directed broadcast
81 The directed broadcast enabled a packet sent to the interface's
82 subnet address will be broadcast on the interface
86 autoreply define sw_interface_set_ip_directed_broadcast
90 vl_api_interface_index_t sw_if_index;
94 /** \brief Interface Event generated by want_interface_events
95 @param client_index - opaque cookie to identify the sender
96 @param pid - client pid registered to receive notification
97 @param sw_if_index - index of the interface of the event
98 @param flags - interface_status flags
99 @param deleted - interface was deleted
101 define sw_interface_event
105 vl_api_interface_index_t sw_if_index;
106 vl_api_if_status_flags_t flags;
110 /** \brief Register for interface events
111 @param client_index - opaque cookie to identify the sender
112 @param context - sender context, to match reply w/ request
113 @param enable_disable - 1 => register for events, 0 => cancel registration
114 @param pid - sender's pid
116 autoreply define want_interface_events
124 /** \brief Interface details structure (fix this)
125 @param sw_if_index - index of the interface
126 @param sup_sw_if_index - index of parent interface if any, else same as sw_if_index
127 @param l2_address - the interface's l2 address
128 @param flags - interface_status flags
129 @param type - interface type
130 @param link_duplex - 1 if half duplex, 2 if full duplex
131 @param link_speed - value in kbps
132 @param link_MTU - max. transmission unit
133 @param sub_id - A number 0-N to uniquely identify this subif on super if
134 @param sub_number_of_tags - Number of tags (0 - 2)
135 @param sub_outer_vlan_id
136 @param sub_inner_vlan_id
137 @param sub_if_flags - sub interface flags
138 @param vtr_op - vlan tag rewrite operation
139 @param vtr_push_dot1q
142 @param pbb_outer_tag - translate pbb s-tag
143 @param pbb_b_dmac[6] - B-tag remote mac address
144 @param pbb_b_smac[6] - B-tag local mac address
145 @param pbb_b_vlanid - B-tag vlanid
146 @param pbb_i_sid - I-tag service id
147 @param interface_name - name of the interface
148 @param interface_dev_type - device type of the interface
149 @param tag - an ascii tag
151 define sw_interface_details
154 vl_api_interface_index_t sw_if_index;
156 /* index of sup interface (e.g. hw interface).
157 equal to sw_if_index for super hw interface. */
160 /* Layer 2 address, if applicable */
161 vl_api_mac_address_t l2_address;
163 vl_api_if_status_flags_t flags;
165 vl_api_if_type_t type;
167 /* 1 = half duplex, 2 = full duplex */
168 vl_api_link_duplex_t link_duplex;
170 /* link speed in kbps */
176 /* Per protocol MTUs */
177 u32 mtu[4]; /* vl_api_mtu_proto_t 0 - L3, 1 - IP4, 2 - IP6, 3 - MPLS */
179 /* Subinterface ID. A number 0-N to uniquely identify this subinterface under the super interface */
182 /* Number of tags 0-2 */
183 u8 sub_number_of_tags;
184 u16 sub_outer_vlan_id;
185 u16 sub_inner_vlan_id;
187 vl_api_sub_if_flags_t sub_if_flags;
189 /* vlan tag rewrite state */
191 u32 vtr_push_dot1q; // ethertype of first pushed tag is dot1q/dot1ad
192 u32 vtr_tag1; // first pushed tag
193 u32 vtr_tag2; // second pushed tag
195 /* pbb tag rewrite info */
197 vl_api_mac_address_t b_dmac;
198 vl_api_mac_address_t b_smac;
203 string interface_name[64];
204 string interface_dev_type[64];
208 /** \brief Request all or filtered subset of sw_interface_details
209 @param client_index - opaque cookie to identify the sender
210 @param context - sender context, to match reply w/ request
211 @param sw_if_index - index of the interface to dump info on, 0 or ~0 if on all
212 TODO: Support selecting only index==0 when CSIT is ready.
213 @param name_filter_valid - 1 if requesting a filtered subset of records else 0
214 if name filter is set as valid, sw_if_index value is ignored and all interfaces are examined
215 @param name_filter - interface name substring filter. Eg. loop1 returns [loop1, loop10]
217 define sw_interface_dump
221 vl_api_interface_index_t sw_if_index [default=0xFFFFFFFF];
222 bool name_filter_valid;
223 string name_filter[];
226 /** \brief Set or delete one or all ip addresses on a specified interface
227 @param client_index - opaque cookie to identify the sender
228 @param context - sender context, to match reply w/ request
229 @param sw_if_index - index of the interface to add/del addresses
230 @param is_add - add address if non-zero, else delete
231 @param del_all - if non-zero delete all addresses on the interface
232 @param prefix - address + a prefix length for the implied connected route
234 autoreply define sw_interface_add_del_address
238 vl_api_interface_index_t sw_if_index;
242 vl_api_address_with_prefix_t prefix;
245 /** \brief IP interface address replace begin
247 The use-case is that, for some unspecified reason, the control plane
248 has a different set of interface addresses than VPP
249 currently has. The CP would thus like to 'replace' VPP's set
250 only by specifying what the new set shall be, i.e. it is not
251 going to delete anything that already eixts, rather, is wants any
252 unspecified interface addresses to be deleted implicitly.
253 The CP declares the start of this procedure with this replace_begin
254 API Call, and when it has populated all addresses it wants, it calls
255 the below replace_end API. From this point on it is of course free
256 to add and delete interface addresses as usual.
257 The underlying mechanism by which VPP implements this replace is
258 intentionally left unspecified.
260 @param client_index - opaque cookie to identify the sender
261 @param context - sender context, to match reply w/ request
263 autoreply define sw_interface_address_replace_begin
269 /** \brief IP interface address replace end
271 see ip_interface_address_replace_begin description.
273 @param client_index - opaque cookie to identify the sender
274 @param context - sender context, to match reply w/ request
276 autoreply define sw_interface_address_replace_end
282 /** \brief Associate the specified interface with a fib table
283 @param client_index - opaque cookie to identify the sender
284 @param context - sender context, to match reply w/ request
285 @param sw_if_index - index of the interface
286 @param is_ipv6 - if non-zero ipv6, else ipv4
287 @param vrf_id - fib table/vrf id to associate the interface with
289 autoreply define sw_interface_set_table
293 vl_api_interface_index_t sw_if_index;
298 /** \brief Get VRF id assigned to interface
299 @param client_index - opaque cookie to identify the sender
300 @param context - sender context, to match reply w/ request
301 @param sw_if_index - index of the interface
303 define sw_interface_get_table
307 vl_api_interface_index_t sw_if_index;
311 /** \brief Reply to get_sw_interface_vrf
312 @param context - sender context which was passed in the request
313 @param vrf_id - VRF id assigned to the interface
315 define sw_interface_get_table_reply
322 /** \brief Set unnumbered interface add / del request
323 @param client_index - opaque cookie to identify the sender
324 @param context - sender context, to match reply w/ request
325 @param sw_if_index - interface with an IP address
326 @param unnumbered_sw_if_index - interface which will use the address
327 @param is_add - if non-zero set the association, else unset it
329 autoreply define sw_interface_set_unnumbered
333 vl_api_interface_index_t sw_if_index; /* use this intfc address */
334 vl_api_interface_index_t unnumbered_sw_if_index; /* on this interface */
338 /** \brief Clear interface statistics
339 @param client_index - opaque cookie to identify the sender
340 @param context - sender context, to match reply w/ request
341 @param sw_if_index - index of the interface to clear statistics
343 autoreply define sw_interface_clear_stats
347 vl_api_interface_index_t sw_if_index;
350 /** \brief Set / clear software interface tag
351 @param client_index - opaque cookie to identify the sender
352 @param context - sender context, to match reply w/ request
353 @param sw_if_index - the interface
354 @param add_del - 1 = add, 0 = delete
355 @param tag - an ascii tag
357 autoreply define sw_interface_tag_add_del
362 vl_api_interface_index_t sw_if_index;
366 /** \brief Add or delete a secondary MAC address on an interface
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 MAC will be set
370 @param mac_addr - the new MAC address
371 @param is_add - 0 to delete, != 0 to add
373 autoreply define sw_interface_add_del_mac_address
378 vl_api_mac_address_t addr;
382 /** \brief Set an interface's MAC address
383 @param client_index - opaque cookie to identify the sender
384 @param context - sender context, to match reply w/ request
385 @param sw_if_index - the interface whose MAC will be set
386 @param mac_addr - the new MAC address
388 autoreply define sw_interface_set_mac_address
392 vl_api_interface_index_t sw_if_index;
393 vl_api_mac_address_t mac_address;
396 /** \brief Get interface's MAC address
397 @param client_index - opaque cookie to identify the sender
398 @param context - sender context, to match reply w/ request
399 @param sw_if_index - the interface whose MAC will be returned
401 define sw_interface_get_mac_address
405 vl_api_interface_index_t sw_if_index;
408 /** \brief Reply for get interface's MAC address request
409 @param context - returned sender context, to match reply w/ request
410 @param retval - return code
411 @param mac_addr - returned interface's MAC address
413 define sw_interface_get_mac_address_reply
417 vl_api_mac_address_t mac_address;
420 /** \brief Set an interface's rx-mode
421 @param client_index - opaque cookie to identify the sender
422 @param context - sender context, to match reply w/ request
423 @param sw_if_index - the interface whose rx-mode will be set
424 @param queue_id_valid - 1 = the queue_id field is valid. 0 means all
426 @param queue_id - the queue number whose rx-mode will be set. Only valid
427 if queue_id_valid is 1
428 @param mode - polling=1, interrupt=2, adaptive=3
430 autoreply define sw_interface_set_rx_mode
434 vl_api_interface_index_t sw_if_index;
437 vl_api_rx_mode_t mode;
440 /** \brief Set an interface's rx-placement
441 Rx-Queue placement on specific thread is operational for only hardware
442 interface. It will not set queue - thread placement for sub-interfaces,
443 p2p and pipe interfaces.
444 @param client_index - opaque cookie to identify the sender
445 @param context - sender context, to match reply w/ request
446 @param sw_if_index - the interface whose rx-placement will be set
447 @param queue_id - the queue number whose rx-placement will be set.
448 @param worker_id - the worker number whom rx-placement will be at.
449 @param is_main - flag to set rx-placement to main thread
451 autoreply define sw_interface_set_rx_placement
455 vl_api_interface_index_t sw_if_index;
461 /** \brief Set an interface's tx-placement
462 Tx-Queue placement on specific thread is operational for only hardware
463 interface. It will not set queue - thread placement for sub-interfaces,
464 p2p and pipe interfaces.
465 @param client_index - opaque cookie to identify the sender
466 @param context - sender context, to match reply w/ request
467 @param sw_if_index - the interface whose tx-placement will be set
468 @param queue_id - the queue number whose tx-placement will be set.
469 @param array_size - the size of the thread indexes array
470 @param threads - the thread indexes of main and worker(s) threads
471 whom tx-placement will be at.
473 autoendian autoreply define sw_interface_set_tx_placement
477 vl_api_interface_index_t sw_if_index;
480 u32 threads[array_size];
481 option vat_help = "<interface | sw_if_index <index>> queue <n> [threads <list> | mask <hex>]";
484 /** \brief Set custom interface name
485 Set custom interface name for the interface.
486 @param client_index - opaque cookie to identify the sender
487 @param context - sender context, to match reply w/ request
488 @param sw_if_index - the interface whose name will be set
489 @param name - the custom interface name to be set
492 autoreply define sw_interface_set_interface_name
496 vl_api_interface_index_t sw_if_index;
500 /** \brief dump the rx queue placement of interface(s)
501 @param sw_if_index - optional interface index for which queue placement to
502 be requested. sw_if_index = ~0 will dump placement information for all
503 interfaces. It will not dump information related to sub-interfaces, p2p
506 define sw_interface_rx_placement_dump
510 vl_api_interface_index_t sw_if_index;
513 /** \brief show the interface's queue - thread placement
514 This api is used to display the interface and queue worker
515 thread placement. One message per rx-queue per interface will
517 Each message will contain information about rx-queue id of an
518 interface, interface index, thread on which this rx-queue is
519 placed and mode of rx-queue.
520 @param client_index - opaque cookie to identify the sender
521 @param context - sender context, to match reply w/ request
522 @param sw_if_index - the interface whose rx-placement will be dumped
523 @param queue_id - the queue id
524 @param worker_id - the worker id on which queue_id is placed,
525 worker_id = 0 means main thread.
526 @param mode - polling=1, interrupt=2, adaptive=3
528 define sw_interface_rx_placement_details
532 vl_api_interface_index_t sw_if_index;
535 vl_api_rx_mode_t mode;
539 rpc sw_interface_tx_placement_get returns sw_interface_tx_placement_get_reply
540 stream sw_interface_tx_placement_details;
543 /** \brief get the tx queue placement of interface(s)
544 @param cursor - optional, it allows client to continue a dump
545 @param sw_if_index - optional interface index for which queue placement to
546 be requested. sw_if_index = ~0 will get the placement information for all
547 interfaces. It will not get information related to sub-interfaces, p2p
550 autoendian define sw_interface_tx_placement_get
555 vl_api_interface_index_t sw_if_index;
556 option vat_help = "[interface | sw_if_index <index>]";
559 autoendian define sw_interface_tx_placement_get_reply
566 /** \brief show the interface's queue - thread placement
567 This api is used to display the interface and queue worker
568 thread placement. One message per tx-queue per interface will
570 Each message will contain information about tx-queue id of an
571 interface, interface index, thread on which this tx-queue is
572 placed and mode of tx-queue.
573 @param client_index - opaque cookie to identify the sender
574 @param context - sender context, to match reply w/ request
575 @param sw_if_index - the interface whose tx-placement will be dumped
576 @param queue_id - the queue id
577 @param shared - the queue is shared on other threads
578 @param array_size - the size of the threads array
579 @param threads - the main and worker(s) thread index(es) whom tx-placement are at.
581 autoendian define sw_interface_tx_placement_details
585 vl_api_interface_index_t sw_if_index;
589 u32 threads[array_size];
592 /* Gross kludge, DGMS */
593 autoreply define interface_name_renumber
597 vl_api_interface_index_t sw_if_index;
598 u32 new_show_dev_instance;
605 vl_api_interface_index_t sw_if_index;
608 vl_api_sub_if_flags_t sub_if_flags;
613 define create_subif_reply
617 vl_api_interface_index_t sw_if_index;
620 /** \brief Create a new subinterface with the given vlan id
621 @param client_index - opaque cookie to identify the sender
622 @param context - sender context, to match reply w/ request
623 @param sw_if_index - software index of the new vlan's parent interface
624 @param vlan_id - vlan tag of the new interface
626 define create_vlan_subif
630 vl_api_interface_index_t sw_if_index;
634 /** \brief Reply for the vlan subinterface create request
635 @param context - returned sender context, to match reply w/ request
636 @param retval - return code
637 @param sw_if_index - software index allocated for the new subinterface
639 define create_vlan_subif_reply
643 vl_api_interface_index_t sw_if_index;
646 /** \brief Delete sub interface request
647 @param client_index - opaque cookie to identify the sender
648 @param context - sender context, to match reply w/ request
649 @param sw_if_index - sw index of the interface that was created by create_subif
651 autoreply define delete_subif {
654 vl_api_interface_index_t sw_if_index;
657 /** \brief Create loopback interface request
658 @param client_index - opaque cookie to identify the sender
659 @param context - sender context, to match reply w/ request
660 @param mac_address - mac addr to assign to the interface if none-zero
662 define create_loopback
666 vl_api_mac_address_t mac_address;
669 /** \brief Create loopback interface response
670 @param context - sender context, to match reply w/ request
671 @param sw_if_index - sw index of the interface that was created
672 @param retval - return code for the request
674 define create_loopback_reply
678 vl_api_interface_index_t sw_if_index;
681 /** \brief Create loopback interface instance request
682 @param client_index - opaque cookie to identify the sender
683 @param context - sender context, to match reply w/ request
684 @param mac_address - mac addr to assign to the interface if none-zero
685 @param is_specified - if non-0, a specific user_instance is being requested
686 @param user_instance - requested instance, ~0 => dynamically allocate
688 define create_loopback_instance
692 vl_api_mac_address_t mac_address;
697 /** \brief Create loopback interface instance response
698 @param context - sender context, to match reply w/ request
699 @param sw_if_index - sw index of the interface that was created
700 @param retval - return code for the request
702 define create_loopback_instance_reply
706 vl_api_interface_index_t sw_if_index;
709 /** \brief Delete loopback interface request
710 @param client_index - opaque cookie to identify the sender
711 @param context - sender context, to match reply w/ request
712 @param sw_if_index - sw index of the interface that was created
714 autoreply define delete_loopback
718 vl_api_interface_index_t sw_if_index;
721 /** \brief Enable or disable detailed interface stats
722 @param client_index - opaque cookie to identify the sender
723 @param context - sender context, to match reply w/ request
724 @param sw_if_index - The interface to collect detail stats on. ~0 implies
726 @param enable_disable - set to 1 to enable, 0 to disable detailed stats
728 autoreply define collect_detailed_interface_stats
732 vl_api_interface_index_t sw_if_index;
738 * eval: (c-set-style "gnu")