FD.io VPP  v20.09-64-g4f7b92f0a
Vector Packet Processing
node.c File Reference
+ Include dependency graph for node.c:

Go to the source code of this file.

Data Structures

struct  ethernet_input_trace_t
 
struct  eth_input_tag_lookup_t
 

Macros

#define foreach_ethernet_input_next
 
#define DMAC_MASK   clib_net_to_host_u64 (0xFFFFFFFFFFFF0000)
 
#define DMAC_IGBIT   clib_net_to_host_u64 (0x0100000000000000)
 
#define ethernet_error(n, c, s)   s,
 

Enumerations

enum  ethernet_input_next_t { ETHERNET_INPUT_N_NEXT }
 
enum  ethernet_input_variant_t { ETHERNET_INPUT_VARIANT_ETHERNET, ETHERNET_INPUT_VARIANT_ETHERNET_TYPE, ETHERNET_INPUT_VARIANT_NOT_L2 }
 

Functions

static u8format_ethernet_input_trace (u8 *s, va_list *va)
 
static_always_inline void parse_header (ethernet_input_variant_t variant, vlib_buffer_t *b0, u16 *type, u16 *orig_type, u16 *outer_id, u16 *inner_id, u32 *match_flags)
 
static_always_inline void ethernet_input_inline_dmac_check (vnet_hw_interface_t *hi, u64 *dmacs, u8 *dmacs_bad, u32 n_packets, ethernet_interface_t *ei, u8 have_sec_dmac)
 
static_always_inline void identify_subint (vnet_hw_interface_t *hi, vlib_buffer_t *b0, u32 match_flags, main_intf_t *main_intf, vlan_intf_t *vlan_intf, qinq_intf_t *qinq_intf, u32 *new_sw_if_index, u8 *error0, u32 *is_l2)
 
static_always_inline void determine_next_node (ethernet_main_t *em, ethernet_input_variant_t variant, u32 is_l20, u32 type0, vlib_buffer_t *b0, u8 *error0, u8 *next0)
 
 STATIC_ASSERT_OFFSET_OF (vlib_buffer_t, current_data, 0)
 
 STATIC_ASSERT_OFFSET_OF (vlib_buffer_t, current_length, 2)
 
 STATIC_ASSERT_OFFSET_OF (vlib_buffer_t, flags, 4)
 
 STATIC_ASSERT (STRUCT_OFFSET_OF(vnet_buffer_opaque_t, l2_hdr_offset)==STRUCT_OFFSET_OF(vnet_buffer_opaque_t, l3_hdr_offset) - 2, "l3_hdr_offset must follow l2_hdr_offset")
 
static_always_inline void eth_input_adv_and_flags_x4 (vlib_buffer_t **b, int is_l3)
 
static_always_inline void eth_input_adv_and_flags_x1 (vlib_buffer_t **b, int is_l3)
 
static_always_inline void eth_input_get_etype_and_tags (vlib_buffer_t **b, u16 *etype, u64 *tags, u64 *dmacs, int offset, int dmac_check)
 
static_always_inline u16 eth_input_next_by_type (u16 etype)
 
static_always_inline void eth_input_update_if_counters (vlib_main_t *vm, vnet_main_t *vnm, eth_input_tag_lookup_t *l)
 
static_always_inline void eth_input_tag_lookup (vlib_main_t *vm, vnet_main_t *vnm, vlib_node_runtime_t *node, vnet_hw_interface_t *hi, u64 tag, u16 *next, vlib_buffer_t *b, eth_input_tag_lookup_t *l, u8 dmac_bad, int is_dot1ad, int main_is_l3, int check_dmac)
 
static_always_inline u8 is_dmac_bad (u64 dmac, u64 hwaddr)
 
static_always_inline u8 is_sec_dmac_bad (u64 dmac, u64 hwaddr)
 
static_always_inline u8 eth_input_sec_dmac_check_x1 (u64 hwaddr, u64 *dmac, u8 *dmac_bad)
 
static_always_inline u32 eth_input_sec_dmac_check_x4 (u64 hwaddr, u64 *dmac, u8 *dmac_bad)
 
static_always_inline void eth_input_process_frame_dmac_check (vnet_hw_interface_t *hi, u64 *dmacs, u8 *dmacs_bad, u32 n_packets, ethernet_interface_t *ei, u8 have_sec_dmac)
 
 STATIC_ASSERT (VLIB_FRAME_SIZE % 8==0, "VLIB_FRAME_SIZE must be power of 8")
 
