FD.io VPP  v17.07-30-g839fa73
Vector Packet Processing
interface.h File Reference
+ Include dependency graph for interface.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  vnet_hw_interface_t
 
struct  vnet_sub_interface_t
 
struct  vnet_sw_interface_t
 
struct  vnet_hw_interface_nodes_t
 
struct  vnet_interface_main_t
 

Macros

#define VNET_ITF_FUNC_N_PRIO   ((vnet_interface_function_priority_t)VNET_ITF_FUNC_PRIORITY_HIGH+1)
 
#define VNET_HW_INTERFACE_ADD_DEL_FUNCTION(f)   _VNET_INTERFACE_FUNCTION_DECL(f,hw_interface_add_del)
 
#define VNET_HW_INTERFACE_LINK_UP_DOWN_FUNCTION(f)   _VNET_INTERFACE_FUNCTION_DECL(f,hw_interface_link_up_down)
 
#define VNET_HW_INTERFACE_LINK_UP_DOWN_FUNCTION_PRIO(f, p)   _VNET_INTERFACE_FUNCTION_DECL_PRIO(f,hw_interface_link_up_down,p)
 
#define VNET_SW_INTERFACE_ADD_DEL_FUNCTION(f)   _VNET_INTERFACE_FUNCTION_DECL(f,sw_interface_add_del)
 
#define VNET_SW_INTERFACE_ADMIN_UP_DOWN_FUNCTION(f)   _VNET_INTERFACE_FUNCTION_DECL(f,sw_interface_admin_up_down)
 
#define VNET_SW_INTERFACE_ADMIN_UP_DOWN_FUNCTION_PRIO(f, p)   _VNET_INTERFACE_FUNCTION_DECL_PRIO(f,sw_interface_admin_up_down, p)
 
#define VNET_DEVICE_CLASS(x, ...)
 
#define VLIB_DEVICE_TX_FUNCTION_CLONE_TEMPLATE(arch, fn, tgt)
 
#define VLIB_DEVICE_TX_FUNCTION_MULTIARCH_CLONE(fn)   foreach_march_variant(VLIB_DEVICE_TX_FUNCTION_CLONE_TEMPLATE, fn)
 
#define VLIB_MULTIARCH_CLONE_AND_SELECT_FN(fn, ...)
 
#define VLIB_DEVICE_TX_FUNCTION_MULTIARCH(dev, fn)
 
#define VNET_LINKS
 
#define VNET_LINK_NUM   (VNET_LINK_NSH+1)
 Number of link types. More...
 
#define VNET_HW_INTERFACE_CLASS(x, ...)
 
#define VNET_HW_INTERFACE_FLAG_LINK_UP   (1 << 0)
 
#define VNET_HW_INTERFACE_FLAG_DUPLEX_SHIFT   1
 
#define VNET_HW_INTERFACE_FLAG_HALF_DUPLEX   (1 << 1)
 
#define VNET_HW_INTERFACE_FLAG_FULL_DUPLEX   (1 << 2)
 
#define VNET_HW_INTERFACE_FLAG_DUPLEX_MASK
 
#define VNET_HW_INTERFACE_FLAG_SPEED_SHIFT   3
 
#define VNET_HW_INTERFACE_FLAG_SPEED_10M   (1 << 3)
 
#define VNET_HW_INTERFACE_FLAG_SPEED_100M   (1 << 4)
 
#define VNET_HW_INTERFACE_FLAG_SPEED_1G   (1 << 5)
 
#define VNET_HW_INTERFACE_FLAG_SPEED_10G   (1 << 6)
 
#define VNET_HW_INTERFACE_FLAG_SPEED_40G   (1 << 7)
 
#define VNET_HW_INTERFACE_FLAG_SPEED_100G   (1 << 8)
 
#define VNET_HW_INTERFACE_FLAG_SPEED_MASK
 
#define VNET_HW_INTERFACE_FLAG_SUPPORTS_INT_MODE   (1 << 10)
 
#define VNET_HW_INTERFACE_BOND_INFO_NONE   ((uword *) 0)
 
#define VNET_HW_INTERFACE_BOND_INFO_SLAVE   ((uword *) ~0)
 
#define VNET_SW_INTERFACE_FLAG_ADMIN_UP   (1 << 0)
 
#define VNET_SW_INTERFACE_FLAG_PUNT   (1 << 1)
 
#define VNET_SW_INTERFACE_FLAG_PROXY_ARP   (1 << 2)
 
