FD.io VPP  v19.01.3-6-g70449b9b9
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 = "2.2.0";
18 
19 import "vnet/interface_types.api";
20 
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 {
38  /* 1 = up, 0 = 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 {
54 };
55 
56 /** \brief Set interface L3 MTU */
57 autoreply define sw_interface_set_mtu
58 {
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 {
78 };
79 
80 
81 /** \brief Interface Event generated by want_interface_events
82  @param client_index - opaque cookie to identify the sender
83  @param pid - client pid registered to receive notification
84  @param sw_if_index - index of the interface of the event
85  @param admin_up_down - The administrative state; 1 = up, 0 = down
86  @param link_up_down - The operational state; 1 = up, 0 = down
87  @param deleted - interface was deleted
88 */
89 define sw_interface_event
90 {
97 };
98 
99 /** \brief Register for interface events
100  @param client_index - opaque cookie to identify the sender
101  @param context - sender context, to match reply w/ request
102  @param enable_disable - 1 => register for events, 0 => cancel registration
103  @param pid - sender's pid
104 */
105 autoreply define want_interface_events
106 {
111 };
112 
113 /** \brief Interface details structure (fix this)
114  @param sw_if_index - index of the interface
115  @param sup_sw_if_index - index of parent interface if any, else same as sw_if_index
116  @param l2_address_length - length of the interface's l2 address
117  @param pid - the interface's l2 address
118  @param interface_name - name of the interface
119  @param link_duplex - 1 if half duplex, 2 if full duplex
120  @param link_speed - value in kbps
121  @param link_MTU - max. transmission unit
122  @param sub_if_id - A number 0-N to uniquely identify this subif on super if
123  @param sub_dot1ad - 0 = dot1q, 1 = dot1ad
124  @param sub_dot1ah - 1 = dot1ah, 0 = otherwise
125  @param sub_number_of_tags - Number of tags (0 - 2)
126  @param sub_outer_vlan_id
127  @param sub_inner_vlan_id
128  @param sub_exact_match
129  @param sub_default
130  @param sub_outer_vlan_id_any
131  @param sub_inner_vlan_id_any
132  @param vtr_op - vlan tag rewrite operation
133  @param vtr_push_dot1q
134  @param vtr_tag1
135  @param vtr_tag2
136  @param pbb_outer_tag - translate pbb s-tag
137  @param pbb_b_dmac[6] - B-tag remote mac address
138  @param pbb_b_smac[6] - B-tag local mac address
139  @param pbb_b_vlanid - B-tag vlanid
140  @param pbb_i_sid - I-tag service id
141 */
142 define sw_interface_details
143 {
146 
147  /* index of sup interface (e.g. hw interface).
148  equal to sw_if_index for super hw interface. */
150 
151  /* Layer 2 address, if applicable */
153  u8 l2_address[8];
154 
155  /* Interface name */
156  u8 interface_name[64];
157 
158  /* 1 = up, 0 = down */
161 
162  /* 1 = half duplex, 2 = full duplex */
164 
165  /* link speed in kbps */
167 
168  /* MTU */
170 
171  /* Per protocol MTUs */
172  u32 mtu[4]; /* 0 - L3, 1 - IP4, 2 - IP6, 3 - MPLS */
173 
174  /* Subinterface ID. A number 0-N to uniquely identify this subinterface under the super interface */
176 
177  /* 0 = dot1q, 1=dot1ad */
179  /* 1 = dot1h, 1=otherwise */
181 
182  /* Number of tags 0-2 */
190 
191  /* vlan tag rewrite state */
193  u32 vtr_push_dot1q; // ethertype of first pushed tag is dot1q/dot1ad
194  u32 vtr_tag1; // first pushed tag
195  u32 vtr_tag2; // second pushed tag
196  u8 tag[64];
197 
198  /* pbb tag rewrite info */
200  u8 b_dmac[6];
201  u8 b_smac[6];
204 };
205 
206 /* works */
207 define sw_interface_dump
208 {
212  u8 name_filter[49];
213 };
214 
215 /** \brief Set or delete one or all ip addresses on a specified interface
216  @param client_index - opaque cookie to identify the sender
217  @param context - sender context, to match reply w/ request
218  @param sw_if_index - index of the interface to add/del addresses
219  @param is_add - add address if non-zero, else delete
220  @param is_ipv6 - if non-zero the address is ipv6, else ipv4
221  @param del_all - if non-zero delete all addresses on the interface
222  @param address_length - address length in bytes, 4 for ip4, 16 for ip6
223  @param address - array of address bytes
224 */
225 autoreply define sw_interface_add_del_address
226 {
234  u8 address[16];
235 };
236 
237 /** \brief Associate the specified interface with a fib table
238  @param client_index - opaque cookie to identify the sender
239  @param context - sender context, to match reply w/ request
240  @param sw_if_index - index of the interface
241  @param is_ipv6 - if non-zero ipv6, else ipv4
242  @param vrf_id - fib table/vrd id to associate the interface with
243 */
244 autoreply define sw_interface_set_table
245 {
251 };
252 
253 /** \brief Get VRF id assigned to interface
254  @param client_index - opaque cookie to identify the sender
255  @param context - sender context, to match reply w/ request
256  @param sw_if_index - index of the interface
257 */
258 define sw_interface_get_table
259 {
264 };
265 
266 /** \brief Reply to get_sw_interface_vrf
267  @param context - sender context which was passed in the request
268  @param vrf_id - VRF id assigned to the interface
269 */
270 define sw_interface_get_table_reply
271 {
275 };
276 
277 /** \brief Set unnumbered interface add / del request
278  @param client_index - opaque cookie to identify the sender
279  @param context - sender context, to match reply w/ request
280  @param sw_if_index - interface with an IP address
281  @param unnumbered_sw_if_index - interface which will use the address
282  @param is_add - if non-zero set the association, else unset it
283 */
284 autoreply define sw_interface_set_unnumbered
285 {
288  u32 sw_if_index; /* use this intfc address */
289  u32 unnumbered_sw_if_index; /* on this interface */
291 };
292 
293 /** \brief Clear interface statistics
294  @param client_index - opaque cookie to identify the sender
295  @param context - sender context, to match reply w/ request
296  @param sw_if_index - index of the interface to clear statistics
297 */
298 autoreply define sw_interface_clear_stats
299 {
303 };
304 
305 /** \brief Set / clear software interface tag
306  @param client_index - opaque cookie to identify the sender
307  @param context - sender context, to match reply w/ request
308  @param sw_if_index - the interface
309  @param add_del - 1 = add, 0 = delete
310  @param tag - an ascii tag
311 */
312 autoreply define sw_interface_tag_add_del
313 {
318  u8 tag[64];
319 };
320 
321 /** \brief Set an interface's MAC address
322  @param client_index - opaque cookie to identify the sender
323  @param context - sender context, to match reply w/ request
324  @param sw_if_index - the interface whose MAC will be set
325  @param mac_addr - the new MAC address
326 */
327 autoreply define sw_interface_set_mac_address
328 {
333 };
334 
335 /** \brief Get interface's MAC address
336  @param client_index - opaque cookie to identify the sender
337  @param context - sender context, to match reply w/ request
338  @param sw_if_index - the interface whose MAC will be returned
339 */
340 define sw_interface_get_mac_address
341 {
345 };
346 
347 /** \brief Reply for get interface's MAC address request
348  @param context - returned sender context, to match reply w/ request
349  @param retval - return code
350  @param mac_addr - returned interface's MAC address
351 */
352 define sw_interface_get_mac_address_reply
353 {
357 };
358 
359 /** \brief Set an interface's rx-mode
360  @param client_index - opaque cookie to identify the sender
361  @param context - sender context, to match reply w/ request
362  @param sw_if_index - the interface whose rx-mode will be set
363  @param queue_id_valid - 1 = the queue_id field is valid. 0 means all
364  queue_id's
365  @param queue_id - the queue number whose rx-mode will be set. Only valid
366  if queue_id_valid is 1
367  @param mode - polling=1, interrupt=2, adaptive=3
368 */
369 autoreply define sw_interface_set_rx_mode
370 {
377 };
378 
379 /** \brief Set an interface's rx-placement
380  Rx-Queue placement on specific thread is operational for only hardware
381  interface. It will not set queue - thread placement for sub-interfaces,
382  p2p and pipe interfaces.
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 rx-placement will be set
386  @param queue_id - the queue number whose rx-placement will be set.
387  @param worker_id - the worker number whom rx-placement will be at.
388  @param is_main - flag to set rx-placement to main thread
389 */
390 autoreply define sw_interface_set_rx_placement
391 {
398 };
399 
400 /** \brief dump the rx queue placement of interface(s)
401  @param sw_if_index - optional interface index for which queue placement to
402  be requested. sw_if_index = ~0 will dump placement information for all
403  interfaces. It will not dump information related to sub-interfaces, p2p
404  and pipe interfaces.
405 */
406 define sw_interface_rx_placement_dump
407 {
411 };
412 
413 /** \brief show the interface's queue - thread placement
414  This api is used to display the interface and queue worker
415  thread placement. One message per rx-queue per interface will
416  be sent to client.
417  Each message will contain information about rx-queue id of an
418  interface, interface index, thread on which this rx-queue is
419  placed and mode of rx-queue.
420  @param client_index - opaque cookie to identify the sender
421  @param context - sender context, to match reply w/ request
422  @param sw_if_index - the interface whose rx-placement will be dumped
423  @param queue_id - the queue id
424  @param worker_id - the worker id on which queue_id is placed,
425  worker_id = 0 means main thread.
426  @param mode - polling=1, interrupt=2, adaptive=3
427 */
428 define sw_interface_rx_placement_details
429 {
436 };
437 
438 /* Gross kludge, DGMS */
439 autoreply define interface_name_renumber
440 {
445 };
446 
447 define create_subif
448 {
453 
454  /* These fields map directly onto the subif template */
458  u8 dot1ad; // 0 = dot1q, 1=dot1ad
465 };
466 
467 define create_subif_reply
468 {
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 {
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 {
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 {
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 {
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 {
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 {
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 {
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 {
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 */
583 {
588 };
589 
590 /*
591  * Local Variables:
592  * eval: (c-set-style "gnu")
593  * End:
594  */
typedef address
Definition: ip_types.api:30
unsigned char u8
Definition: types.h:56
option version
Definition: interface.api:17
unsigned int u32
Definition: types.h:88
unsigned short u16
Definition: types.h:57
service
Definition: interface.api:21
static int collect_detailed_interface_stats(void)
Definition: interface.h:798
signed int i32
Definition: types.h:77
u8 mac_address[6]