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;
202 u8 flatten_output_chains;
208 #define VNET_DEVICE_CLASS(x,...) \ 209 __VA_ARGS__ vnet_device_class_t x; \ 210 static void __vnet_add_device_class_registration_##x (void) \ 211 __attribute__((__constructor__)) ; \ 212 static void __vnet_add_device_class_registration_##x (void) \ 214 vnet_main_t * vnm = vnet_get_main(); \ 215 x.next_class_registration = vnm->device_class_registrations; \ 216 vnm->device_class_registrations = &x; \ 218 __VA_ARGS__ vnet_device_class_t x 220 #define VLIB_DEVICE_TX_FUNCTION_CLONE_TEMPLATE(arch, fn, tgt) \ 222 __attribute__ ((flatten)) \ 223 __attribute__ ((target (tgt))) \ 225 fn ## _ ## arch ( vlib_main_t * vm, \ 226 vlib_node_runtime_t * node, \ 227 vlib_frame_t * frame) \ 228 { return fn (vm, node, frame); } 230 #define VLIB_DEVICE_TX_FUNCTION_MULTIARCH_CLONE(fn) \ 231 foreach_march_variant(VLIB_DEVICE_TX_FUNCTION_CLONE_TEMPLATE, fn) 234 #define VLIB_MULTIARCH_CLONE_AND_SELECT_FN(fn,...) 235 #define VLIB_DEVICE_TX_FUNCTION_MULTIARCH(dev, fn) 237 #define VLIB_DEVICE_TX_FUNCTION_MULTIARCH(dev, fn) \ 238 VLIB_DEVICE_TX_FUNCTION_MULTIARCH_CLONE(fn) \ 239 CLIB_MULTIARCH_SELECT_FN(fn, static inline) \ 240 static void __attribute__((__constructor__)) \ 241 __vlib_device_tx_function_multiarch_select_##dev (void) \ 242 { dev.tx_function = fn ## _multiarch_select(); } 262 } __attribute__ ((packed)) vnet_link_t;
264 #define VNET_LINKS { \ 265 [VNET_LINK_ETHERNET] = "ethernet", \ 266 [VNET_LINK_IP4] = "ipv4", \ 267 [VNET_LINK_IP6] = "ipv6", \ 268 [VNET_LINK_MPLS] = "mpls", \ 269 [VNET_LINK_ARP] = "arp", \ 270 [VNET_LINK_NSH] = "nsh", \ 277 #define VNET_LINK_NUM (VNET_LINK_NSH+1) 296 typedef struct _vnet_hw_interface_class
341 vnet_link_t link_type,
const void *dst_hw_address);
345 void (*update_adjacency) (
struct vnet_main_t * vnm,
346 u32 sw_if_index,
u32 adj_index);
354 void (*hw_class_change) (
struct vnet_main_t * vnm,
u32 hw_if_index,
355 u32 old_class_index,
u32 new_class_index);
358 struct _vnet_hw_interface_class *next_class_registration;
367 vnet_link_t link_type,
368 const void *dst_hw_address);
374 u32 sw_if_index,
u32 adj_index);
376 #define VNET_HW_INTERFACE_CLASS(x,...) \ 377 __VA_ARGS__ vnet_hw_interface_class_t x; \ 378 static void __vnet_add_hw_interface_class_registration_##x (void) \ 379 __attribute__((__constructor__)) ; \ 380 static void __vnet_add_hw_interface_class_registration_##x (void) \ 382 vnet_main_t * vnm = vnet_get_main(); \ 383 x.next_class_registration = vnm->hw_interface_class_registrations; \ 384 vnm->hw_interface_class_registrations = &x; \ 386 __VA_ARGS__ vnet_hw_interface_class_t x 397 #define VNET_HW_INTERFACE_FLAG_LINK_UP (1 << 0) 399 #define VNET_HW_INTERFACE_FLAG_DUPLEX_SHIFT 1 400 #define VNET_HW_INTERFACE_FLAG_HALF_DUPLEX (1 << 1) 401 #define VNET_HW_INTERFACE_FLAG_FULL_DUPLEX (1 << 2) 402 #define VNET_HW_INTERFACE_FLAG_DUPLEX_MASK \ 403 (VNET_HW_INTERFACE_FLAG_HALF_DUPLEX | \ 404 VNET_HW_INTERFACE_FLAG_FULL_DUPLEX) 407 #define VNET_HW_INTERFACE_FLAG_SPEED_SHIFT 3 408 #define VNET_HW_INTERFACE_FLAG_SPEED_10M (1 << 3) 409 #define VNET_HW_INTERFACE_FLAG_SPEED_100M (1 << 4) 410 #define VNET_HW_INTERFACE_FLAG_SPEED_1G (1 << 5) 411 #define VNET_HW_INTERFACE_FLAG_SPEED_10G (1 << 6) 412 #define VNET_HW_INTERFACE_FLAG_SPEED_40G (1 << 7) 413 #define VNET_HW_INTERFACE_FLAG_SPEED_100G (1 << 8) 414 #define VNET_HW_INTERFACE_FLAG_SPEED_MASK \ 415 (VNET_HW_INTERFACE_FLAG_SPEED_10M | \ 416 VNET_HW_INTERFACE_FLAG_SPEED_100M | \ 417 VNET_HW_INTERFACE_FLAG_SPEED_1G | \ 418 VNET_HW_INTERFACE_FLAG_SPEED_10G | \ 419 VNET_HW_INTERFACE_FLAG_SPEED_40G | \ 420 VNET_HW_INTERFACE_FLAG_SPEED_100G) 423 #define VNET_HW_INTERFACE_FLAG_SUPPORTS_INT_MODE (1 << 10) 481 #define VNET_HW_INTERFACE_BOND_INFO_NONE ((uword *) 0) 482 #define VNET_HW_INTERFACE_BOND_INFO_SLAVE ((uword *) ~0) 555 vnet_sw_interface_type_t type:16;
560 #define VNET_SW_INTERFACE_FLAG_ADMIN_UP (1 << 0) 563 #define VNET_SW_INTERFACE_FLAG_PUNT (1 << 1) 565 #define VNET_SW_INTERFACE_FLAG_PROXY_ARP (1 << 2) 567 #define VNET_SW_INTERFACE_FLAG_UNNUMBERED (1 << 3) 569 #define VNET_SW_INTERFACE_FLAG_BOND_SLAVE (1 << 4) 572 #define VNET_SW_INTERFACE_FLAG_HIDDEN (1 << 5) 575 #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
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)
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.