#define VNET_SW_INTERFACE_FLAG_UNNUMBERED   (1 << 3)
 
#define VNET_SW_INTERFACE_FLAG_BOND_SLAVE   (1 << 4)
 
#define VNET_SW_INTERFACE_FLAG_HIDDEN   (1 << 5)
 
#define VNET_SW_INTERFACE_FLAG_ERROR   (1 << 6)
 

Typedefs

typedef clib_error_t *( vnet_interface_function_t) (struct vnet_main_t *vnm, u32 if_index, u32 flags)
 
typedef 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)
 
typedef clib_error_t *( vnet_interface_set_mac_address_function_t) (struct vnet_hw_interface_t *hi, char *address)
 
typedef 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)
 
typedef enum vnet_interface_function_priority_t_ vnet_interface_function_priority_t
 
typedef struct _vnet_device_class vnet_device_class_t
 
typedef enum vnet_link_t_ vnet_link_t
 Link Type: A description of the protocol of packets on the link. More...
 
typedef enum vnet_hw_interface_class_flags_t_ vnet_hw_interface_class_flags_t
 Attributes assignable to a HW interface Class. More...
 
typedef struct _vnet_hw_interface_class vnet_hw_interface_class_t
 
typedef struct vnet_hw_interface_t vnet_hw_interface_t
 

Enumerations

enum  vnet_hw_interface_rx_mode {
  VNET_HW_INTERFACE_RX_MODE_UNKNOWN, VNET_HW_INTERFACE_RX_MODE_POLLING, VNET_HW_INTERFACE_RX_MODE_INTERRUPT, VNET_HW_INTERFACE_RX_MODE_ADAPTIVE,
  VNET_HW_INTERFACE_RX_MODE_DEFAULT, VNET_HW_INTERFACE_NUM_RX_MODES
}
 
enum  vnet_interface_function_priority_t_ { VNET_ITF_FUNC_PRIORITY_LOW, VNET_ITF_FUNC_PRIORITY_HIGH }
 
enum  vnet_link_t_ {
  VNET_LINK_IP4 = 1, VNET_LINK_IP6, VNET_LINK_MPLS, VNET_LINK_ETHERNET,
  VNET_LINK_ARP, VNET_LINK_NSH
}
 Link Type: A description of the protocol of packets on the link. More...
 
enum  vnet_hw_interface_class_flags_t_ { VNET_HW_INTERFACE_CLASS_FLAG_P2P = (1 << 0) }
 Attributes assignable to a HW interface Class. More...
 
enum  vnet_sw_interface_type_t { VNET_SW_INTERFACE_TYPE_HARDWARE, VNET_SW_INTERFACE_TYPE_SUB }
 
enum  vnet_flood_class_t { VNET_FLOOD_CLASS_NORMAL, VNET_FLOOD_CLASS_TUNNEL_MASTER, VNET_FLOOD_CLASS_TUNNEL_NORMAL }
 
enum  vnet_interface_counter_type_t {
  VNET_INTERFACE_COUNTER_DROP = 0, VNET_INTERFACE_COUNTER_PUNT = 1, VNET_INTERFACE_COUNTER_IP4 = 2, VNET_INTERFACE_COUNTER_IP6 = 3,
  VNET_INTERFACE_COUNTER_RX_NO_BUF = 4, VNET_INTERFACE_COUNTER_RX_MISS = 5, VNET_INTERFACE_COUNTER_RX_ERROR = 6, VNET_INTERFACE_COUNTER_TX_ERROR = 7,
  VNET_INTERFACE_COUNTER_MPLS = 8, VNET_N_SIMPLE_INTERFACE_COUNTER = 9, VNET_INTERFACE_COUNTER_RX = 0, VNET_INTERFACE_COUNTER_TX = 1,
  VNET_N_COMBINED_INTERFACE_COUNTER = 2
}
 

Functions

vnet_l3_packet_type_t vnet_link_to_l3_proto (vnet_link_t link)
 Convert a link to to an Ethertype. More...
 
u8default_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. More...
 
void default_update_adjacency (struct vnet_main_t *vnm, u32 sw_if_index, u32 adj_index)
 Default adjacency update function. More...
 
static void vnet_interface_counter_lock (vnet_interface_main_t *im)
 
static void vnet_interface_counter_unlock (vnet_interface_main_t *im)
 
void vnet_pcap_drop_trace_filter_add_del (u32 error_index, int is_add)
 
int vnet_interface_name_renumber (u32 sw_if_index, u32 new_show_dev_instance)
 

