40 #ifndef included_vnet_interface_h 41 #define included_vnet_interface_h 49 struct ip46_address_t;
69 #define VNET_ITF_FUNC_N_PRIO ((vnet_interface_function_priority_t)VNET_ITF_FUNC_PRIORITY_HIGH+1) 71 typedef struct _vnet_interface_function_list_elt
73 struct _vnet_interface_function_list_elt *next_interface_function;
75 } _vnet_interface_function_list_elt_t;
77 #define _VNET_INTERFACE_FUNCTION_DECL(f,tag) \ 79 static void __vnet_interface_function_init_##tag##_##f (void) \ 80 __attribute__((__constructor__)) ; \ 82 static void __vnet_interface_function_init_##tag##_##f (void) \ 84 vnet_main_t * vnm = vnet_get_main(); \ 85 static _vnet_interface_function_list_elt_t init_function; \ 86 init_function.next_interface_function = \ 87 vnm->tag##_functions[VNET_ITF_FUNC_PRIORITY_LOW]; \ 88 vnm->tag##_functions[VNET_ITF_FUNC_PRIORITY_LOW] = &init_function; \ 89 init_function.fp = (void *) &f; \ 92 #define _VNET_INTERFACE_FUNCTION_DECL_PRIO(f,tag,p) \ 94 static void __vnet_interface_function_init_##tag##_##f (void) \ 95 __attribute__((__constructor__)) ; \ 97 static void __vnet_interface_function_init_##tag##_##f (void) \ 99 vnet_main_t * vnm = vnet_get_main(); \ 100 static _vnet_interface_function_list_elt_t init_function; \ 101 init_function.next_interface_function = vnm->tag##_functions[p]; \ 102 vnm->tag##_functions[p] = &init_function; \ 103 init_function.fp = (void *) &f; \ 106 #define VNET_HW_INTERFACE_ADD_DEL_FUNCTION(f) \ 107 _VNET_INTERFACE_FUNCTION_DECL(f,hw_interface_add_del) 108 #define VNET_HW_INTERFACE_LINK_UP_DOWN_FUNCTION(f) \ 109 _VNET_INTERFACE_FUNCTION_DECL(f,hw_interface_link_up_down) 110 #define VNET_HW_INTERFACE_LINK_UP_DOWN_FUNCTION_PRIO(f,p) \ 111 _VNET_INTERFACE_FUNCTION_DECL_PRIO(f,hw_interface_link_up_down,p) 112 #define VNET_SW_INTERFACE_ADD_DEL_FUNCTION(f) \ 113 _VNET_INTERFACE_FUNCTION_DECL(f,sw_interface_add_del) 114 #define VNET_SW_INTERFACE_ADMIN_UP_DOWN_FUNCTION(f) \ 115 _VNET_INTERFACE_FUNCTION_DECL(f,sw_interface_admin_up_down) 116 #define VNET_SW_INTERFACE_ADMIN_UP_DOWN_FUNCTION_PRIO(f,p) \ 117 _VNET_INTERFACE_FUNCTION_DECL_PRIO(f,sw_interface_admin_up_down, p) 120 typedef struct _vnet_device_class
144 char **tx_function_error_strings;
147 u32 tx_function_n_errors;
151 u32 new_dev_instance);
166 void (*clear_counters) (
u32 dev_class_instance);
174 u32 hw_if_index,
u32 new_hw_class_index);
177 void (*rx_redirect_to_node) (
struct vnet_main_t * vnm,
178 u32 hw_if_index,
u32 node_index);
181 struct _vnet_device_class *next_class_registration;
184 u8 flatten_output_chains;
190 #define VNET_DEVICE_CLASS(x,...) \ 191 __VA_ARGS__ vnet_device_class_t x; \ 192 static void __vnet_add_device_class_registration_##x (void) \ 193 __attribute__((__constructor__)) ; \ 194 static void __vnet_add_device_class_registration_##x (void) \ 196 vnet_main_t * vnm = vnet_get_main(); \ 197 x.next_class_registration = vnm->device_class_registrations; \ 198 vnm->device_class_registrations = &x; \ 200 __VA_ARGS__ vnet_device_class_t x 202 #define VLIB_DEVICE_TX_FUNCTION_CLONE_TEMPLATE(arch, fn, tgt) \ 204 __attribute__ ((flatten)) \ 205 __attribute__ ((target (tgt))) \ 207 fn ## _ ## arch ( vlib_main_t * vm, \ 208 vlib_node_runtime_t * node, \ 209 vlib_frame_t * frame) \ 210 { return fn (vm, node, frame); } 212 #define VLIB_DEVICE_TX_FUNCTION_MULTIARCH_CLONE(fn) \ 213 foreach_march_variant(VLIB_DEVICE_TX_FUNCTION_CLONE_TEMPLATE, fn) 216 #define VLIB_MULTIARCH_CLONE_AND_SELECT_FN(fn,...) 217 #define VLIB_DEVICE_TX_FUNCTION_MULTIARCH(dev, fn) 219 #define VLIB_DEVICE_TX_FUNCTION_MULTIARCH(dev, fn) \ 220 VLIB_DEVICE_TX_FUNCTION_MULTIARCH_CLONE(fn) \ 221 CLIB_MULTIARCH_SELECT_FN(fn, static inline) \ 222 static void __attribute__((__constructor__)) \ 223 __vlib_device_tx_function_multiarch_select_##dev (void) \ 224 { dev.tx_function = fn ## _multiarch_select(); } 244 } __attribute__ ((packed)) vnet_link_t;
246 #define VNET_LINKS { \ 247 [VNET_LINK_ETHERNET] = "ethernet", \ 248 [VNET_LINK_IP4] = "ipv4", \ 249 [VNET_LINK_IP6] = "ipv6", \ 250 [VNET_LINK_MPLS] = "mpls", \ 251 [VNET_LINK_ARP] = "arp", \ 252 [VNET_LINK_NSH] = "nsh", \ 259 #define VNET_LINK_NUM (VNET_LINK_NSH+1) 278 typedef struct _vnet_hw_interface_class
323 vnet_link_t link_type,
const void *dst_hw_address);
327 void (*update_adjacency) (
struct vnet_main_t * vnm,
328 u32 sw_if_index,
u32 adj_index);
336 void (*hw_class_change) (
struct vnet_main_t * vnm,
u32 hw_if_index,
337 u32 old_class_index,
u32 new_class_index);
340 struct _vnet_hw_interface_class *next_class_registration;
349 vnet_link_t link_type,
350 const void *dst_hw_address);
356 u32 sw_if_index,
u32 adj_index);
358 #define VNET_HW_INTERFACE_CLASS(x,...) \ 359 __VA_ARGS__ vnet_hw_interface_class_t x; \ 360 static void __vnet_add_hw_interface_class_registration_##x (void) \ 361 __attribute__((__constructor__)) ; \ 362 static void __vnet_add_hw_interface_class_registration_##x (void) \ 364 vnet_main_t * vnm = vnet_get_main(); \ 365 x.next_class_registration = vnm->hw_interface_class_registrations; \ 366 vnm->hw_interface_class_registrations = &x; \ 368 __VA_ARGS__ vnet_hw_interface_class_t x 379 #define VNET_HW_INTERFACE_FLAG_LINK_UP (1 << 0) 381 #define VNET_HW_INTERFACE_FLAG_DUPLEX_SHIFT 1 382 #define VNET_HW_INTERFACE_FLAG_HALF_DUPLEX (1 << 1) 383 #define VNET_HW_INTERFACE_FLAG_FULL_DUPLEX (1 << 2) 384 #define VNET_HW_INTERFACE_FLAG_DUPLEX_MASK \ 385 (VNET_HW_INTERFACE_FLAG_HALF_DUPLEX | \ 386 VNET_HW_INTERFACE_FLAG_FULL_DUPLEX) 389 #define VNET_HW_INTERFACE_FLAG_SPEED_SHIFT 3 390 #define VNET_HW_INTERFACE_FLAG_SPEED_10M (1 << 3) 391 #define VNET_HW_INTERFACE_FLAG_SPEED_100M (1 << 4) 392 #define VNET_HW_INTERFACE_FLAG_SPEED_1G (1 << 5) 393 #define VNET_HW_INTERFACE_FLAG_SPEED_10G (1 << 6) 394 #define VNET_HW_INTERFACE_FLAG_SPEED_40G (1 << 7) 395 #define VNET_HW_INTERFACE_FLAG_SPEED_100G (1 << 8) 396 #define VNET_HW_INTERFACE_FLAG_SPEED_MASK \ 397 (VNET_HW_INTERFACE_FLAG_SPEED_10M | \ 398 VNET_HW_INTERFACE_FLAG_SPEED_100M | \ 399 VNET_HW_INTERFACE_FLAG_SPEED_1G | \ 400 VNET_HW_INTERFACE_FLAG_SPEED_10G | \ 401 VNET_HW_INTERFACE_FLAG_SPEED_40G | \ 402 VNET_HW_INTERFACE_FLAG_SPEED_100G) 405 #define VNET_HW_INTERFACE_FLAG_L2OUTPUT_SHIFT 9 406 #define VNET_HW_INTERFACE_FLAG_L2OUTPUT_MAPPED (1 << 9) 464 #define VNET_HW_INTERFACE_BOND_INFO_NONE ((uword *) 0) 465 #define VNET_HW_INTERFACE_BOND_INFO_SLAVE ((uword *) ~0) 531 vnet_sw_interface_type_t type:16;
536 #define VNET_SW_INTERFACE_FLAG_ADMIN_UP (1 << 0) 539 #define VNET_SW_INTERFACE_FLAG_PUNT (1 << 1) 541 #define VNET_SW_INTERFACE_FLAG_PROXY_ARP (1 << 2) 543 #define VNET_SW_INTERFACE_FLAG_UNNUMBERED (1 << 3) 545 #define VNET_SW_INTERFACE_FLAG_BOND_SLAVE (1 << 4) 548 #define VNET_SW_INTERFACE_FLAG_HIDDEN (1 << 5) 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.
uword( vlib_node_function_t)(struct vlib_main_t *vm, struct vlib_node_runtime_t *node, struct vlib_frame_t *frame)
volatile u32 * sw_if_counter_lock
vnet_hw_interface_nodes_t * deleted_hw_interface_nodes
enum vnet_hw_interface_class_flags_t_ vnet_hw_interface_class_flags_t
Attributes assignable to a HW interface Class.
PCAP utility definitions.
uword * sub_interface_sw_if_index_by_id
struct _vnet_device_class vnet_device_class_t
f64 max_rate_bits_per_sec
clib_error_t *( vnet_interface_set_mac_address_function_t)(struct vnet_hw_interface_t *hi, char *address)
vnet_flood_class_t flood_class
uword * pcap_drop_filter_hash
PCAP main state data structure.
vlib_combined_counter_main_t * combined_sw_if_counters
clib_error_t *( vnet_interface_function_t)(struct vnet_main_t *vnm, u32 if_index, u32 flags)
A collection of simple counters.
void vnet_pcap_drop_trace_filter_add_del(u32 error_index, int is_add)
u32 max_supported_packet_bytes
uword * hw_interface_by_name
vnet_l3_packet_type_t vnet_link_to_l3_proto(vnet_link_t link)
Convert a link to to an Ethertype.
static clib_error_t * link_up_down_function(vnet_main_t *vm, u32 hw_if_index, u32 flags)
vnet_hw_interface_t * hw_interfaces
uword * sw_if_index_by_sup_and_sub
vlib_simple_counter_main_t * sw_if_counters
vnet_device_class_t vnet_local_interface_device_class
vnet_interface_function_priority_t_
uword * hw_interface_class_by_name
u32 * input_node_cpu_index_by_queue
static clib_error_t * admin_up_down_function(vnet_main_t *vm, u32 hw_if_index, u32 flags)
vnet_link_t_
Link Type: A description of the protocol of packets on the link.
static void vnet_interface_counter_unlock(vnet_interface_main_t *im)
vnet_interface_counter_type_t
u32 unnumbered_sw_if_index
static void vnet_interface_counter_lock(vnet_interface_main_t *im)
enum vnet_interface_function_priority_t_ vnet_interface_function_priority_t
u8 output_feature_arc_index
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)
uword * device_class_by_name
struct vnet_hw_interface_t vnet_hw_interface_t
struct _vnet_hw_interface_class vnet_hw_interface_class_t
vnet_sw_interface_t * sw_interfaces
a point 2 point interface
vnet_hw_interface_class_t * hw_interface_classes
A collection of combined counters.
u32 min_supported_packet_bytes
vnet_device_class_t * device_classes
u32 per_packet_overhead_bytes
void default_update_adjacency(struct vnet_main_t *vnm, u32 sw_if_index, u32 adj_index)
Default adjacency update function.
int vnet_interface_name_renumber(u32 sw_if_index, u32 new_show_dev_instance)
vnet_hw_interface_class_flags_t_
Attributes assignable to a HW interface Class.