|
FD.io VPP
v21.06-3-gbb25fbf28
Vector Packet Processing
|
Go to the documentation of this file.
48 BVT (clib_bihash) * mac_table;
54 u32 feat_next_node_index[32];
80 "l2-fwd: sw_if_index %d dst %U src %U bd_index %d result [0x%llx, %d] %U",
89 #ifndef CLIB_MARCH_VARIANT
97 #define foreach_l2fwd_error \
98 _(L2FWD, "L2 forward packets") \
99 _(FLOOD, "L2 forward misses") \
100 _(HIT, "L2 forward hits") \
101 _(BVI_BAD_MAC, "BVI L3 MAC mismatch") \
102 _(BVI_ETHERTYPE, "BVI packet with unhandled ethertype") \
103 _(FILTER_DROP, "Filter Mac Drop") \
104 _(REFLECT_DROP, "Reflection Drop") \
105 _(STALE_DROP, "Stale entry Drop")
109 #define _(sym,str) L2FWD_ERROR_##sym,
116 #define _(sym,string) string,
138 int try_flood = result0->
raw == ~0;
143 flood_error = L2FWD_ERROR_FLOOD;
149 em->
counters[node_counter_base_index + L2FWD_ERROR_HIT] += 1;
154 int l2fib_seq_num_valid = 1;
157 if (!l2fib_entry_result_is_set_AGE_NOT (result0))
162 (result0->
fields.sw_if_index));
164 l2fib_seq_num_valid = expected_sn == result0->
fields.sn;
169 flood_error = L2FWD_ERROR_STALE_DROP;
175 b0->
error =
node->errors[L2FWD_ERROR_REFLECT_DROP];
179 else if (
PREDICT_FALSE (l2fib_entry_result_is_set_FILTER (result0)))
181 b0->
error =
node->errors[L2FWD_ERROR_FILTER_DROP];
185 else if (
PREDICT_FALSE (l2fib_entry_result_is_set_BVI (result0)))
192 &msm->l3_next, next0);
198 b0->
error =
node->errors[L2FWD_ERROR_BVI_BAD_MAC];
203 b0->
error =
node->errors[L2FWD_ERROR_BVI_ETHERTYPE];
218 (L2INPUT_FEAT_UU_FLOOD |
219 L2INPUT_FEAT_UU_FWD | L2INPUT_FEAT_GBP_FWD))
250 cached_result.
raw = ~0;
260 u32 sw_if_index0, sw_if_index1, sw_if_index2, sw_if_index3;
290 em->
counters[node_counter_base_index + L2FWD_ERROR_L2FWD] += 4;
321 if (
b[0]->
flags & VLIB_BUFFER_IS_TRACED)
331 if (
b[1]->
flags & VLIB_BUFFER_IS_TRACED)
341 if (
b[2]->
flags & VLIB_BUFFER_IS_TRACED)
351 if (
b[3]->
flags & VLIB_BUFFER_IS_TRACED)
381 em->
counters[node_counter_base_index + L2FWD_ERROR_L2FWD] += 1;
407 return frame->n_vectors;
421 .vector_size =
sizeof (
u32),
438 #ifndef CLIB_MARCH_VARIANT
452 mp->feat_next_node_index);
455 mp->mac_table = get_mac_table ();
533 .path =
"set interface l2 forward",
534 .short_help =
"set interface l2 forward <interface> [disable]",
clib_error_t * next_by_ethertype_init(next_by_ethertype_t *l3_next)
static vlib_cli_command_t int_fwd_cli
(constructor) VLIB_CLI_COMMAND (int_fwd_cli)
vlib_buffer_t * bufs[VLIB_FRAME_SIZE]
#define vlib_prefetch_buffer_header(b, type)
Prefetch buffer metadata.
vlib_main_t vlib_node_runtime_t vlib_frame_t * frame
static uword vlib_node_add_next(vlib_main_t *vm, uword node, uword next_node)
u8 * format_l2fib_entry_result_flags(u8 *s, va_list *args)
nat44_ei_hairpin_src_next_t next_index
clib_error_t * l2fwd_init(vlib_main_t *vm)
#define TO_BVI_ERR_BAD_MAC
u8 * format_ethernet_address(u8 *s, va_list *args)
vlib_get_buffers(vm, from, b, n_left_from)
@ VLIB_NODE_TYPE_INTERNAL
l2fib_entry_result_t result
vlib_main_t vlib_node_runtime_t * node
static_always_inline void l2fib_lookup_1(BVT(clib_bihash) *mac_table, l2fib_entry_key_t *cached_key, l2fib_entry_result_t *cached_result, u8 *mac0, u16 bd_index0, l2fib_entry_key_t *key0, l2fib_entry_result_t *result0)
Lookup the entry for mac and bd_index in the mac table for 1 packet.
#define clib_error_return(e, args...)
#define TO_BVI_ERR_ETHERTYPE
vlib_error_main_t error_main
static_always_inline l2fib_seq_num_t l2_fib_update_seq_num(l2fib_seq_num_t sn, u8 if_sn)
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
vlib_buffer_enqueue_to_next(vm, node, from,(u16 *) nexts, frame->n_vectors)
static_always_inline void * clib_memcpy_fast(void *restrict dst, const void *restrict src, size_t n)
struct l2fib_entry_result_t_::@463::@465 fields
static_always_inline void l2fib_lookup_4(BVT(clib_bihash) *mac_table, l2fib_entry_key_t *cached_key, l2fib_entry_result_t *cached_result, const u8 *mac0, const u8 *mac1, const u8 *mac2, const u8 *mac3, u16 bd_index0, u16 bd_index1, u16 bd_index2, u16 bd_index3, l2fib_entry_key_t *key0, l2fib_entry_key_t *key1, l2fib_entry_key_t *key2, l2fib_entry_key_t *key3, l2fib_entry_result_t *result0, l2fib_entry_result_t *result1, l2fib_entry_result_t *result2, l2fib_entry_result_t *result3)
#define CLIB_PREFETCH(addr, size, type)
vlib_error_t error
Error code for buffers to be enqueued to error handler.
#define VLIB_NODE_FN(node)
static_always_inline uword l2fwd_node_inline(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame, int do_trace)
vnet_main_t * vnet_get_main(void)
#define VLIB_NODE_FLAG_TRACE
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
#define static_always_inline
BVT(clib_bihash)
The table of adjacencies indexed by the rewrite string.
static vlib_node_t * vlib_get_node(vlib_main_t *vm, u32 i)
Get vlib node by index.
#define VLIB_CLI_COMMAND(x,...)
vlib_node_registration_t l2fwd_node
(constructor) VLIB_REGISTER_NODE (l2fwd_node)
static clib_error_t * int_fwd(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
Set subinterface forward enable/disable.
static_always_inline void l2fwd_process(vlib_main_t *vm, vlib_node_runtime_t *node, l2fwd_main_t *msm, vlib_error_main_t *em, vlib_buffer_t *b0, u32 sw_if_index0, l2fib_entry_result_t *result0, u16 *next0)
Forward one packet based on the mac table lookup result.
#define CLIB_CACHE_LINE_BYTES
struct _vlib_node_registration vlib_node_registration_t
static u32 vnet_l2_feature_next(vlib_buffer_t *b, u32 *next_nodes, u32 feat_bit)
Return the graph node index for the feature corresponding to the next set bit after clearing the curr...
void l2fwd_register_input_type(vlib_main_t *vm, ethernet_type_t type, u32 node_index)
Add the L3 input node for this ethertype to the next nodes structure.
static char * l2fwd_error_strings[]
static u8 * format_l2fwd_trace(u8 *s, va_list *args)
#define foreach_l2fwd_error
unformat_function_t unformat_vnet_sw_interface
description fragment has unexpected format
#define VLIB_INIT_FUNCTION(x)
void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
clib_error_t *() vlib_init_function_t(struct vlib_main_t *vm)
u16 l2fib_seq_num_t
A combined representation of the sequence number associated with the interface and the BD.
u16 nexts[VLIB_FRAME_SIZE]
clib_error_t * next_by_ethertype_register(next_by_ethertype_t *l3_next, u32 ethertype, u32 next_index)
int vlib_main(vlib_main_t *volatile vm, unformat_input_t *input)
vl_api_interface_index_t sw_if_index
static_always_inline u32 l2_to_bvi(vlib_main_t *vlib_main, vnet_main_t *vnet_main, vlib_buffer_t *b0, u32 bvi_sw_if_index, next_by_ethertype_t *l3_next, u16 *next0)
Send a packet from L2 processing to L3 via the BVI interface.
static void feat_bitmap_init_next_nodes(vlib_main_t *vm, u32 node_index, u32 num_features, char **feat_names, u32 *next_nodes)
Initialize the feature next-node indexes of a graph node.
vl_api_fib_path_type_t type
VLIB buffer representation.
#define VLIB_REGISTER_NODE(x,...)
vl_api_wireguard_peer_flags_t flags