Variables

vnet_device_class_t vnet_local_interface_device_class
 

Macro Definition Documentation

#define VLIB_DEVICE_TX_FUNCTION_CLONE_TEMPLATE (   arch,
  fn,
  tgt 
)
Value:
uword \
__attribute__ ((flatten)) \
__attribute__ ((target (tgt))) \
CLIB_CPU_OPTIMIZED \
fn ## _ ## arch ( vlib_main_t * vm, \
vlib_frame_t * frame) \
{ return fn (vm, node, frame); }

Definition at line 220 of file interface.h.

#define VLIB_DEVICE_TX_FUNCTION_MULTIARCH (   dev,
  fn 
)

Definition at line 235 of file interface.h.

#define VLIB_DEVICE_TX_FUNCTION_MULTIARCH_CLONE (   fn)    foreach_march_variant(VLIB_DEVICE_TX_FUNCTION_CLONE_TEMPLATE, fn)

Definition at line 230 of file interface.h.

#define VLIB_MULTIARCH_CLONE_AND_SELECT_FN (   fn,
  ... 
)

Definition at line 234 of file interface.h.

#define VNET_DEVICE_CLASS (   x,
  ... 
)
Value:
__VA_ARGS__ vnet_device_class_t x; \
static void __vnet_add_device_class_registration_##x (void) \
__attribute__((__constructor__)) ; \
static void __vnet_add_device_class_registration_##x (void) \
{ \
x.next_class_registration = vnm->device_class_registrations; \
vnm->device_class_registrations = &x; \
} \
__VA_ARGS__ vnet_device_class_t x
vnet_main_t * vnet_get_main(void)
Definition: misc.c:46
struct _vnet_device_class vnet_device_class_t
struct vnet_main_t vnet_main_t

Definition at line 208 of file interface.h.

#define VNET_HW_INTERFACE_ADD_DEL_FUNCTION (   f)    _VNET_INTERFACE_FUNCTION_DECL(f,hw_interface_add_del)

Definition at line 121 of file interface.h.

#define VNET_HW_INTERFACE_BOND_INFO_NONE   ((uword *) 0)

Definition at line 481 of file interface.h.

#define VNET_HW_INTERFACE_BOND_INFO_SLAVE   ((uword *) ~0)

Definition at line 482 of file interface.h.

#define VNET_HW_INTERFACE_CLASS (   x,
  ... 
)
Value:
__VA_ARGS__ vnet_hw_interface_class_t x; \
static void __vnet_add_hw_interface_class_registration_##x (void) \
__attribute__((__constructor__)) ; \
static void __vnet_add_hw_interface_class_registration_##x (void) \
{ \
x.next_class_registration = vnm->hw_interface_class_registrations; \
vnm->hw_interface_class_registrations = &x; \
} \
vnet_main_t * vnet_get_main(void)
Definition: misc.c:46
struct _vnet_hw_interface_class vnet_hw_interface_class_t
struct vnet_main_t vnet_main_t

Definition at line 376 of file interface.h.

#define VNET_HW_INTERFACE_FLAG_DUPLEX_MASK
Value:
#define VNET_HW_INTERFACE_FLAG_HALF_DUPLEX
Definition: interface.h:400
#define VNET_HW_INTERFACE_FLAG_FULL_DUPLEX
Definition: interface.h:401

Definition at line 402 of file interface.h.

#define VNET_HW_INTERFACE_FLAG_DUPLEX_SHIFT   1

Definition at line 399 of file interface.h.

#define VNET_HW_INTERFACE_FLAG_FULL_DUPLEX   (1 << 2)

Definition at line 401 of file interface.h.

#define VNET_HW_INTERFACE_FLAG_HALF_DUPLEX   (1 << 1)

Definition at line 400 of file interface.h.

#define VNET_HW_INTERFACE_FLAG_LINK_UP   (1 << 0)

Definition at line 397 of file interface.h.

#define VNET_HW_INTERFACE_FLAG_SPEED_100G   (1 << 8)

Definition at line 413 of file interface.h.

#define VNET_HW_INTERFACE_FLAG_SPEED_100M   (1 << 4)

Definition at line 409 of file interface.h.

#define VNET_HW_INTERFACE_FLAG_SPEED_10G   (1 << 6)

Definition at line 411 of file interface.h.

#define VNET_HW_INTERFACE_FLAG_SPEED_10M   (1 << 3)

Definition at line 408 of file interface.h.

