40 #ifndef included_vnet_interface_h 41 #define included_vnet_interface_h 49 struct ip46_address_t;
77 vnet_hw_interface_rx_mode mode);
84 #define VNET_ITF_FUNC_N_PRIO ((vnet_interface_function_priority_t)VNET_ITF_FUNC_PRIORITY_HIGH+1) 86 typedef struct _vnet_interface_function_list_elt
88 struct _vnet_interface_function_list_elt *next_interface_function;
90 } _vnet_interface_function_list_elt_t;
92 #define _VNET_INTERFACE_FUNCTION_DECL(f,tag) \ 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 = \ 102 vnm->tag##_functions[VNET_ITF_FUNC_PRIORITY_LOW]; \ 103 vnm->tag##_functions[VNET_ITF_FUNC_PRIORITY_LOW] = &init_function; \ 104 init_function.fp = (void *) &f; \ 107 #define _VNET_INTERFACE_FUNCTION_DECL_PRIO(f,tag,p) \ 109 static void __vnet_interface_function_init_##tag##_##f (void) \ 110 __attribute__((__constructor__)) ; \ 112 static void __vnet_interface_function_init_##tag##_##f (void) \ 114 vnet_main_t * vnm = vnet_get_main(); \ 115 static _vnet_interface_function_list_elt_t init_function; \ 116 init_function.next_interface_function = vnm->tag##_functions[p]; \ 117 vnm->tag##_functions[p] = &init_function; \ 118 init_function.fp = (void *) &f; \ 121 #define VNET_HW_INTERFACE_ADD_DEL_FUNCTION(f) \ 122 _VNET_INTERFACE_FUNCTION_DECL(f,hw_interface_add_del) 123 #define VNET_HW_INTERFACE_LINK_UP_DOWN_FUNCTION(f) \ 124 _VNET_INTERFACE_FUNCTION_DECL(f,hw_interface_link_up_down) 125 #define VNET_HW_INTERFACE_LINK_UP_DOWN_FUNCTION_PRIO(f,p) \ 126 _VNET_INTERFACE_FUNCTION_DECL_PRIO(f,hw_interface_link_up_down,p) 127 #define VNET_SW_INTERFACE_ADD_DEL_FUNCTION(f) \ 128 _VNET_INTERFACE_FUNCTION_DECL(f,sw_interface_add_del) 129 #define VNET_SW_INTERFACE_ADMIN_UP_DOWN_FUNCTION(f) \ 130 _VNET_INTERFACE_FUNCTION_DECL(f,sw_interface_admin_up_down) 131 #define VNET_SW_INTERFACE_ADMIN_UP_DOWN_FUNCTION_PRIO(f,p) \ 132 _VNET_INTERFACE_FUNCTION_DECL_PRIO(f,sw_interface_admin_up_down, p) 135 typedef struct _vnet_device_class
162 char **tx_function_error_strings;
165 u32 tx_function_n_errors;
169 u32 new_dev_instance);
184 void (*clear_counters) (
u32 dev_class_instance);
192 u32 hw_if_index,
u32 new_hw_class_index);
195 void (*rx_redirect_to_node) (
struct vnet_main_t * vnm,
196 u32 hw_if_index,
u32 node_index);
199 struct _vnet_device_class *next_class_registration;
205 #define VNET_DEVICE_CLASS(x,...) \ 206 __VA_ARGS__ vnet_device_class_t x; \ 207 static void __vnet_add_device_class_registration_##x (void) \ 208 __attribute__((__constructor__)) ; \ 209 static void __vnet_add_device_class_registration_##x (void) \ 211 vnet_main_t * vnm = vnet_get_main(); \ 212 x.next_class_registration = vnm->device_class_registrations; \ 213 vnm->device_class_registrations = &x; \ 215 __VA_ARGS__ vnet_device_class_t x 217 #define VLIB_DEVICE_TX_FUNCTION_CLONE_TEMPLATE(arch, fn, tgt) \ 219 __attribute__ ((flatten)) \ 220 __attribute__ ((target (tgt))) \ 222 fn ## _ ## arch ( vlib_main_t * vm, \ 223 vlib_node_runtime_t * node, \ 224 vlib_frame_t * frame) \ 225 { return fn (vm, node, frame); } 227 #define VLIB_DEVICE_TX_FUNCTION_MULTIARCH_CLONE(fn) \ 228 foreach_march_variant(VLIB_DEVICE_TX_FUNCTION_CLONE_TEMPLATE, fn) 231 #define VLIB_MULTIARCH_CLONE_AND_SELECT_FN(fn,...) 232 #define VLIB_DEVICE_TX_FUNCTION_MULTIARCH(dev, fn) 234 #define VLIB_DEVICE_TX_FUNCTION_MULTIARCH(dev, fn) \ 235 VLIB_DEVICE_TX_FUNCTION_MULTIARCH_CLONE(fn) \ 236 CLIB_MULTIARCH_SELECT_FN(fn, static inline) \ 237 static void __attribute__((__constructor__)) \ 238 __vlib_device_tx_function_multiarch_select_##dev (void) \ 239 { dev.tx_function = fn ## _multiarch_select(); } 259 } __attribute__ ((packed)) vnet_link_t;
261 #define VNET_LINKS { \ 262 [VNET_LINK_ETHERNET] = "ethernet", \ 263 [VNET_LINK_IP4] = "ipv4", \ 264 [VNET_LINK_IP6] = "ipv6", \ 265 [VNET_LINK_MPLS] = "mpls", \ 266 [VNET_LINK_ARP] = "arp", \ 267 [VNET_LINK_NSH] = "nsh", \ 274 #define VNET_LINK_NUM (VNET_LINK_NSH+1) 293 typedef struct _vnet_hw_interface_class
338 vnet_link_t link_type,
const void *dst_hw_address);
342 void (*update_adjacency) (
struct vnet_main_t * vnm,
343 u32 sw_if_index,
u32 adj_index);
351 void (*hw_class_change) (
struct vnet_main_t * vnm,
u32 hw_if_index,
352 u32 old_class_index,
u32 new_class_index);
355 struct _vnet_hw_interface_class *next_class_registration;
364 vnet_link_t link_type,
365 const void *dst_hw_address);
371 u32 sw_if_index,
u32 adj_index);
373 #define VNET_HW_INTERFACE_CLASS(x,...) \ 374 __VA_ARGS__ vnet_hw_interface_class_t x; \ 375 static void __vnet_add_hw_interface_class_registration_##x (void) \ 376 __attribute__((__constructor__)) ; \ 377 static void __vnet_add_hw_interface_class_registration_##x (void) \ 379 vnet_main_t * vnm = vnet_get_main(); \ 380 x.next_class_registration = vnm->hw_interface_class_registrations; \ 381 vnm->hw_interface_class_registrations = &x; \ 383 __VA_ARGS__ vnet_hw_interface_class_t x 394 #define VNET_HW_INTERFACE_FLAG_LINK_UP (1 << 0) 396 #define VNET_HW_INTERFACE_FLAG_DUPLEX_SHIFT 1 397 #define VNET_HW_INTERFACE_FLAG_HALF_DUPLEX (1 << 1) 398 #define VNET_HW_INTERFACE_FLAG_FULL_DUPLEX (1 << 2) 399 #define VNET_HW_INTERFACE_FLAG_DUPLEX_MASK \ 400 (VNET_HW_INTERFACE_FLAG_HALF_DUPLEX | \ 401 VNET_HW_INTERFACE_FLAG_FULL_DUPLEX) 404 #define VNET_HW_INTERFACE_FLAG_SPEED_SHIFT 3 405 #define VNET_HW_INTERFACE_FLAG_SPEED_10M (1 << 3) 406 #define VNET_HW_INTERFACE_FLAG_SPEED_100M (1 << 4) 407 #define VNET_HW_INTERFACE_FLAG_SPEED_1G (1 << 5) 408 #define VNET_HW_INTERFACE_FLAG_SPEED_10G (1 << 6) 409 #define VNET_HW_INTERFACE_FLAG_SPEED_40G (1 << 7) 410 #define VNET_HW_INTERFACE_FLAG_SPEED_100G (1 << 8) 411 #define VNET_HW_INTERFACE_FLAG_SPEED_MASK \ 412 (VNET_HW_INTERFACE_FLAG_SPEED_10M | \ 413 VNET_HW_INTERFACE_FLAG_SPEED_100M | \ 414 VNET_HW_INTERFACE_FLAG_SPEED_1G | \ 415 VNET_HW_INTERFACE_FLAG_SPEED_10G | \ 416 VNET_HW_INTERFACE_FLAG_SPEED_40G | \ 417 VNET_HW_INTERFACE_FLAG_SPEED_100G) 420 #define VNET_HW_INTERFACE_FLAG_SUPPORTS_INT_MODE (1 << 10) 423 #define VNET_HW_INTERFACE_FLAG_SUPPORTS_TX_L4_CKSUM_OFFLOAD (1 << 11) 485 #define VNET_HW_INTERFACE_BOND_INFO_NONE ((uword *) 0) 486 #define VNET_HW_INTERFACE_BOND_INFO_SLAVE ((uword *) ~0) 571 vnet_sw_interface_type_t type:16;
576 #define VNET_SW_INTERFACE_FLAG_ADMIN_UP (1 << 0) 579 #define VNET_SW_INTERFACE_FLAG_PUNT (1 << 1) 581 #define VNET_SW_INTERFACE_FLAG_PROXY_ARP (1 << 2) 583 #define VNET_SW_INTERFACE_FLAG_UNNUMBERED (1 << 3) 585 #define VNET_SW_INTERFACE_FLAG_BOND_SLAVE (1 << 4) 588 #define VNET_SW_INTERFACE_FLAG_HIDDEN (1 << 5) 591 #define VNET_SW_INTERFACE_FLAG_ERROR (1 << 6) 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
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
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)
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
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)
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
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.