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