#define VNET_HW_INTERFACE_FLAG_SPEED_1G   (1 << 5)

Definition at line 410 of file interface.h.

#define VNET_HW_INTERFACE_FLAG_SPEED_40G   (1 << 7)

Definition at line 412 of file interface.h.

#define VNET_HW_INTERFACE_FLAG_SPEED_MASK
Value:
#define VNET_HW_INTERFACE_FLAG_SPEED_1G
Definition: interface.h:410
#define VNET_HW_INTERFACE_FLAG_SPEED_100G
Definition: interface.h:413
#define VNET_HW_INTERFACE_FLAG_SPEED_10M
Definition: interface.h:408
#define VNET_HW_INTERFACE_FLAG_SPEED_10G
Definition: interface.h:411
#define VNET_HW_INTERFACE_FLAG_SPEED_100M
Definition: interface.h:409
#define VNET_HW_INTERFACE_FLAG_SPEED_40G
Definition: interface.h:412

Definition at line 414 of file interface.h.

#define VNET_HW_INTERFACE_FLAG_SPEED_SHIFT   3

Definition at line 407 of file interface.h.

#define VNET_HW_INTERFACE_FLAG_SUPPORTS_INT_MODE   (1 << 10)

Definition at line 423 of file interface.h.

#define VNET_HW_INTERFACE_LINK_UP_DOWN_FUNCTION (   f)    _VNET_INTERFACE_FUNCTION_DECL(f,hw_interface_link_up_down)

Definition at line 123 of file interface.h.

#define VNET_HW_INTERFACE_LINK_UP_DOWN_FUNCTION_PRIO (   f,
 
)    _VNET_INTERFACE_FUNCTION_DECL_PRIO(f,hw_interface_link_up_down,p)

Definition at line 125 of file interface.h.

#define VNET_ITF_FUNC_N_PRIO   ((vnet_interface_function_priority_t)VNET_ITF_FUNC_PRIORITY_HIGH+1)

Definition at line 84 of file interface.h.

#define VNET_LINK_NUM   (VNET_LINK_NSH+1)

Number of link types.

Not part of the enum so it does not have to be included in switch statements

Definition at line 277 of file interface.h.

#define VNET_LINKS
Value:
{ \
[VNET_LINK_ETHERNET] = "ethernet", \
[VNET_LINK_IP4] = "ipv4", \
[VNET_LINK_IP6] = "ipv6", \
[VNET_LINK_MPLS] = "mpls", \
[VNET_LINK_ARP] = "arp", \
[VNET_LINK_NSH] = "nsh", \
}

Definition at line 264 of file interface.h.

#define VNET_SW_INTERFACE_ADD_DEL_FUNCTION (   f)    _VNET_INTERFACE_FUNCTION_DECL(f,sw_interface_add_del)

Definition at line 127 of file interface.h.

#define VNET_SW_INTERFACE_ADMIN_UP_DOWN_FUNCTION (   f)    _VNET_INTERFACE_FUNCTION_DECL(f,sw_interface_admin_up_down)

Definition at line 129 of file interface.h.

#define VNET_SW_INTERFACE_ADMIN_UP_DOWN_FUNCTION_PRIO (   f,
 
)    _VNET_INTERFACE_FUNCTION_DECL_PRIO(f,sw_interface_admin_up_down, p)

Definition at line 131 of file interface.h.

#define VNET_SW_INTERFACE_FLAG_ADMIN_UP   (1 << 0)

Definition at line 560 of file interface.h.

#define VNET_SW_INTERFACE_FLAG_BOND_SLAVE   (1 << 4)

Definition at line 569 of file interface.h.

#define VNET_SW_INTERFACE_FLAG_ERROR   (1 << 6)

Definition at line 575 of file interface.h.

#define VNET_SW_INTERFACE_FLAG_HIDDEN   (1 << 5)

Definition at line 572 of file interface.h.

#define VNET_SW_INTERFACE_FLAG_PROXY_ARP   (1 << 2)

Definition at line 565 of file interface.h.

#define VNET_SW_INTERFACE_FLAG_PUNT   (1 << 1)

Definition at line 563 of file interface.h.

#define VNET_SW_INTERFACE_FLAG_UNNUMBERED   (1 << 3)

Definition at line 567 of file interface.h.

Typedef Documentation

typedef struct _vnet_device_class vnet_device_class_t

Attributes assignable to a HW interface Class.

