|
FD.io VPP
v21.10.1-2-g0a485f517
Vector Packet Processing
|
Go to the documentation of this file.
55 s =
format (s,
"L2_XCRW: next index %d tx_fib_index %d",
62 #ifndef CLIB_MARCH_VARIANT
67 #define _(sym,string) string,
97 u32 sw_if_index0, sw_if_index1;
115 to_next[0] = bi0 =
from[0];
116 to_next[1] = bi1 =
from[1];
131 next0 = adj0->rewrite_header.next_index;
133 adj0->rewrite_header.sw_if_index;
135 next1 = adj1->rewrite_header.next_index;
137 adj1->rewrite_header.sw_if_index;
139 em->
counters[node_counter_base_index + next1]++;
145 adj0->rewrite_header.data_bytes);
147 em->
counters[node_counter_base_index + L2_XCRW_ERROR_FWD]++;
154 adj1->rewrite_header.data_bytes);
156 em->
counters[node_counter_base_index + L2_XCRW_ERROR_FWD]++;
163 && (b0->
flags & VLIB_BUFFER_IS_TRACED)))
171 && (b1->
flags & VLIB_BUFFER_IS_TRACED)))
182 to_next, n_left_to_next,
183 bi0, bi1, next0, next1);
208 next0 = adj0->rewrite_header.next_index;
210 adj0->rewrite_header.sw_if_index;
216 adj0->rewrite_header.data_bytes);
218 em->
counters[node_counter_base_index + L2_XCRW_ERROR_FWD]++;
222 && (b0->
flags & VLIB_BUFFER_IS_TRACED)))
231 to_next, n_left_to_next,
238 return frame->n_vectors;
244 .vector_size =
sizeof (
u32),
260 #ifndef CLIB_MARCH_VARIANT
278 u32 dev_instance = va_arg (*args,
u32);
279 return format (s,
"xcrw%d", dev_instance);
322 u32 l2_sw_if_index,
u32 tx_fib_index,
349 a->rewrite_header.sw_if_index = tx_fib_index;
355 a->rewrite_header.next_index =
371 return VNET_API_ERROR_INVALID_SW_IF_INDEX;
399 u32 tx_fib_index = ~0;
400 u32 next_node_index = ~0;
421 if (
unformat (line_input,
"next %U",
424 else if (
unformat (line_input,
"tx-fib-id %d", &tx_fib_id))
426 else if (
unformat (line_input,
"del"))
428 else if (
unformat (line_input,
"ipv6"))
435 if (next_node_index == ~0)
461 rw, next_node_index, is_add);
469 case VNET_API_ERROR_INVALID_SW_IF_INDEX:
472 vnm, l2_sw_if_index);
501 .path =
"set interface l2 xcrw",
503 "set interface l2 xcrw <interface> next <node-name>\n"
504 " [del] [tx-fib-id <id>] [ipv6] rw <hex-bytes>",
523 s =
format (s,
"%-25s%s",
"L2 interface",
"Tunnel Details");
527 s =
format (s,
"%-25U %U ",
533 s =
format (s,
"next %U ",
535 a->rewrite_header.next_index);
537 if (
a->rewrite_header.sw_if_index != ~0)
538 s =
format (s,
"tx fib index %d ",
a->rewrite_header.sw_if_index);
540 if (
a->rewrite_header.data_bytes)
542 rewrite_string = (
u8 *) (
a + 1);
543 rewrite_string -=
a->rewrite_header.data_bytes;
544 s =
format (s,
"rewrite data: %U ",
546 a->rewrite_header.data_bytes);
590 .path =
"show l2xcrw",
591 .short_help =
"show l2xcrw",
#define vnet_rewrite_set_data(rw, data, data_bytes)
clib_error_t * vnet_sw_interface_set_flags(vnet_main_t *vnm, u32 sw_if_index, vnet_sw_interface_flags_t flags)
vlib_node_registration_t l2_xcrw_node
(constructor) VLIB_REGISTER_NODE (l2_xcrw_node)
#define hash_set(h, key, value)
#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)
static clib_error_t * show_l2xcrw_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
int vnet_configure_l2_xcrw(vlib_main_t *vm, vnet_main_t *vnm, u32 l2_sw_if_index, u32 tx_fib_index, u8 *rewrite, u32 next_node_index, int is_add)
nat44_ei_hairpin_src_next_t next_index
static vlib_cli_command_t show_l2xcrw_command
(constructor) VLIB_CLI_COMMAND (show_l2xcrw_command)
ip4_main_t ip4_main
Global ip4 main structure.
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
@ VLIB_NODE_TYPE_INTERNAL
vlib_main_t vlib_node_runtime_t * node
#define clib_error_return(e, args...)
vlib_error_main_t error_main
uword * fib_index_by_table_id
Hash table mapping table id to fib index.
@ VNET_SW_INTERFACE_FLAG_ADMIN_UP
#define pool_put(P, E)
Free an object E in pool P.
static u8 * format_l2_xcrw_trace(u8 *s, va_list *args)
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
VNET_DEVICE_CLASS(xcrw_device_class, static)
#define hash_unset(h, key)
static u32 create_xcrw_interface(vlib_main_t *vm)
#define pool_foreach(VAR, POOL)
Iterate through pool.
static void vlib_buffer_advance(vlib_buffer_t *b, word l)
Advance current data pointer by the supplied (signed!) amount.
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
#define VLIB_NODE_FN(node)
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
static vnet_hw_interface_t * vnet_get_hw_interface(vnet_main_t *vnm, u32 hw_if_index)
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.
unformat_function_t unformat_vlib_node
static vlib_node_t * vlib_get_node(vlib_main_t *vm, u32 i)
Get vlib node by index.
clib_error_t * l2_xcrw_init(vlib_main_t *vm)
format_function_t format_vlib_next_node_name
#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)
manual_print typedef address
#define VLIB_CLI_COMMAND(x,...)
l2_xcrw_main_t l2_xcrw_main
static clib_error_t * set_l2_xcrw_command_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
struct _vlib_node_registration vlib_node_registration_t
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
static char * l2_xcrw_error_strings[]
#define vec_free(V)
Free vector's memory (no header).
#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.
static vlib_cli_command_t set_l2_xcrw_command
(constructor) VLIB_CLI_COMMAND (set_l2_xcrw_command)
uword * tunnel_index_by_l2_sw_if_index
format_function_t format_vnet_sw_if_index_name
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 uword pool_elts(void *v)
Number of active elements in a pool.
static u8 * format_l2xcrw(u8 *s, va_list *args)
static u8 * format_xcrw_name(u8 *s, va_list *args)
l2_xcrw_tunnel_t * tunnels
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
l2_xcrw_adjacency_t * adj_by_sw_if_index
#define foreach_l2_xcrw_error
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 vnet_rewrite_one_header(rw0, p0, most_likely_size)
#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_always_inline void clib_prefetch_store(void *p)
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).
#define hash_create(elts, value_bytes)
vl_api_fib_path_type_t type
clib_error_t * ethernet_register_interface(vnet_main_t *vnm, u32 dev_class_index, u32 dev_instance, const u8 *address, u32 *hw_if_index_return, ethernet_flag_change_function_t flag_change)
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index,...
VLIB buffer representation.
#define VLIB_REGISTER_NODE(x,...)
uword * fib_index_by_table_id