40 #ifndef included_vnet_interface_h 41 #define included_vnet_interface_h 49 struct ip46_address_t;
77 vnet_hw_interface_rx_mode mode);
89 #define VNET_ITF_FUNC_N_PRIO ((vnet_interface_function_priority_t)VNET_ITF_FUNC_PRIORITY_HIGH+1) 91 typedef struct _vnet_interface_function_list_elt
93 struct _vnet_interface_function_list_elt *next_interface_function;
95 } _vnet_interface_function_list_elt_t;
97 #define _VNET_INTERFACE_FUNCTION_DECL_PRIO(f,tag,p) \ 99 static void __vnet_interface_function_init_##tag##_##f (void) \ 100 __attribute__((__constructor__)) ; \ 102 static void __vnet_interface_function_init_##tag##_##f (void) \ 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; \ 111 #define _VNET_INTERFACE_FUNCTION_DECL(f,tag) \ 112 _VNET_INTERFACE_FUNCTION_DECL_PRIO(f,tag,VNET_ITF_FUNC_PRIORITY_LOW) 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) 128 typedef struct _vnet_device_class
158 char **tx_function_error_strings;
161 u32 tx_function_n_errors;
165 u32 new_dev_instance);
180 void (*clear_counters) (
u32 dev_class_instance);
188 u32 hw_if_index,
u32 new_hw_class_index);
191 void (*rx_redirect_to_node) (
struct vnet_main_t * vnm,
192 u32 hw_if_index,
u32 node_index);
195 struct _vnet_device_class *next_class_registration;
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) \ 207 vnet_main_t * vnm = vnet_get_main(); \ 208 x.next_class_registration = vnm->device_class_registrations; \ 209 vnm->device_class_registrations = &x; \ 211 __VA_ARGS__ vnet_device_class_t x 213 #define VLIB_DEVICE_TX_FUNCTION_CLONE_TEMPLATE(arch, fn, tgt) \ 215 __attribute__ ((flatten)) \ 216 __attribute__ ((target (tgt))) \ 218 fn ## _ ## arch ( vlib_main_t * vm, \ 219 vlib_node_runtime_t * node, \ 220 vlib_frame_t * frame) \ 221 { return fn (vm, node, frame); } 223 #define VLIB_DEVICE_TX_FUNCTION_MULTIARCH_CLONE(fn) \ 224 foreach_march_variant(VLIB_DEVICE_TX_FUNCTION_CLONE_TEMPLATE, fn) 227 #define VLIB_MULTIARCH_CLONE_AND_SELECT_FN(fn,...) 228 #define VLIB_DEVICE_TX_FUNCTION_MULTIARCH(dev, fn) 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(); } 255 } __attribute__ ((packed)) vnet_link_t;
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", \ 270 #define VNET_LINK_NUM (VNET_LINK_NSH+1) 289 typedef struct _vnet_hw_interface_class
334 vnet_link_t link_type,
const void *dst_hw_address);
338 void (*update_adjacency) (
struct vnet_main_t * vnm,
339 u32 sw_if_index,
u32 adj_index);
347 void (*hw_class_change) (
struct vnet_main_t * vnm,
u32 hw_if_index,
348 u32 old_class_index,
u32 new_class_index);
351 struct _vnet_hw_interface_class *next_class_registration;
360 vnet_link_t link_type,
361 const void *dst_hw_address);
367 u32 sw_if_index,
u32 adj_index);
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) \ 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; \ 379 __VA_ARGS__ vnet_hw_interface_class_t x 390 #define VNET_HW_INTERFACE_FLAG_LINK_UP (1 << 0) 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) 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) 428 #define VNET_HW_INTERFACE_FLAG_SUPPORTS_INT_MODE (1 << 16) 431 #define VNET_HW_INTERFACE_FLAG_SUPPORTS_TX_L4_CKSUM_OFFLOAD (1 << 17) 493 #define VNET_HW_INTERFACE_BOND_INFO_NONE ((uword *) 0) 494 #define VNET_HW_INTERFACE_BOND_INFO_SLAVE ((uword *) ~0) 583 vnet_sw_interface_type_t type:16;
588 #define VNET_SW_INTERFACE_FLAG_ADMIN_UP (1 << 0) 591 #define VNET_SW_INTERFACE_FLAG_PUNT (1 << 1) 593 #define VNET_SW_INTERFACE_FLAG_PROXY_ARP (1 << 2) 595 #define VNET_SW_INTERFACE_FLAG_UNNUMBERED (1 << 3) 597 #define VNET_SW_INTERFACE_FLAG_BOND_SLAVE (1 << 4) 600 #define VNET_SW_INTERFACE_FLAG_HIDDEN (1 << 5) 603 #define VNET_SW_INTERFACE_FLAG_ERROR (1 << 6) 658 #define foreach_rx_combined_interface_counter(_x) \ 659 for (_x = VNET_INTERFACE_COUNTER_RX; \ 660 _x <= VNET_INTERFACE_COUNTER_RX_BROADCAST; \ 663 #define foreach_tx_combined_interface_counter(_x) \ 664 for (_x = VNET_INTERFACE_COUNTER_TX; \ 665 _x <= VNET_INTERFACE_COUNTER_TX_BROADCAST; \ 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.
void collect_detailed_interface_stats_flag_set(void)
volatile u32 * sw_if_counter_lock
vnet_hw_interface_nodes_t * deleted_hw_interface_nodes
vnet_p2p_sub_interface_t p2p
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
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)
uword * sub_interface_sw_if_index_by_id
struct _vnet_device_class vnet_device_class_t
uword * dq_runtime_index_by_queue
vnet_interface_stats_collection_mode_e
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_hw_interface_rx_mode
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)
int collect_detailed_interface_stats_flag
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
uword( vlib_node_function_t)(struct vlib_main_t *vm, struct vlib_node_runtime_t *node, struct vlib_frame_t *frame)
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)
static int collect_detailed_interface_stats(void)
vnet_interface_counter_type_t
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)
u32 unnumbered_sw_if_index
static void vnet_interface_counter_lock(vnet_interface_main_t *im)
u32 output_node_next_index
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_hw_interface_rx_mode default_rx_mode
vnet_device_class_t * device_classes
void collect_detailed_interface_stats_flag_clear(void)
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.