static_always_inline void eth_input_process_frame (vlib_main_t *vm, vlib_node_runtime_t *node, vnet_hw_interface_t *hi, u32 *buffer_indices, u32 n_packets, int main_is_l3, int ip4_cksum_ok, int dmac_check)
 
static_always_inline void eth_input_single_int (vlib_main_t *vm, vlib_node_runtime_t *node, vnet_hw_interface_t *hi, u32 *from, u32 n_pkts, int ip4_cksum_ok)
 
static_always_inline void ethernet_input_trace (vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
 
static_always_inline void ethernet_input_inline (vlib_main_t *vm, vlib_node_runtime_t *node, u32 *from, u32 n_packets, ethernet_input_variant_t variant)
 
VLIB_NODE_FN() ethernet_input_node (vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
 
VLIB_NODE_FN() ethernet_input_type_node (vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
 
VLIB_NODE_FN() ethernet_input_not_l2_node (vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
 
static subint_config_tethernet_sw_interface_get_config (vnet_main_t *vnm, u32 sw_if_index, u32 *flags, u32 *unsupported)
 
static clib_error_tethernet_sw_interface_up_down (vnet_main_t *vnm, u32 sw_if_index, u32 flags)
 
 VNET_SW_INTERFACE_ADMIN_UP_DOWN_FUNCTION (ethernet_sw_interface_up_down)
 
void ethernet_sw_interface_set_l2_mode (vnet_main_t *vnm, u32 sw_if_index, u32 l2)
 
void ethernet_sw_interface_set_l2_mode_noport (vnet_main_t *vnm, u32 sw_if_index, u32 l2)
 
static clib_error_tethernet_sw_interface_add_del (vnet_main_t *vnm, u32 sw_if_index, u32 is_create)
 
 VNET_SW_INTERFACE_ADD_DEL_FUNCTION (ethernet_sw_interface_add_del)
 
void ethernet_set_rx_redirect (vnet_main_t *vnm, vnet_hw_interface_t *hi, u32 enable)
 
clib_error_tnext_by_ethertype_init (next_by_ethertype_t *l3_next)
 
clib_error_tnext_by_ethertype_register (next_by_ethertype_t *l3_next, u32 ethertype, u32 next_index)
 
void ethernet_input_init (vlib_main_t *vm, ethernet_main_t *em)
 
void ethernet_register_input_type (vlib_main_t *vm, ethernet_type_t type, u32 node_index)
 
void ethernet_register_l2_input (vlib_main_t *vm, u32 node_index)
 
void ethernet_register_l3_redirect (vlib_main_t *vm, u32 node_index)
 

Variables

vlib_node_registration_t ethernet_input_node
 (constructor) VLIB_REGISTER_NODE (ethernet_input_node) More...
 
static char * ethernet_error_strings []
 
vlib_node_registration_t ethernet_input_type_node
 (constructor) VLIB_REGISTER_NODE (ethernet_input_type_node) More...
 
vlib_node_registration_t ethernet_input_not_l2_node
 (constructor) VLIB_REGISTER_NODE (ethernet_input_not_l2_node) More...
 

Macro Definition Documentation

◆ DMAC_IGBIT

#define DMAC_IGBIT   clib_net_to_host_u64 (0x0100000000000000)

Definition at line 627 of file node.c.

◆ DMAC_MASK

#define DMAC_MASK   clib_net_to_host_u64 (0xFFFFFFFFFFFF0000)

Definition at line 626 of file node.c.

◆ ethernet_error

#define ethernet_error (   n,
  c,
 
)    s,

◆ foreach_ethernet_input_next

#define foreach_ethernet_input_next
Value:
_ (PUNT, "error-punt") \
_ (DROP, "error-drop") \
_ (LLC, "llc-input") \
_ (IP4_INPUT, "ip4-input") \
_ (IP4_INPUT_NCS, "ip4-input-no-checksum")
DROP
Definition: error.def:41

Definition at line 49 of file node.c.

Enumeration Type Documentation

◆ ethernet_input_next_t

Enumerator
ETHERNET_INPUT_N_NEXT 

Definition at line 56 of file node.c.

◆ ethernet_input_variant_t

Enumerator
ETHERNET_INPUT_VARIANT_ETHERNET 
ETHERNET_INPUT_VARIANT_ETHERNET_TYPE 
ETHERNET_INPUT_VARIANT_NOT_L2 

Definition at line 94 of file node.c.

Function Documentation

◆ determine_next_node()

static_always_inline void determine_next_node ( ethernet_main_t em,
ethernet_input_variant_t  variant,
u32  is_l20,
u32  type0,
vlib_buffer_t b0,
u8 error0,
u8 next0 
)

Definition at line 255 of file node.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ eth_input_adv_and_flags_x1()

static_always_inline void eth_input_adv_and_flags_x1 ( vlib_buffer_t **  b,
int  is_l3 
)

Definition at line 431 of file node.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ eth_input_adv_and_flags_x4()

static_always_inline void eth_input_adv_and_flags_x4 ( vlib_buffer_t **  b,
int  is_l3 
)

Definition at line 329 of file node.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ eth_input_get_etype_and_tags()

static_always_inline void eth_input_get_etype_and_tags ( vlib_buffer_t **  b,
u16 etype,
u64 tags,
u64 dmacs,
int  offset,
int  dmac_check 
)

Definition at line 449 of file node.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ eth_input_next_by_type()

static_always_inline u16 eth_input_next_by_type ( u16  etype)

Definition at line 468 of file node.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ eth_input_process_frame()

static_always_inline void eth_input_process_frame ( vlib_main_t vm,
vlib_node_runtime_t node,
vnet_hw_interface_t hi,
u32 buffer_indices,
u32  n_packets,
int  main_is_l3,
int  ip4_cksum_ok,
int  dmac_check 
)

Definition at line 825 of file node.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ eth_input_process_frame_dmac_check()

static_always_inline void eth_input_process_frame_dmac_check ( vnet_hw_interface_t hi,
u64 dmacs,
u8 dmacs_bad,
u32  n_packets,
ethernet_interface_t ei,
u8  have_sec_dmac 
)

Definition at line 722 of file node.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ eth_input_sec_dmac_check_x1()

static_always_inline u8 eth_input_sec_dmac_check_x1 ( u64  hwaddr,
u64 dmac,
u8 dmac_bad 
)

Definition at line 663 of file node.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ eth_input_sec_dmac_check_x4()

static_always_inline u32 eth_input_sec_dmac_check_x4 ( u64  hwaddr,
u64 dmac,
u8 dmac_bad 
)

Definition at line 670 of file node.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ eth_input_single_int()

static_always_inline void eth_input_single_int ( vlib_main_t vm,
vlib_node_runtime_t node,
vnet_hw_interface_t hi,
u32 from,
u32  n_pkts,
int  ip4_cksum_ok 
)

Definition at line 1077 of file node.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ eth_input_tag_lookup()

static_always_inline void eth_input_tag_lookup ( vlib_main_t vm,
vnet_main_t vnm,
vlib_node_runtime_t node,
vnet_hw_interface_t hi,
u64  tag,
u16 next,
vlib_buffer_t b,
eth_input_tag_lookup_t l,
u8  dmac_bad,
int  is_dot1ad,
int  main_is_l3,
int  check_dmac 
)

Definition at line 504 of file node.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ eth_input_update_if_counters()

static_always_inline void eth_input_update_if_counters ( vlib_main_t vm,
vnet_main_t vnm,
eth_input_tag_lookup_t l 
)

Definition at line 488 of file node.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ethernet_input_init()

void ethernet_input_init ( vlib_main_t vm,
ethernet_main_t em 
)

Definition at line 2253 of file node.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ethernet_input_inline()

static_always_inline void ethernet_input_inline ( vlib_main_t vm,
vlib_node_runtime_t node,
u32 from,
u32  n_packets,
ethernet_input_variant_t  variant 
)

Definition at line 1200 of file node.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ethernet_input_inline_dmac_check()

static_always_inline void ethernet_input_inline_dmac_check ( vnet_hw_interface_t hi,
u64 dmacs,
u8 dmacs_bad,
u32  n_packets,
ethernet_interface_t ei,
u8  have_sec_dmac 
)

Definition at line 690 of file node.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ethernet_input_node()

VLIB_NODE_FN() ethernet_input_node ( vlib_main_t vm,
vlib_node_runtime_t node,
vlib_frame_t frame 
)

Definition at line 1707 of file node.c.

+ Here is the call graph for this function:

◆ ethernet_input_not_l2_node()

VLIB_NODE_FN() ethernet_input_not_l2_node ( vlib_main_t vm,
vlib_node_runtime_t node,
vlib_frame_t from_frame 
)

Definition at line 1742 of file node.c.

+ Here is the call graph for this function:

◆ ethernet_input_trace()

static_always_inline void ethernet_input_trace ( vlib_main_t vm,
vlib_node_runtime_t node,
vlib_frame_t from_frame 
)

Definition at line 1122 of file node.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ethernet_input_type_node()

VLIB_NODE_FN() ethernet_input_type_node ( vlib_main_t vm,
vlib_node_runtime_t node,
vlib_frame_t from_frame 
)

Definition at line 1730 of file node.c.

+ Here is the call graph for this function:

◆ ethernet_register_input_type()

void ethernet_register_input_type ( vlib_main_t vm,
ethernet_type_t  type,
u32  node_index 
)

Definition at line 2276 of file node.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ethernet_register_l2_input()

void ethernet_register_l2_input ( vlib_main_t vm,
u32  node_index 
)

Definition at line 2312 of file node.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ethernet_register_l3_redirect()

void ethernet_register_l3_redirect ( vlib_main_t vm,
u32  node_index 
)

Definition at line 2333 of file node.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ethernet_set_rx_redirect()

void ethernet_set_rx_redirect ( vnet_main_t vnm,
vnet_hw_interface_t hi,
u32  enable 
)

Definition at line 2162 of file node.c.

+ Here is the call graph for this function:

◆ ethernet_sw_interface_add_del()

static clib_error_t* ethernet_sw_interface_add_del ( vnet_main_t vnm,
u32  sw_if_index,
u32  is_create 
)
static

Definition at line 2061 of file node.c.

+ Here is the call graph for this function:

◆ ethernet_sw_interface_get_config()

static subint_config_t* ethernet_sw_interface_get_config ( vnet_main_t vnm,
u32  sw_if_index,
u32 flags,
u32 unsupported 
)
static

Definition at line 1760 of file node.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ethernet_sw_interface_set_l2_mode()

void ethernet_sw_interface_set_l2_mode ( vnet_main_t vnm,
u32  sw_if_index,
u32  l2 
)

Definition at line 1973 of file node.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ethernet_sw_interface_set_l2_mode_noport()

void ethernet_sw_interface_set_l2_mode_noport ( vnet_main_t vnm,
u32  sw_if_index,
u32  l2 
)

Definition at line 2022 of file node.c.

+ Here is the call graph for this function:

◆ ethernet_sw_interface_up_down()

static clib_error_t* ethernet_sw_interface_up_down ( vnet_main_t vnm,
u32  sw_if_index,
u32  flags 
)
static

Definition at line 1942 of file node.c.

+ Here is the call graph for this function:

◆ format_ethernet_input_trace()

static u8* format_ethernet_input_trace ( u8 s,
va_list *  va 
)
static

Definition at line 72 of file node.c.

+ Here is the call graph for this function:

◆ identify_subint()

static_always_inline void identify_subint ( vnet_hw_interface_t hi,
vlib_buffer_t b0,
u32  match_flags,
main_intf_t main_intf,
vlan_intf_t vlan_intf,
qinq_intf_t qinq_intf,
u32 new_sw_if_index,
u8 error0,
u32 is_l2 
)

Definition at line 207 of file node.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ is_dmac_bad()

static_always_inline u8 is_dmac_bad ( u64  dmac,
u64  hwaddr 
)

Definition at line 640 of file node.c.

+ Here is the caller graph for this function:

◆ is_sec_dmac_bad()

static_always_inline u8 is_sec_dmac_bad ( u64  dmac,
u64  hwaddr 
)

Definition at line 647 of file node.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ next_by_ethertype_init()

clib_error_t* next_by_ethertype_init ( next_by_ethertype_t l3_next)

Definition at line 2177 of file node.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ next_by_ethertype_register()

clib_error_t* next_by_ethertype_register ( next_by_ethertype_t l3_next,
u32  ethertype,
u32  next_index 
)

Definition at line 2207 of file node.c.

+ Here is the caller graph for this function:

◆ parse_header()

static_always_inline void parse_header ( ethernet_input_variant_t  variant,
vlib_buffer_t b0,
u16 type,
u16 orig_type,
u16 outer_id,
u16 inner_id,
u32 match_flags 
)

Definition at line 104 of file node.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ STATIC_ASSERT() [1/2]

STATIC_ASSERT ( STRUCT_OFFSET_OF(vnet_buffer_opaque_t, l2_hdr_offset)  = =STRUCT_OFFSET_OF(vnet_buffer_opaque_t, l3_hdr_offset) - 2,
"l3_hdr_offset must follow l2_hdr_offset"   
)
+ Here is the caller graph for this function:

◆ STATIC_ASSERT() [2/2]

STATIC_ASSERT ( VLIB_FRAME_SIZE 8 = =0,
"VLIB_FRAME_SIZE must be power of 8"   
)

◆ STATIC_ASSERT_OFFSET_OF() [1/3]

STATIC_ASSERT_OFFSET_OF ( vlib_buffer_t  ,
current_data  ,
 
)
+ Here is the caller graph for this function:

◆ STATIC_ASSERT_OFFSET_OF() [2/3]

STATIC_ASSERT_OFFSET_OF ( vlib_buffer_t  ,
current_length  ,
 
)

◆ STATIC_ASSERT_OFFSET_OF() [3/3]

STATIC_ASSERT_OFFSET_OF ( vlib_buffer_t  ,
flags  ,
 
)

◆ VNET_SW_INTERFACE_ADD_DEL_FUNCTION()

VNET_SW_INTERFACE_ADD_DEL_FUNCTION ( ethernet_sw_interface_add_del  )
+ Here is the caller graph for this function:

◆ VNET_SW_INTERFACE_ADMIN_UP_DOWN_FUNCTION()

VNET_SW_INTERFACE_ADMIN_UP_DOWN_FUNCTION ( ethernet_sw_interface_up_down  )

Variable Documentation

◆ ethernet_error_strings

char* ethernet_error_strings[]
static
Initial value:
= {
#define ethernet_error(n,c,s)
ethernet_error (NONE, PUNT, "no error")
ethernet_error (BAD_LLC_LENGTH, DROP, "llc length > packet length")
ethernet_error (UNKNOWN_TYPE, PUNT, "unknown ethernet type")
ethernet_error (UNKNOWN_VLAN, DROP, "unknown vlan")
ethernet_error (L3_MAC_MISMATCH, DROP, "l3 mac mismatch")
ethernet_error (DOWN, DROP, "subinterface down")
}
vl_api_mac_address_t mac
Definition: l2.api:502
#define ethernet_error(n, c, s)
vl_api_fib_path_type_t type
Definition: fib_types.api:123
DROP
Definition: error.def:41

Definition at line 2110 of file node.c.

◆ ethernet_input_node

vlib_node_registration_t ethernet_input_node
Initial value:
= {
.name = "ethernet-input",
.vector_size = sizeof (u32),
.scalar_size = sizeof (ethernet_input_frame_t),
.n_errors = ETHERNET_N_ERROR,
.error_strings = ethernet_error_strings,
.n_next_nodes = ETHERNET_INPUT_N_NEXT,
.next_nodes = {
#define _(s,n)
},
.format_trace = format_ethernet_input_trace,
.unformat_buffer = unformat_ethernet_header,
}
static char * ethernet_error_strings[]
Definition: node.c:2110
unsigned int u32
Definition: types.h:88
static u8 * format_ethernet_input_trace(u8 *s, va_list *va)
Definition: node.c:72
u8 * format_ethernet_header_with_length(u8 *s, va_list *args)
Definition: format.c:97
#define foreach_ethernet_input_next
Definition: node.c:49
uword unformat_ethernet_header(unformat_input_t *input, va_list *args)
Definition: format.c:290

(constructor) VLIB_REGISTER_NODE (ethernet_input_node)

Definition at line 2117 of file node.c.

◆ ethernet_input_not_l2_node

vlib_node_registration_t ethernet_input_not_l2_node
Initial value:
= {
.name = "ethernet-input-not-l2",
.vector_size = sizeof (u32),
.n_next_nodes = ETHERNET_INPUT_N_NEXT,
.next_nodes = {
#define _(s,n)
},
}
unsigned int u32
Definition: types.h:88
#define foreach_ethernet_input_next
Definition: node.c:49

(constructor) VLIB_REGISTER_NODE (ethernet_input_not_l2_node)

Definition at line 2147 of file node.c.

◆ ethernet_input_type_node

vlib_node_registration_t ethernet_input_type_node
Initial value:
= {
.name = "ethernet-input-type",
.vector_size = sizeof (u32),
.n_next_nodes = ETHERNET_INPUT_N_NEXT,
.next_nodes = {
#define _(s,n)
},
}
unsigned int u32
Definition: types.h:88
#define foreach_ethernet_input_next
Definition: node.c:49

(constructor) VLIB_REGISTER_NODE (ethernet_input_type_node)

Definition at line 2135 of file node.c.