typedef struct _vnet_hw_interface_class vnet_hw_interface_class_t
typedef clib_error_t*( vnet_interface_function_t) (struct vnet_main_t *vnm, u32 if_index, u32 flags)

Definition at line 63 of file interface.h.

typedef clib_error_t*( vnet_interface_set_mac_address_function_t) (struct vnet_hw_interface_t *hi, char *address)

Definition at line 72 of file interface.h.

typedef 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 at line 76 of file interface.h.

typedef enum vnet_link_t_ vnet_link_t

Link Type: A description of the protocol of packets on the link.

On an ethernet link this maps directly into the ethertype. On a GRE tunnel it maps to the GRE-proto, etc for other lnk types.

typedef 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 at line 67 of file interface.h.

Enumeration Type Documentation

Enumerator
VNET_FLOOD_CLASS_NORMAL 
VNET_FLOOD_CLASS_TUNNEL_MASTER 
VNET_FLOOD_CLASS_TUNNEL_NORMAL 

Definition at line 541 of file interface.h.

Attributes assignable to a HW interface Class.

Enumerator
VNET_HW_INTERFACE_CLASS_FLAG_P2P 

a point 2 point interface

Definition at line 287 of file interface.h.

Enumerator
VNET_HW_INTERFACE_RX_MODE_UNKNOWN 
VNET_HW_INTERFACE_RX_MODE_POLLING 
VNET_HW_INTERFACE_RX_MODE_INTERRUPT 
VNET_HW_INTERFACE_RX_MODE_ADAPTIVE 
VNET_HW_INTERFACE_RX_MODE_DEFAULT 
VNET_HW_INTERFACE_NUM_RX_MODES 

Definition at line 51 of file interface.h.

Enumerator
VNET_INTERFACE_COUNTER_DROP 
VNET_INTERFACE_COUNTER_PUNT 
VNET_INTERFACE_COUNTER_IP4 
VNET_INTERFACE_COUNTER_IP6 
VNET_INTERFACE_COUNTER_RX_NO_BUF 
VNET_INTERFACE_COUNTER_RX_MISS 
VNET_INTERFACE_COUNTER_RX_ERROR 
VNET_INTERFACE_COUNTER_TX_ERROR 
VNET_INTERFACE_COUNTER_MPLS 
VNET_N_SIMPLE_INTERFACE_COUNTER 
VNET_INTERFACE_COUNTER_RX 
VNET_INTERFACE_COUNTER_TX 
VNET_N_COMBINED_INTERFACE_COUNTER 

Definition at line 602 of file interface.h.

Enumerator
VNET_ITF_FUNC_PRIORITY_LOW 
VNET_ITF_FUNC_PRIORITY_HIGH 

Definition at line 79 of file interface.h.

Link Type: A description of the protocol of packets on the link.

On an ethernet link this maps directly into the ethertype. On a GRE tunnel it maps to the GRE-proto, etc for other lnk types.

Enumerator
VNET_LINK_IP4 
VNET_LINK_IP6 
VNET_LINK_MPLS 
VNET_LINK_ETHERNET 
VNET_LINK_ARP 
VNET_LINK_NSH 

Definition at line 250 of file interface.h.

Enumerator
VNET_SW_INTERFACE_TYPE_HARDWARE 
VNET_SW_INTERFACE_TYPE_SUB 

Definition at line 501 of file interface.h.

Function Documentation

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 at line 1404 of file interface.c.

+ Here is the caller graph for this function:

void default_update_adjacency ( struct vnet_main_t vnm,
u32  sw_if_index,
u32  adj_index 
)

Default adjacency update function.

Definition at line 1412 of file interface.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void vnet_interface_counter_lock ( vnet_interface_main_t im)
inlinestatic

Definition at line 670 of file interface.h.

+ Here is the caller graph for this function:

static void vnet_interface_counter_unlock ( vnet_interface_main_t im)
inlinestatic

Definition at line 678 of file interface.h.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int vnet_interface_name_renumber ( u32  sw_if_index,
u32  new_show_dev_instance 
)

Definition at line 1267 of file interface.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

vnet_l3_packet_type_t vnet_link_to_l3_proto ( vnet_link_t  link)

Convert a link to to an Ethertype.

Definition at line 1382 of file interface.c.

+ Here is the caller graph for this function:

void vnet_pcap_drop_trace_filter_add_del ( u32  error_index,
int  is_add 
)

Definition at line 1133 of file interface_output.c.

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Variable Documentation

vnet_device_class_t vnet_local_interface_device_class