FD.io VPP  v20.09-64-g4f7b92f0a
Vector Packet Processing
interface.api
Go to the documentation of this file.
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.2";
18 
19 import "vnet/interface_types.api";
20 import "vnet/ethernet/ethernet_types.api";
21 import "vnet/ip/ip_types.api";
22 
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 {
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 {
53  vl_api_interface_index_t sw_if_index;
55 };
56 
57 /** \brief Set interface L3 MTU */
58 autoreply define sw_interface_set_mtu
59 {
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 {
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 {
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 {
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 interface_dev_type - device type of the interface
135  @param tag - an ascii tag
136 */
137 define sw_interface_details
138 {
140  vl_api_interface_index_t sw_if_index;
141 
142  /* index of sup interface (e.g. hw interface).
143  equal to sw_if_index for super hw interface. */
145 
146  /* Layer 2 address, if applicable */
147  vl_api_mac_address_t l2_address;
148 
149  vl_api_if_status_flags_t flags;
150 
151  vl_api_if_type_t type;
152 
153  /* 1 = half duplex, 2 = full duplex */
154  vl_api_link_duplex_t link_duplex;
155 
156  /* link speed in kbps */
158 
159  /* MTU */
161 
162  /* Per protocol MTUs */
163  u32 mtu[4]; /* vl_api_mtu_proto_t 0 - L3, 1 - IP4, 2 - IP6, 3 - MPLS */
164 
165  /* Subinterface ID. A number 0-N to uniquely identify this subinterface under the super interface */
167 
168  /* Number of tags 0-2 */
172 
173  vl_api_sub_if_flags_t sub_if_flags;
174 
175  /* vlan tag rewrite state */
177  u32 vtr_push_dot1q; // ethertype of first pushed tag is dot1q/dot1ad
178  u32 vtr_tag1; // first pushed tag
179  u32 vtr_tag2; // second pushed tag
180 
181  /* pbb tag rewrite info */
183  vl_api_mac_address_t b_dmac;
184  vl_api_mac_address_t b_smac;
187 
188  /* Interface name */
189  string interface_name[64];
190  string interface_dev_type[64];
191  string tag[64];
192 };
193 
194 /** \brief Request all or filtered subset of sw_interface_details
195  @param client_index - opaque cookie to identify the sender
196  @param context - sender context, to match reply w/ request
197  @param sw_if_index - index of the interface to dump info on, 0 or ~0 if on all
198  TODO: Support selecting only index==0 when CSIT is ready.
199  @param name_filter_valid - 1 if requesting a filtered subset of records else 0
200  if name filter is set as valid, sw_if_index value is ignored and all interfaces are examined
201  @param name_filter - interface name substring filter. Eg. loop1 returns [loop1, loop10]
202 */
203 define sw_interface_dump
204 {
207  vl_api_interface_index_t sw_if_index [default=0xFFFFFFFF];
209  string name_filter[];
210 };
211 
212 /** \brief Set or delete one or all ip addresses on a specified interface
213  @param client_index - opaque cookie to identify the sender
214  @param context - sender context, to match reply w/ request
215  @param sw_if_index - index of the interface to add/del addresses
216  @param is_add - add address if non-zero, else delete
217  @param del_all - if non-zero delete all addresses on the interface
218  @param prefix - address + a prefix length for the implied connected route
219 */
220 autoreply define sw_interface_add_del_address
221 {
224  vl_api_interface_index_t sw_if_index;
225  bool is_add;
226 
227  bool del_all;
228  vl_api_address_with_prefix_t prefix;
229 };
230 
231 /** \brief IP interface address replace begin
232 
233  The use-case is that, for some unspecified reason, the control plane
234  has a different set of interface addresses than VPP
235  currently has. The CP would thus like to 'replace' VPP's set
236  only by specifying what the new set shall be, i.e. it is not
237  going to delete anything that already eixts, rather, is wants any
238  unspecified interface addresses to be deleted implicitly.
239  The CP declares the start of this procedure with this replace_begin
240  API Call, and when it has populated all addresses it wants, it calls
241  the below replace_end API. From this point on it is of course free
242  to add and delete interface addresses as usual.
243  The underlying mechanism by which VPP implements this replace is
244  intentionally left unspecified.
245 
246  @param client_index - opaque cookie to identify the sender
247  @param context - sender context, to match reply w/ request
248 */
249 autoreply define sw_interface_address_replace_begin
250 {
253 };
254 
255 /** \brief IP interface address replace end
256 
257  see ip_interface_address_replace_begin description.
258 
259  @param client_index - opaque cookie to identify the sender
260  @param context - sender context, to match reply w/ request
261 */
262 autoreply define sw_interface_address_replace_end
263 {
266 };
267 
268 /** \brief Associate the specified interface with a fib table
269  @param client_index - opaque cookie to identify the sender
270  @param context - sender context, to match reply w/ request
271  @param sw_if_index - index of the interface
272  @param is_ipv6 - if non-zero ipv6, else ipv4
273  @param vrf_id - fib table/vrf id to associate the interface with
274 */
275 autoreply define sw_interface_set_table
276 {
279  vl_api_interface_index_t sw_if_index;
280  bool is_ipv6;
282 };
283 
284 /** \brief Get VRF id assigned to interface
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 - index of the interface
288 */
289 define sw_interface_get_table
290 {
293  vl_api_interface_index_t sw_if_index;
294  bool is_ipv6;
295 };
296 
297 /** \brief Reply to get_sw_interface_vrf
298  @param context - sender context which was passed in the request
299  @param vrf_id - VRF id assigned to the interface
300 */
301 define sw_interface_get_table_reply
302 {
306 };
307 
308 /** \brief Set unnumbered interface add / del request
309  @param client_index - opaque cookie to identify the sender
310  @param context - sender context, to match reply w/ request
311  @param sw_if_index - interface with an IP address
312  @param unnumbered_sw_if_index - interface which will use the address
313  @param is_add - if non-zero set the association, else unset it
314 */
315 autoreply define sw_interface_set_unnumbered
316 {
319  vl_api_interface_index_t sw_if_index; /* use this intfc address */
320  vl_api_interface_index_t unnumbered_sw_if_index; /* on this interface */
321  bool is_add;
322 };
323 
324 /** \brief Clear interface statistics
325  @param client_index - opaque cookie to identify the sender
326  @param context - sender context, to match reply w/ request
327  @param sw_if_index - index of the interface to clear statistics
328 */
329 autoreply define sw_interface_clear_stats
330 {
333  vl_api_interface_index_t sw_if_index;
334 };
335 
336 /** \brief Set / clear software interface tag
337  @param client_index - opaque cookie to identify the sender
338  @param context - sender context, to match reply w/ request
339  @param sw_if_index - the interface
340  @param add_del - 1 = add, 0 = delete
341  @param tag - an ascii tag
342 */
343 autoreply define sw_interface_tag_add_del
344 {
347  bool is_add;
348  vl_api_interface_index_t sw_if_index;
349  string tag[64];
350 };
351 
352 /** \brief Add or delete a secondary MAC address on an interface
353  @param client_index - opaque cookie to identify the sender
354  @param context - sender context, to match reply w/ request
355  @param sw_if_index - the interface whose MAC will be set
356  @param mac_addr - the new MAC address
357  @param is_add - 0 to delete, != 0 to add
358 */
359 autoreply define sw_interface_add_del_mac_address
360 {
364  vl_api_mac_address_t addr;
366 };
367 
368 /** \brief Set an interface's MAC address
369  @param client_index - opaque cookie to identify the sender
370  @param context - sender context, to match reply w/ request
371  @param sw_if_index - the interface whose MAC will be set
372  @param mac_addr - the new MAC address
373 */
374 autoreply define sw_interface_set_mac_address
375 {
378  vl_api_interface_index_t sw_if_index;
379  vl_api_mac_address_t mac_address;
380 };
381 
382 /** \brief Get 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 returned
386 */
387 define sw_interface_get_mac_address
388 {
391  vl_api_interface_index_t sw_if_index;
392 };
393 
394 /** \brief Reply for get interface's MAC address request
395  @param context - returned sender context, to match reply w/ request
396  @param retval - return code
397  @param mac_addr - returned interface's MAC address
398 */
399 define sw_interface_get_mac_address_reply
400 {
403  vl_api_mac_address_t mac_address;
404 };
405 
406 /** \brief Set an interface's rx-mode
407  @param client_index - opaque cookie to identify the sender
408  @param context - sender context, to match reply w/ request
409  @param sw_if_index - the interface whose rx-mode will be set
410  @param queue_id_valid - 1 = the queue_id field is valid. 0 means all
411  queue_id's
412  @param queue_id - the queue number whose rx-mode will be set. Only valid
413  if queue_id_valid is 1
414  @param mode - polling=1, interrupt=2, adaptive=3
415 */
416 autoreply define sw_interface_set_rx_mode
417 {
420  vl_api_interface_index_t sw_if_index;
423  vl_api_rx_mode_t mode;
424 };
425 
426 /** \brief Set an interface's rx-placement
427  Rx-Queue placement on specific thread is operational for only hardware
428  interface. It will not set queue - thread placement for sub-interfaces,
429  p2p and pipe interfaces.
430  @param client_index - opaque cookie to identify the sender
431  @param context - sender context, to match reply w/ request
432  @param sw_if_index - the interface whose rx-placement will be set
433  @param queue_id - the queue number whose rx-placement will be set.
434  @param worker_id - the worker number whom rx-placement will be at.
435  @param is_main - flag to set rx-placement to main thread
436 */
437 autoreply define sw_interface_set_rx_placement
438 {
441  vl_api_interface_index_t sw_if_index;
444  bool is_main;
445 };
446 
447 /** \brief dump the rx queue placement of interface(s)
448  @param sw_if_index - optional interface index for which queue placement to
449  be requested. sw_if_index = ~0 will dump placement information for all
450  interfaces. It will not dump information related to sub-interfaces, p2p
451  and pipe interfaces.
452 */
453 define sw_interface_rx_placement_dump
454 {
457  vl_api_interface_index_t sw_if_index;
458 };
459 
460 /** \brief show the interface's queue - thread placement
461  This api is used to display the interface and queue worker
462  thread placement. One message per rx-queue per interface will
463  be sent to client.
464  Each message will contain information about rx-queue id of an
465  interface, interface index, thread on which this rx-queue is
466  placed and mode of rx-queue.
467  @param client_index - opaque cookie to identify the sender
468  @param context - sender context, to match reply w/ request
469  @param sw_if_index - the interface whose rx-placement will be dumped
470  @param queue_id - the queue id
471  @param worker_id - the worker id on which queue_id is placed,
472  worker_id = 0 means main thread.
473  @param mode - polling=1, interrupt=2, adaptive=3
474 */
475 define sw_interface_rx_placement_details
476 {
479  vl_api_interface_index_t sw_if_index;
482  vl_api_rx_mode_t mode;
483 };
484 
485 /* Gross kludge, DGMS */
486 autoreply define interface_name_renumber
487 {
490  vl_api_interface_index_t sw_if_index;
492 };
493 
494 define create_subif
495 {
498  vl_api_interface_index_t sw_if_index;
500 
501  vl_api_sub_if_flags_t sub_if_flags;
504 };
505 
506 define create_subif_reply
507 {
510  vl_api_interface_index_t sw_if_index;
511 };
512 
513 /** \brief Create a new subinterface with the given vlan id
514  @param client_index - opaque cookie to identify the sender
515  @param context - sender context, to match reply w/ request
516  @param sw_if_index - software index of the new vlan's parent interface
517  @param vlan_id - vlan tag of the new interface
518 */
519 define create_vlan_subif
520 {
523  vl_api_interface_index_t sw_if_index;
525 };
526 
527 /** \brief Reply for the vlan subinterface create request
528  @param context - returned sender context, to match reply w/ request
529  @param retval - return code
530  @param sw_if_index - software index allocated for the new subinterface
531 */
532 define create_vlan_subif_reply
533 {
536  vl_api_interface_index_t sw_if_index;
537 };
538 
539 /** \brief Delete sub interface request
540  @param client_index - opaque cookie to identify the sender
541  @param context - sender context, to match reply w/ request
542  @param sw_if_index - sw index of the interface that was created by create_subif
543 */
544 autoreply define delete_subif {
547  vl_api_interface_index_t sw_if_index;
548 };
549 
550 /** \brief Create loopback interface request
551  @param client_index - opaque cookie to identify the sender
552  @param context - sender context, to match reply w/ request
553  @param mac_address - mac addr to assign to the interface if none-zero
554 */
555 define create_loopback
556 {
559  vl_api_mac_address_t mac_address;
560 };
561 
562 /** \brief Create loopback interface response
563  @param context - sender context, to match reply w/ request
564  @param sw_if_index - sw index of the interface that was created
565  @param retval - return code for the request
566 */
567 define create_loopback_reply
568 {
571  vl_api_interface_index_t sw_if_index;
572 };
573 
574 /** \brief Create loopback interface instance request
575  @param client_index - opaque cookie to identify the sender
576  @param context - sender context, to match reply w/ request
577  @param mac_address - mac addr to assign to the interface if none-zero
578  @param is_specified - if non-0, a specific user_instance is being requested
579  @param user_instance - requested instance, ~0 => dynamically allocate
580 */
581 define create_loopback_instance
582 {
585  vl_api_mac_address_t mac_address;
588 };
589 
590 /** \brief Create loopback interface instance response
591  @param context - sender context, to match reply w/ request
592  @param sw_if_index - sw index of the interface that was created
593  @param retval - return code for the request
594 */
595 define create_loopback_instance_reply
596 {
599  vl_api_interface_index_t sw_if_index;
600 };
601 
602 /** \brief Delete loopback interface request
603  @param client_index - opaque cookie to identify the sender
604  @param context - sender context, to match reply w/ request
605  @param sw_if_index - sw index of the interface that was created
606 */
607 autoreply define delete_loopback
608 {
611  vl_api_interface_index_t sw_if_index;
612 };
613 
614 /** \brief Enable or disable detailed interface stats
615  @param client_index - opaque cookie to identify the sender
616  @param context - sender context, to match reply w/ request
617  @param sw_if_index - The interface to collect detail stats on. ~0 implies
618  all interfaces.
619  @param enable_disable - set to 1 to enable, 0 to disable detailed stats
620 */
622 {
625  vl_api_interface_index_t sw_if_index;
627 };
628 
629 /*
630  * Local Variables:
631  * eval: (c-set-style "gnu")
632  * End:
633  */
vl_api_interface_index_t sw_if_index
Definition: interface.api:91
vl_api_if_status_flags_t flags
Definition: interface.api:149
vl_api_interface_index_t unnumbered_sw_if_index
Definition: interface.api:320
vl_api_interface_index_t sw_if_index
Definition: interface.api:391
vl_api_interface_index_t sw_if_index
Definition: interface.api:457
vl_api_interface_index_t sw_if_index
Definition: interface.api:498
vl_api_mac_address_t mac_address
Definition: interface.api:585
unsigned char u8
Definition: types.h:56
vl_api_mac_address_t mac_address
Definition: interface.api:559
vl_api_mac_address_t b_dmac
Definition: interface.api:183
option version
Definition: interface.api:17
vl_api_interface_index_t sw_if_index
Definition: interface.api:62
vl_api_interface_index_t sw_if_index
Definition: interface.api:547
vl_api_address_with_prefix_t prefix
Definition: interface.api:228
vl_api_interface_index_t sw_if_index
Definition: interface.api:611
unsigned int u32
Definition: types.h:88
vl_api_interface_index_t sw_if_index
Definition: interface.api:378
vl_api_if_status_flags_t flags
Definition: interface.api:92
vl_api_mac_address_t b_smac
Definition: interface.api:184
vl_api_interface_index_t sw_if_index
Definition: interface.api:420
vl_api_interface_index_t sw_if_index
Definition: interface.api:333
unsigned short u16
Definition: types.h:57
vl_api_interface_index_t sw_if_index
Definition: interface.api:319
service
Definition: interface.api:23
vl_api_interface_index_t sw_if_index
Definition: interface.api:279
vl_api_interface_index_t sw_if_index
Definition: interface.api:523
vl_api_mac_address_t l2_address
Definition: interface.api:147
vl_api_interface_index_t sw_if_index
Definition: interface.api:53
static int collect_detailed_interface_stats(void)
Definition: interface.h:831
vl_api_link_duplex_t link_duplex
Definition: interface.api:154
signed int i32
Definition: types.h:77
vl_api_interface_index_t sw_if_index
Definition: interface.api:571
vl_api_interface_index_t sw_if_index
Definition: interface.api:479
vl_api_interface_index_t sw_if_index
Definition: interface.api:293
vl_api_interface_index_t sw_if_index
Definition: interface.api:441
vl_api_interface_index_t sw_if_index
Definition: interface.api:490
vl_api_interface_index_t sw_if_index
Definition: interface.api:510
vl_api_interface_index_t sw_if_index
Definition: interface.api:39
vl_api_sub_if_flags_t sub_if_flags
Definition: interface.api:501
vl_api_interface_index_t sw_if_index
Definition: interface.api:625
vl_api_sub_if_flags_t sub_if_flags
Definition: interface.api:173
vl_api_interface_index_t sw_if_index
Definition: interface.api:224
vl_api_interface_index_t sw_if_index
Definition: interface.api:140
vl_api_if_status_flags_t flags
Definition: interface.api:40
vl_api_interface_index_t sw_if_index
Definition: interface.api:536
vl_api_interface_index_t sw_if_index
Definition: wireguard.api:33
vl_api_interface_index_t sw_if_index
Definition: interface.api:599
vl_api_interface_index_t sw_if_index
Definition: interface.api:348