|
FD.io VPP
v21.10.1-2-g0a485f517
Vector Packet Processing
|
Go to the documentation of this file.
30 #ifndef CLIB_MARCH_VARIANT
44 l2_rw_entry_t *e = va_arg (*args, l2_rw_entry_t *);
46 s =
format (s,
"%d - mask:%U value:%U\n",
50 e->value, e->rewrite_n_vectors * sizeof (
u32x4));
52 format (s,
" hits:%d skip_bytes:%d", e->hit_count,
53 e->skip_n_vectors * sizeof (
u32x4));
60 l2_rw_config_t *
c = va_arg (*args, l2_rw_config_t *);
61 return format (s,
"table-index:%d miss-index:%d",
62 c->table_index,
c->miss_index);
72 return format (s,
"l2-rw: sw_if_index %d, table %d, entry %d",
95 u32x4u *d = ((u32x4u *)
h) + rwe->skip_n_vectors;
96 switch (rwe->rewrite_n_vectors)
99 d[4] = (d[4] & ~rwe->mask[4]) | rwe->value[4];
102 d[3] = (d[3] & ~rwe->mask[3]) | rwe->value[3];
105 d[2] = (d[2] & ~rwe->mask[2]) | rwe->value[2];
108 d[1] = (d[1] & ~rwe->mask[1]) | rwe->value[1];
111 d[0] = (d[0] & ~rwe->mask[0]) | rwe->value[0];
139 u32 bi0, next0, sw_if_index0, rwe_index0;
140 u32 bi1, next1, sw_if_index1, rwe_index1;
143 l2_rw_config_t *config0, *config1;
147 l2_rw_entry_t *rwe0, *rwe1;
202 rwe_index0 = e0 ? e0->opaque_index : config0->miss_index;
203 rwe_index1 = e1 ? e1->opaque_index : config1->miss_index;
205 if (rwe_index0 != ~0)
210 if (rwe_index1 != ~0)
239 to_next, n_left_to_next,
240 bi0, bi1, next0, next1);
245 u32 bi0, next0, sw_if_index0, rwe_index0;
248 l2_rw_config_t *config0;
278 rwe_index0 = e0 ? e0->opaque_index : config0->miss_index;
280 if (rwe_index0 != ~0)
299 to_next, n_left_to_next,
305 return frame->n_vectors;
308 #ifndef CLIB_MARCH_VARIANT
314 l2_rw_entry_t *e = 0;
335 e->skip_n_vectors = skip /
sizeof (
u32x4);
336 skip -= e->skip_n_vectors *
sizeof (
u32x4);
337 e->rewrite_n_vectors = (skip +
len - 1) /
sizeof (
u32x4) + 1;
347 for (
i = 0;
i < e->rewrite_n_vectors;
i++)
349 e->value[
i] &= e->mask[
i];
374 else if (
unformat (input,
"skip %d", &skip))
406 .path =
"l2 rewrite entry",
408 "l2 rewrite entry [index <index>] [mask <hex-mask>] [value <hex-value>] [skip <n_bytes>] [del]",
413 #ifndef CLIB_MARCH_VARIANT
420 c->table_index = table_index;
421 c->miss_index = miss_index;
422 u32 feature_bitmap = (table_index == ~0) ? 0 : L2INPUT_FEAT_RW;
426 if (
c->table_index == ~0)
438 u32 table_index = ~0;
449 if (
unformat (input,
"table %d", &table_index))
451 else if (
unformat (input,
"miss-index %d", &miss_index))
459 "You must specify an interface 'iface <interface>'",
480 .path =
"set interface l2 rewrite",
482 "set interface l2 rewrite <interface> [table <table index>] [miss-index <entry-index>]",
515 .path =
"show l2 rewrite interfaces",
517 "show l2 rewrite interfaces",
549 .path =
"show l2 rewrite entries",
551 "show l2 rewrite entries",
572 !
unformat (input,
"%d", &bridge_domain))
599 .path =
"set bridge-domain rewrite",
601 "set bridge-domain rewrite <bridge-domain> [disable]",
629 #define foreach_l2_rw_error \
630 _(UNKNOWN, "Unknown error")
634 #define _(sym,str) L2_RW_ERROR_##sym,
641 #define _(sym,string) string,
649 .vector_size =
sizeof (
u32),
654 .runtime_data_bytes = 0,
struct _vnet_classify_entry vnet_classify_entry_t
static clib_error_t * l2_rw_set_cli_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
int l2_rw_mod_entry(u32 *index, u8 *mask, u8 *value, u32 len, u32 skip, u8 is_del)
#define vlib_prefetch_buffer_header(b, type)
Prefetch buffer metadata.
vlib_main_t vlib_node_runtime_t vlib_frame_t * frame
static clib_error_t * l2_rw_interface_cli_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define clib_memcpy(d, s, n)
static clib_error_t * l2_rw_entry_cli_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
nat44_ei_hairpin_src_next_t next_index
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
static vlib_cli_command_t l2_rw_show_entries_cli
(constructor) VLIB_CLI_COMMAND (l2_rw_show_entries_cli)
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
static_always_inline void l2_rw_rewrite(l2_rw_entry_t *rwe, u8 *h)
static vlib_cli_command_t l2_rw_show_interfaces_cli
(constructor) VLIB_CLI_COMMAND (l2_rw_show_interfaces_cli)
@ VLIB_NODE_TYPE_INTERNAL
vlib_main_t vlib_node_runtime_t * node
vnet_classify_main_t vnet_classify_main
#define clib_error_return(e, args...)
#define pool_put(P, E)
Free an object E in pool P.
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
static u8 * format_l2_rw_trace(u8 *s, va_list *args)
#define clib_bitmap_alloc(v, n_bits)
Allocate a bitmap with the supplied number of bits.
vnet_classify_entry_t * vnet_classify_find_entry(vnet_classify_table_t *t, u8 *h, u64 hash, f64 now)
u32 feat_next_node_index[32]
#define pool_is_free_index(P, I)
Use free bitmap to query whether given index is free.
#define vec_alloc_aligned(V, N, A)
Allocate space for N more elements (no header, given alignment)
#define pool_foreach(VAR, POOL)
Iterate through pool.
static clib_error_t * l2_rw_show_interfaces_cli_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
static uword clib_bitmap_get(uword *ai, uword i)
Gets the ith bit value from a bitmap.
#define VLIB_NODE_FN(node)
vnet_main_t * vnet_get_main(void)
static clib_error_t * l2_rw_show_entries_cli_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
static uword clib_bitmap_count_set_bits(uword *ai)
Return the number of set bits in a bitmap.
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
#define static_always_inline
static vlib_cli_command_t l2_rw_set_cli
(constructor) VLIB_CLI_COMMAND (l2_rw_set_cli)
int l2_rw_interface_set_table(u32 sw_if_index, u32 table_index, u32 miss_index)
vlib_node_registration_t l2_rw_node
(constructor) VLIB_REGISTER_NODE (l2_rw_node)
#define pool_get(P, E)
Allocate an object E from a pool P (unspecified alignment).
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment)
#define VLIB_CLI_COMMAND(x,...)
static uword * clib_bitmap_set(uword *ai, uword i, uword value)
Sets the ith bit of a bitmap to new_value Removes trailing zeros from the bitmap.
struct _vlib_node_registration vlib_node_registration_t
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
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...
#define vlib_validate_buffer_enqueue_x1(vm, node, next_index, to_next, n_left_to_next, bi0, next0)
Finish enqueueing one buffer forward in the graph.
unformat_function_t unformat_vnet_sw_interface
description fragment has unexpected format
vlib_put_next_frame(vm, node, next_index, 0)
#define VLIB_INIT_FUNCTION(x)
static int l2_rw_enable_disable(u32 bridge_domain, u8 disable)
static vlib_cli_command_t l2_rw_interface_cli
(constructor) VLIB_CLI_COMMAND (l2_rw_interface_cli)
struct _vnet_classify_main vnet_classify_main_t
static uword pool_elts(void *v)
Number of active elements in a pool.
u64 vnet_classify_hash_packet(vnet_classify_table_t *t, u8 *h)
static vlib_cli_command_t l2_rw_entry_cli
(constructor) VLIB_CLI_COMMAND (l2_rw_entry_cli)
static u8 * format_l2_rw_entry(u8 *s, va_list *args)
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
static vlib_main_t * vlib_get_main(void)
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)
#define vlib_validate_buffer_enqueue_x2(vm, node, next_index, to_next, n_left_to_next, bi0, bi1, next0, next1)
Finish enqueueing two buffers forward in the graph.
static l2_rw_config_t * l2_rw_get_config(u32 sw_if_index)
static f64 vlib_time_now(vlib_main_t *vm)
#define clib_bitmap_foreach(i, ai)
Macro to iterate across set bits in a bitmap.
vl_api_interface_index_t sw_if_index
#define vlib_get_next_frame(vm, node, next_index, vectors, n_vectors_left)
Get pointer to next frame vector data by (vlib_node_runtime_t, next_index).
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
static clib_error_t * l2_rw_init(vlib_main_t *vm)
#define vlib_prefetch_buffer_data(b, type)
static u8 * format_l2_rw_config(u8 *s, va_list *args)
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index,...
static char * l2_rw_error_strings[]
VLIB buffer representation.
#define foreach_l2_rw_error
#define VLIB_REGISTER_NODE(x,...)