FD.io VPP  v18.04-17-g3a0d853
Vector Packet Processing
interface.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015 Cisco and/or its affiliates.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at:
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 /*
16  * interface.h: VNET interfaces/sub-interfaces
17  *
18  * Copyright (c) 2008 Eliot Dresselhaus
19  *
20  * Permission is hereby granted, free of charge, to any person obtaining
21  * a copy of this software and associated documentation files (the
22  * "Software"), to deal in the Software without restriction, including
23  * without limitation the rights to use, copy, modify, merge, publish,
24  * distribute, sublicense, and/or sell copies of the Software, and to
25  * permit persons to whom the Software is furnished to do so, subject to
26  * the following conditions:
27  *
28  * The above copyright notice and this permission notice shall be
29  * included in all copies or substantial portions of the Software.
30  *
31  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
32  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
33  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
34  * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
35  * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
36  * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
37  * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
38  */
39 
40 #ifndef included_vnet_interface_h
41 #define included_vnet_interface_h
42 
43 #include <vnet/unix/pcap.h>
44 #include <vnet/l3_types.h>
45 
46 struct vnet_main_t;
47 struct vnet_hw_interface_t;
48 struct vnet_sw_interface_t;
49 struct ip46_address_t;
50 
51 typedef enum
52 {
60 
61 /* Interface up/down callback. */
63  (struct vnet_main_t * vnm, u32 if_index, u32 flags);
64 
65 /* Sub-interface add/del callback. */
67  (struct vnet_main_t * vnm, u32 if_index,
68  struct vnet_sw_interface_t * template, int is_add);
69 
70 /* Interface set mac address callback. */
72  (struct vnet_hw_interface_t * hi, char *address);
73 
74 /* Interface set rx mode callback. */
76  (struct vnet_main_t * vnm, u32 if_index, u32 queue_id,
77  vnet_hw_interface_rx_mode mode);
78 
79 /* Interface set l2 mode callback. */
81  (struct vnet_main_t * vnm, struct vnet_hw_interface_t * hi,
82  i32 l2_if_adjust);
83 
85 {
89 #define VNET_ITF_FUNC_N_PRIO ((vnet_interface_function_priority_t)VNET_ITF_FUNC_PRIORITY_HIGH+1)
90 
91 typedef struct _vnet_interface_function_list_elt
92 {
93  struct _vnet_interface_function_list_elt *next_interface_function;
94  clib_error_t *(*fp) (struct vnet_main_t * vnm, u32 if_index, u32 flags);
95 } _vnet_interface_function_list_elt_t;
96 
97 #define _VNET_INTERFACE_FUNCTION_DECL_PRIO(f,tag,p) \
98  \
99 static void __vnet_interface_function_init_##tag##_##f (void) \
100  __attribute__((__constructor__)) ; \
101  \
102 static void __vnet_interface_function_init_##tag##_##f (void) \
103 { \
104  vnet_main_t * vnm = vnet_get_main(); \
105  static _vnet_interface_function_list_elt_t init_function; \
106  init_function.next_interface_function = vnm->tag##_functions[p]; \
107  vnm->tag##_functions[p] = &init_function; \
108  init_function.fp = (void *) &f; \
109 }
110 
111 #define _VNET_INTERFACE_FUNCTION_DECL(f,tag) \
112  _VNET_INTERFACE_FUNCTION_DECL_PRIO(f,tag,VNET_ITF_FUNC_PRIORITY_LOW)
113 
114 #define VNET_HW_INTERFACE_ADD_DEL_FUNCTION(f) \
115  _VNET_INTERFACE_FUNCTION_DECL(f,hw_interface_add_del)
116 #define VNET_HW_INTERFACE_LINK_UP_DOWN_FUNCTION(f) \
117  _VNET_INTERFACE_FUNCTION_DECL(f,hw_interface_link_up_down)
118 #define VNET_HW_INTERFACE_LINK_UP_DOWN_FUNCTION_PRIO(f,p) \
119  _VNET_INTERFACE_FUNCTION_DECL_PRIO(f,hw_interface_link_up_down,p)
120 #define VNET_SW_INTERFACE_ADD_DEL_FUNCTION(f) \
121  _VNET_INTERFACE_FUNCTION_DECL(f,sw_interface_add_del)
122 #define VNET_SW_INTERFACE_ADMIN_UP_DOWN_FUNCTION(f) \
123  _VNET_INTERFACE_FUNCTION_DECL(f,sw_interface_admin_up_down)
124 #define VNET_SW_INTERFACE_ADMIN_UP_DOWN_FUNCTION_PRIO(f,p) \
125  _VNET_INTERFACE_FUNCTION_DECL_PRIO(f,sw_interface_admin_up_down, p)
126 
127 /* A class of hardware interface devices. */
128 typedef struct _vnet_device_class
129 {
130  /* Index into main vector. */
131  u32 index;
132 
133  /* Device name (e.g. "FOOBAR 1234a"). */
134  char *name;
135 
136  /* Function to call when hardware interface is added/deleted. */
137  vnet_interface_function_t *interface_add_del_function;
138 
139  /* Function to bring device administratively up/down. */
141 
142  /* Function to call when sub-interface is added/deleted */
143  vnet_subif_add_del_function_t *subif_add_del_function;
144 
145  /* Function to call interface rx mode is changed */
146  vnet_interface_set_rx_mode_function_t *rx_mode_change_function;
147 
148  /* Function to call interface l2 mode is changed */
149  vnet_interface_set_l2_mode_function_t *set_l2_mode_function;
150 
151  /* Redistribute flag changes/existence of this interface class. */
152  u32 redistribute;
153 
154  /* Transmit function. */
155  vlib_node_function_t *tx_function;
156 
157  /* Error strings indexed by error code for this node. */
158  char **tx_function_error_strings;
159 
160  /* Number of error codes used by this node. */
161  u32 tx_function_n_errors;
162 
163  /* Renumber device name [only!] support, a control-plane kludge */
164  int (*name_renumber) (struct vnet_hw_interface_t * hi,
165  u32 new_dev_instance);
166 
167  /* Format device instance as name. */
168  format_function_t *format_device_name;
169 
170  /* Parse function for device name. */
171  unformat_function_t *unformat_device_name;
172 
173  /* Format device verbosely for this class. */
174  format_function_t *format_device;
175 
176  /* Trace buffer format for TX function. */
177  format_function_t *format_tx_trace;
178 
179  /* Function to clear hardware counters for device. */
180  void (*clear_counters) (u32 dev_class_instance);
181 
182  uword (*is_valid_class_for_interface) (struct vnet_main_t * vnm,
183  u32 hw_if_index,
184  u32 hw_class_index);
185 
186  /* Called when hardware class of an interface changes. */
187  void (*hw_class_change) (struct vnet_main_t * vnm,
188  u32 hw_if_index, u32 new_hw_class_index);
189 
190  /* Called to redirect traffic from a specific interface instance */
191  void (*rx_redirect_to_node) (struct vnet_main_t * vnm,
192  u32 hw_if_index, u32 node_index);
193 
194  /* Link-list of all device classes set up by constructors created below */
195  struct _vnet_device_class *next_class_registration;
196 
197  /* Function to set mac address. */
198  vnet_interface_set_mac_address_function_t *mac_addr_change_function;
200 
201 #define VNET_DEVICE_CLASS(x,...) \
202  __VA_ARGS__ vnet_device_class_t x; \
203 static void __vnet_add_device_class_registration_##x (void) \
204  __attribute__((__constructor__)) ; \
205 static void __vnet_add_device_class_registration_##x (void) \
206 { \
207  vnet_main_t * vnm = vnet_get_main(); \
208  x.next_class_registration = vnm->device_class_registrations; \
209  vnm->device_class_registrations = &x; \
210 } \
211 __VA_ARGS__ vnet_device_class_t x
212 
213 #define VLIB_DEVICE_TX_FUNCTION_CLONE_TEMPLATE(arch, fn, tgt) \
214  uword \
215  __attribute__ ((flatten)) \
216  __attribute__ ((target (tgt))) \
217  CLIB_CPU_OPTIMIZED \
218  fn ## _ ## arch ( vlib_main_t * vm, \
219  vlib_node_runtime_t * node, \
220  vlib_frame_t * frame) \
221  { return fn (vm, node, frame); }
222 
223 #define VLIB_DEVICE_TX_FUNCTION_MULTIARCH_CLONE(fn) \
224  foreach_march_variant(VLIB_DEVICE_TX_FUNCTION_CLONE_TEMPLATE, fn)
225 
226 #if CLIB_DEBUG > 0
227 #define VLIB_MULTIARCH_CLONE_AND_SELECT_FN(fn,...)
228 #define VLIB_DEVICE_TX_FUNCTION_MULTIARCH(dev, fn)
229 #else
230 #define VLIB_DEVICE_TX_FUNCTION_MULTIARCH(dev, fn) \
231  VLIB_DEVICE_TX_FUNCTION_MULTIARCH_CLONE(fn) \
232  CLIB_MULTIARCH_SELECT_FN(fn, static inline) \
233  static void __attribute__((__constructor__)) \
234  __vlib_device_tx_function_multiarch_select_##dev (void) \
235  { dev.tx_function = fn ## _multiarch_select(); }
236 #endif
237 
238 /**
239  * Link Type: A description of the protocol of packets on the link.
240  * On an ethernet link this maps directly into the ethertype. On a GRE tunnel
241  * it maps to the GRE-proto, etc for other lnk types.
242  */
243 typedef enum vnet_link_t_
244 {
245 #if CLIB_DEBUG > 0
247 #else
248  VNET_LINK_IP4 = 0,
249 #endif
255 } __attribute__ ((packed)) vnet_link_t;
256 
257 #define VNET_LINKS { \
258  [VNET_LINK_ETHERNET] = "ethernet", \
259  [VNET_LINK_IP4] = "ipv4", \
260  [VNET_LINK_IP6] = "ipv6", \
261  [VNET_LINK_MPLS] = "mpls", \
262  [VNET_LINK_ARP] = "arp", \
263  [VNET_LINK_NSH] = "nsh", \
264 }
265 
266 /**
267  * @brief Number of link types. Not part of the enum so it does not have to be included in
268  * switch statements
269  */
270 #define VNET_LINK_NUM (VNET_LINK_NSH+1)
271 
272 /**
273  * @brief Convert a link to to an Ethertype
274  */
275 extern vnet_l3_packet_type_t vnet_link_to_l3_proto (vnet_link_t link);
276 
277 /**
278  * @brief Attributes assignable to a HW interface Class.
279  */
281 {
282  /**
283  * @brief a point 2 point interface
284  */
287 
288 /* Layer-2 (e.g. Ethernet) interface class. */
289 typedef struct _vnet_hw_interface_class
290 {
291  /* Index into main vector. */
292  u32 index;
293 
294  /* Class name (e.g. "Ethernet"). */
295  char *name;
296 
297  /* Flags */
299 
300  /* Function to call when hardware interface is added/deleted. */
301  vnet_interface_function_t *interface_add_del_function;
302 
303  /* Function to bring interface administratively up/down. */
305 
306  /* Function to call when link state changes. */
308 
309  /* Function to call when link MAC changes. */
310  vnet_interface_set_mac_address_function_t *mac_addr_change_function;
311 
312  /* Format function to display interface name. */
313  format_function_t *format_interface_name;
314 
315  /* Format function to display interface address. */
316  format_function_t *format_address;
317 
318  /* Format packet header for this interface class. */
319  format_function_t *format_header;
320 
321  /* Format device verbosely for this class. */
322  format_function_t *format_device;
323 
324  /* Parser for hardware (e.g. ethernet) address. */
325  unformat_function_t *unformat_hw_address;
326 
327  /* Parser for packet header for e.g. rewrite string. */
328  unformat_function_t *unformat_header;
329 
330  /* Builds a rewrite string for the interface to the destination
331  * for the payload/link type. */
332  u8 *(*build_rewrite) (struct vnet_main_t * vnm,
333  u32 sw_if_index,
334  vnet_link_t link_type, const void *dst_hw_address);
335 
336  /* Update an adjacecny added by FIB (as opposed to via the
337  * neighbour resolution protocol). */
338  void (*update_adjacency) (struct vnet_main_t * vnm,
339  u32 sw_if_index, u32 adj_index);
340 
341  uword (*is_valid_class_for_interface) (struct vnet_main_t * vnm,
342  u32 hw_if_index,
343  u32 hw_class_index);
344 
345  /* Called when hw interface class is changed and old hardware instance
346  may want to be deleted. */
347  void (*hw_class_change) (struct vnet_main_t * vnm, u32 hw_if_index,
348  u32 old_class_index, u32 new_class_index);
349 
350  /* List of hw interface classes, built by constructors */
351  struct _vnet_hw_interface_class *next_class_registration;
352 
354 
355 /**
356  * @brief Return a complete, zero-length (aka dummy) rewrite
357  */
358 extern u8 *default_build_rewrite (struct vnet_main_t *vnm,
359  u32 sw_if_index,
360  vnet_link_t link_type,
361  const void *dst_hw_address);
362 
363 /**
364  * @brief Default adjacency update function
365  */
366 extern void default_update_adjacency (struct vnet_main_t *vnm,
367  u32 sw_if_index, u32 adj_index);
368 
369 #define VNET_HW_INTERFACE_CLASS(x,...) \
370  __VA_ARGS__ vnet_hw_interface_class_t x; \
371 static void __vnet_add_hw_interface_class_registration_##x (void) \
372  __attribute__((__constructor__)) ; \
373 static void __vnet_add_hw_interface_class_registration_##x (void) \
374 { \
375  vnet_main_t * vnm = vnet_get_main(); \
376  x.next_class_registration = vnm->hw_interface_class_registrations; \
377  vnm->hw_interface_class_registrations = &x; \
378 } \
379 __VA_ARGS__ vnet_hw_interface_class_t x
380 
381 /* Hardware-interface. This corresponds to a physical wire
382  that packets flow over. */
383 typedef struct vnet_hw_interface_t
384 {
385  /* Interface name. */
387 
389  /* Hardware link state is up. */
390 #define VNET_HW_INTERFACE_FLAG_LINK_UP (1 << 0)
391  /* Hardware duplex state */
392 #define VNET_HW_INTERFACE_FLAG_DUPLEX_SHIFT 1
393 #define VNET_HW_INTERFACE_FLAG_HALF_DUPLEX (1 << 1)
394 #define VNET_HW_INTERFACE_FLAG_FULL_DUPLEX (1 << 2)
395 #define VNET_HW_INTERFACE_FLAG_DUPLEX_MASK \
396  (VNET_HW_INTERFACE_FLAG_HALF_DUPLEX | \
397  VNET_HW_INTERFACE_FLAG_FULL_DUPLEX)
398 
399  /* Hardware link speed */
400 #define VNET_HW_INTERFACE_FLAG_SPEED_SHIFT 3
401 #define VNET_HW_INTERFACE_FLAG_SPEED_10M (1 << 3)
402 #define VNET_HW_INTERFACE_FLAG_SPEED_100M (1 << 4)
403 #define VNET_HW_INTERFACE_FLAG_SPEED_1G (1 << 5)
404 #define VNET_HW_INTERFACE_FLAG_SPEED_2_5G (1 << 6)
405 #define VNET_HW_INTERFACE_FLAG_SPEED_5G (1 << 7)
406 #define VNET_HW_INTERFACE_FLAG_SPEED_10G (1 << 8)
407 #define VNET_HW_INTERFACE_FLAG_SPEED_20G (1 << 9)
408 #define VNET_HW_INTERFACE_FLAG_SPEED_25G (1 << 10)
409 #define VNET_HW_INTERFACE_FLAG_SPEED_40G (1 << 11)
410 #define VNET_HW_INTERFACE_FLAG_SPEED_50G (1 << 12)
411 #define VNET_HW_INTERFACE_FLAG_SPEED_56G (1 << 13)
412 #define VNET_HW_INTERFACE_FLAG_SPEED_100G (1 << 14)
413 #define VNET_HW_INTERFACE_FLAG_SPEED_MASK \
414  (VNET_HW_INTERFACE_FLAG_SPEED_10M | \
415  VNET_HW_INTERFACE_FLAG_SPEED_100M | \
416  VNET_HW_INTERFACE_FLAG_SPEED_1G | \
417  VNET_HW_INTERFACE_FLAG_SPEED_2_5G | \
418  VNET_HW_INTERFACE_FLAG_SPEED_5G | \
419  VNET_HW_INTERFACE_FLAG_SPEED_10G | \
420  VNET_HW_INTERFACE_FLAG_SPEED_20G | \
421  VNET_HW_INTERFACE_FLAG_SPEED_25G | \
422  VNET_HW_INTERFACE_FLAG_SPEED_40G | \
423  VNET_HW_INTERFACE_FLAG_SPEED_50G | \
424  VNET_HW_INTERFACE_FLAG_SPEED_56G | \
425  VNET_HW_INTERFACE_FLAG_SPEED_100G)
426 
427  /* rx mode flags */
428 #define VNET_HW_INTERFACE_FLAG_SUPPORTS_INT_MODE (1 << 16)
429 
430  /* tx checksum offload */
431 #define VNET_HW_INTERFACE_FLAG_SUPPORTS_TX_L4_CKSUM_OFFLOAD (1 << 17)
432 
433  /* Hardware address as vector. Zero (e.g. zero-length vector) if no
434  address for this class (e.g. PPP). */
436 
437  /* Interface is up as far as software is concerned. */
438  /* NAME.{output,tx} nodes for this interface. */
439  u32 output_node_index, tx_node_index;
440 
441  /* (dev_class, dev_instance) uniquely identifies hw interface. */
444 
445  /* (hw_class, hw_instance) uniquely identifies hw interface. */
448 
449  /* Hardware index for this hardware interface. */
451 
452  /* Software index for this hardware interface. */
454 
455  /* Next index in interface-output node for this interface
456  used by node function vnet_per_buffer_interface_output() */
458 
459  /* Maximum transmit rate for this interface in bits/sec. */
461 
462  /* Smallest packet size supported by this interface. */
464 
465  /* Largest packet size supported by this interface. */
467 
468  /* Smallest packet size for this interface. */
470 
471  /* Largest packet size for this interface. */
473 
474  /* Number of extra bytes that go on the wire.
475  Packet length on wire
476  = max (length + per_packet_overhead_bytes, min_packet_bytes). */
478 
479  /* Receive and transmit layer 3 packet size limits (MRU/MTU). */
480  u32 max_l3_packet_bytes[VLIB_N_RX_TX];
481 
482  /* Hash table mapping sub interface id to sw_if_index. */
484 
485  /* Count of number of L2 subinterfaces */
487 
488  /* Bonded interface info -
489  0 - not a bonded interface nor a slave
490  ~0 - slave to a bonded interface
491  others - A bonded interface with a pointer to bitmap for all slaves */
493 #define VNET_HW_INTERFACE_BOND_INFO_NONE ((uword *) 0)
494 #define VNET_HW_INTERFACE_BOND_INFO_SLAVE ((uword *) ~0)
495 
496  /* Input node */
498 
499  /* input node cpu index by queue */
501 
502  /* vnet_hw_interface_rx_mode by queue */
504  vnet_hw_interface_rx_mode default_rx_mode;
505 
506  /* device input device_and_queue runtime index */
508 
510 
512 
513 typedef enum
514 {
515  /* A hw interface. */
517 
518  /* A sub-interface. */
522 
523 typedef struct
524 {
525  /*
526  * Subinterface ID. A number 0-N to uniquely identify
527  * this subinterface under the main (parent?) interface
528  */
530 
531  /* Classification data. Used to associate packet header with subinterface. */
532  struct
533  {
536  union
537  {
539  struct
540  {
541  u16 no_tags:1;
542  u16 one_tag:1;
543  u16 two_tags:1;
544  u16 dot1ad:1; /* 0 = dot1q, 1=dot1ad */
545  u16 exact_match:1;
546  u16 default_sub:1;
547  u16 outer_vlan_id_any:1;
548  u16 inner_vlan_id_any:1;
549  } flags;
550  };
551  } eth;
553 
554 typedef struct
555 {
556  /*
557  * Subinterface ID. A number 0-N to uniquely identify
558  * this subinterface under the main interface
559  */
562  u8 client_mac[6];
564 
565 typedef enum
566 {
567  /* THe BVI interface */
569  /* Always flood */
572  /* Does not flood when tunnel master is in the same L2 BD */
574  /* Never flood to this type */
577 
578 /* Software-interface. This corresponds to a Ethernet VLAN, ATM vc, a
579  tunnel, etc. Configuration (e.g. IP address) gets attached to
580  software interface. */
581 typedef struct
582 {
583  vnet_sw_interface_type_t type:16;
584 
586  /* Interface is "up" meaning adminstratively up.
587  Up in the sense of link state being up is maintained by hardware interface. */
588 #define VNET_SW_INTERFACE_FLAG_ADMIN_UP (1 << 0)
589 
590  /* Interface is disabled for forwarding: punt all traffic to slow-path. */
591 #define VNET_SW_INTERFACE_FLAG_PUNT (1 << 1)
592 
593 #define VNET_SW_INTERFACE_FLAG_PROXY_ARP (1 << 2)
594 
595 #define VNET_SW_INTERFACE_FLAG_UNNUMBERED (1 << 3)
596 
597 #define VNET_SW_INTERFACE_FLAG_BOND_SLAVE (1 << 4)
598 
599  /* Interface does not appear in CLI/API */
600 #define VNET_SW_INTERFACE_FLAG_HIDDEN (1 << 5)
601 
602  /* Interface in ERROR state */
603 #define VNET_SW_INTERFACE_FLAG_ERROR (1 << 6)
604 
605  /* Index for this interface. */
607 
608  /* Software interface index of super-interface;
609  equal to sw_if_index if this interface is not a
610  sub-interface. */
612 
613  /* this swif is unnumbered, use addresses on unnumbered_sw_if_index... */
615 
617 
618  union
619  {
620  /* VNET_SW_INTERFACE_TYPE_HARDWARE. */
622 
623  /* VNET_SW_INTERFACE_TYPE_SUB. */
625 
626  /* VNET_SW_INTERFACE_TYPE_P2P. */
628  };
629 
630  vnet_flood_class_t flood_class;
632 
633 typedef enum
634 {
635  /* Simple counters. */
646  /* Combined counters. */
657 
658 #define foreach_rx_combined_interface_counter(_x) \
659  for (_x = VNET_INTERFACE_COUNTER_RX; \
660  _x <= VNET_INTERFACE_COUNTER_RX_BROADCAST; \
661  _x++)
662 
663 #define foreach_tx_combined_interface_counter(_x) \
664  for (_x = VNET_INTERFACE_COUNTER_TX; \
665  _x <= VNET_INTERFACE_COUNTER_TX_BROADCAST; \
666  _x++)
667 
668 typedef enum
669 {
673 
675 
676 static inline int
678 {
680 }
681 
684 
685 
686 typedef struct
687 {
691 
692 typedef struct
693 {
694  /* Hardware interfaces. */
696 
697  /* Hash table mapping HW interface name to index. */
699 
700  /* Vectors if hardware interface classes and device classes. */
703 
704  /* Hash table mapping name to hw interface/device class. */
707 
708  /* Software interfaces. */
710 
711  /* Hash table mapping sub intfc sw_if_index by sup sw_if_index and sub id */
713 
714  /* Software interface counters both simple and combined
715  packet and byte counters. */
719 
721 
722  /* pcap drop tracing */
729 
730  /* feature_arc_index */
733 
734 static inline void
736 {
737  if (im->sw_if_counter_lock)
738  while (__sync_lock_test_and_set (im->sw_if_counter_lock, 1))
739  /* zzzz */ ;
740 }
741 
742 static inline void
744 {
745  if (im->sw_if_counter_lock)
746  *im->sw_if_counter_lock = 0;
747 }
748 
749 void vnet_pcap_drop_trace_filter_add_del (u32 error_index, int is_add);
750 
751 int vnet_interface_name_renumber (u32 sw_if_index, u32 new_show_dev_instance);
752 
753 #endif /* included_vnet_interface_h */
754 
755 /*
756  * fd.io coding-style-patch-verification: ON
757  *
758  * Local Variables:
759  * eval: (c-set-style "gnu")
760  * End:
761  */
u8 * default_build_rewrite(struct vnet_main_t *vnm, u32 sw_if_index, vnet_link_t link_type, const void *dst_hw_address)
Return a complete, zero-length (aka dummy) rewrite.
Definition: interface.c:1500
vmrglw vmrglh hi
uword( unformat_function_t)(unformat_input_t *input, va_list *args)
Definition: format.h:231
pcap_main_t pcap_main
Definition: interface.h:724
void collect_detailed_interface_stats_flag_set(void)
Definition: interface.c:1558
volatile u32 * sw_if_counter_lock
Definition: interface.h:716
vnet_hw_interface_nodes_t * deleted_hw_interface_nodes
Definition: interface.h:720
vnet_p2p_sub_interface_t p2p
Definition: interface.h:627
enum vnet_hw_interface_class_flags_t_ vnet_hw_interface_class_flags_t
Attributes assignable to a HW interface Class.
PCAP utility definitions.
u32 * input_node_thread_index_by_queue
Definition: interface.h:500
clib_error_t *( vnet_interface_set_rx_mode_function_t)(struct vnet_main_t *vnm, u32 if_index, u32 queue_id, vnet_hw_interface_rx_mode mode)
Definition: interface.h:76
uword * sub_interface_sw_if_index_by_id
Definition: interface.h:483
u8 *( format_function_t)(u8 *s, va_list *args)
Definition: format.h:48
struct _vnet_device_class vnet_device_class_t
uword * dq_runtime_index_by_queue
Definition: interface.h:507
vnet_interface_stats_collection_mode_e
Definition: interface.h:668
clib_error_t *( vnet_interface_set_mac_address_function_t)(struct vnet_hw_interface_t *hi, char *address)
Definition: interface.h:72
vnet_hw_interface_rx_mode
Definition: interface.h:51
vnet_flood_class_t flood_class
Definition: interface.h:630
uword * pcap_drop_filter_hash
Definition: interface.h:728
PCAP main state data structure.
Definition: pcap.h:124
vnet_l3_packet_type_t
Definition: l3_types.h:44
vlib_combined_counter_main_t * combined_sw_if_counters
Definition: interface.h:718
int i32
Definition: types.h:81
clib_error_t *( vnet_interface_function_t)(struct vnet_main_t *vnm, u32 if_index, u32 flags)
Definition: interface.h:63
int collect_detailed_interface_stats_flag
Definition: interface.c:1555
A collection of simple counters.
Definition: counter.h:58
void vnet_pcap_drop_trace_filter_add_del(u32 error_index, int is_add)
u32 max_supported_packet_bytes
Definition: interface.h:466
uword * hw_interface_by_name
Definition: interface.h:698
vnet_l3_packet_type_t vnet_link_to_l3_proto(vnet_link_t link)
Convert a link to to an Ethertype.
Definition: interface.c:1478
static clib_error_t * link_up_down_function(vnet_main_t *vm, u32 hw_if_index, u32 flags)
vnet_hw_interface_t * hw_interfaces
Definition: interface.h:695
vnet_sub_interface_t sub
Definition: interface.h:624
uword * sw_if_index_by_sup_and_sub
Definition: interface.h:712
vlib_simple_counter_main_t * sw_if_counters
Definition: interface.h:717
vnet_device_class_t vnet_local_interface_device_class
vnet_interface_function_priority_t_
Definition: interface.h:84
uword * hw_interface_class_by_name
Definition: interface.h:705
uword( vlib_node_function_t)(struct vlib_main_t *vm, struct vlib_node_runtime_t *node, struct vlib_frame_t *frame)
Definition: node.h:54
static clib_error_t * admin_up_down_function(vnet_main_t *vm, u32 hw_if_index, u32 flags)
vnet_flood_class_t
Definition: interface.h:565
vnet_link_t_
Link Type: A description of the protocol of packets on the link.
Definition: interface.h:243
static void vnet_interface_counter_unlock(vnet_interface_main_t *im)
Definition: interface.h:743
static int collect_detailed_interface_stats(void)
Definition: interface.h:677
vnet_interface_counter_type_t
Definition: interface.h:633
clib_error_t *( vnet_interface_set_l2_mode_function_t)(struct vnet_main_t *vnm, struct vnet_hw_interface_t *hi, i32 l2_if_adjust)
Definition: interface.h:81
static void vnet_interface_counter_lock(vnet_interface_main_t *im)
Definition: interface.h:735
enum vnet_interface_function_priority_t_ vnet_interface_function_priority_t
unsigned int u32
Definition: types.h:88
clib_error_t *( vnet_subif_add_del_function_t)(struct vnet_main_t *vnm, u32 if_index, struct vnet_sw_interface_t *template, int is_add)
Definition: interface.h:67
uword * device_class_by_name
Definition: interface.h:706
u64 uword
Definition: types.h:112
struct vnet_hw_interface_t vnet_hw_interface_t
unsigned short u16
Definition: types.h:57
struct _vnet_hw_interface_class vnet_hw_interface_class_t
double f64
Definition: types.h:142
unsigned char u8
Definition: types.h:56
vnet_sw_interface_t * sw_interfaces
Definition: interface.h:709
a point 2 point interface
Definition: interface.h:285
vnet_hw_interface_class_t * hw_interface_classes
Definition: interface.h:701
A collection of combined counters.
Definition: counter.h:180
u32 min_supported_packet_bytes
Definition: interface.h:463
vnet_hw_interface_rx_mode default_rx_mode
Definition: interface.h:504
vnet_device_class_t * device_classes
Definition: interface.h:702
void collect_detailed_interface_stats_flag_clear(void)
Definition: interface.c:1564
u32 per_packet_overhead_bytes
Definition: interface.h:477
u32 flags
Definition: vhost-user.h:77
void default_update_adjacency(struct vnet_main_t *vnm, u32 sw_if_index, u32 adj_index)
Default adjacency update function.
Definition: interface.c:1508
int vnet_interface_name_renumber(u32 sw_if_index, u32 new_show_dev_instance)
Definition: interface.c:1317
vnet_hw_interface_class_flags_t_
Attributes assignable to a HW interface Class.
Definition: interface.h:280
vnet_sw_interface_type_t
Definition: interface.h:513