|
FD.io VPP
v21.06-3-gbb25fbf28
Vector Packet Processing
|
Go to the documentation of this file.
68 #define _(a,b) case VNET_LINK_##a: type = ETHERNET_TYPE_##b; break
81 h->type = clib_host_to_net_u16 (
type);
106 u32 *result = va_arg (*args,
u32 *);
117 *result = hw_if_index;
123 #define VNET_PIPE_TX_NEXT_ETHERNET_INPUT VNET_INTERFACE_TX_N_NEXT
148 n_left_to_next -= n_copy;
170 return frame->n_vectors;
176 u32 dev_instance = va_arg (*args,
u32);
177 return format (s,
"pipe%d", dev_instance);
194 vnet_sw_interface_set_flags (vnm, sw_if_index, flags);
210 #define foreach_pipe_rx_next \
211 _ (DROP, "error-drop")
215 #define _(s,n) PIPE_RX_NEXT_##s,
252 else if (type0 == ETHERNET_TYPE_IP4)
256 else if (type0 == ETHERNET_TYPE_IP6)
260 else if (type0 == ETHERNET_TYPE_MPLS)
281 *next0 = PIPE_RX_NEXT_DROP;
311 u32 bi0, sw_if_index0, bi1, sw_if_index1;
347 type0 = clib_net_to_host_u16 (e0->
type);
348 type1 = clib_net_to_host_u16 (e1->
type);
360 VNET_BUFFER_F_L2_HDR_OFFSET_VALID |
361 VNET_BUFFER_F_L3_HDR_OFFSET_VALID;
363 VNET_BUFFER_F_L2_HDR_OFFSET_VALID |
364 VNET_BUFFER_F_L3_HDR_OFFSET_VALID;
384 to_next, n_left_to_next,
385 bi0, bi1, next0, next1);
389 u32 bi0, sw_if_index0;
408 type0 = clib_net_to_host_u16 (e0->
type);
415 VNET_BUFFER_F_L2_HDR_OFFSET_VALID |
416 VNET_BUFFER_F_L3_HDR_OFFSET_VALID;
427 to_next, n_left_to_next,
442 .vector_size =
sizeof (
u32),
445 .sibling_of =
"ethernet-input",
452 #define PIPE_MAX_INSTANCE (16 * 1024)
523 template.sup_sw_if_index =
hi->sw_if_index;
524 template.sub.id = sub_id;
533 u32 * parent_sw_if_index,
u32 pipe_sw_if_index[2])
548 ASSERT (parent_sw_if_index);
559 return VNET_API_ERROR_INVALID_REGISTRATION;
573 rv = VNET_API_ERROR_INVALID_REGISTRATION;
578 *parent_sw_if_index =
hi->sw_if_index;
597 hash_set (
hi->sub_interface_sw_if_index_by_id, 0, pipe_sw_if_index[0]);
598 hash_set (
hi->sub_interface_sw_if_index_by_id, 1, pipe_sw_if_index[1]);
630 if (
hi->dev_class_index == pipe_device_class.index)
638 pipe_sw_if_index[id] = sw_if_index;
642 ctx->cb (
hi->sw_if_index, pipe_sw_if_index,
hi->dev_instance,
ctx->ctx);
667 u32 pipe_sw_if_index[2];
669 u32 user_instance = 0;
673 if (
unformat (input,
"instance %d", &user_instance))
701 .path =
"pipe create",
702 .short_help =
"pipe create [instance <instance>]",
717 return VNET_API_ERROR_INVALID_SW_IF_INDEX;
726 return VNET_API_ERROR_INVALID_SW_IF_INDEX;
732 vnet_delete_sub_interface(sw_if_index);
733 pipe_main.pipes[sw_if_index] = PIPE_INVALID;
781 .path =
"pipe delete",
782 .short_help =
"pipe delete <interface>",
static uword pipe_tx(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
@ VNET_SW_INTERFACE_TYPE_PIPE
#define vlib_prefetch_buffer_header(b, type)
Prefetch buffer metadata.
vlib_main_t vlib_node_runtime_t vlib_frame_t * frame
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_always_inline uword pipe_rx(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
static int pipe_instance_free(u32 instance)
representation of a pipe interface
pipe_t * pipes
the per-swif-index array of pipes.
enum pipe_rx_next_t_ pipe_rx_next_t
void vlib_trace_frame_buffers_only(vlib_main_t *vm, vlib_node_runtime_t *node, u32 *buffers, uword n_buffers, uword next_buffer_stride, uword n_buffer_data_bytes_in_trace)
vlib_main_t vlib_node_runtime_t * node
u8 * format_ethernet_header(u8 *s, va_list *args)
#define clib_error_return(e, args...)
const static pipe_t PIPE_INVALID
@ VNET_FLOOD_CLASS_NORMAL
void pipe_walk(pipe_cb_fn_t fn, void *ctx)
Walk all the of pipe interfaces.
struct pipe_hw_walk_ctx_t_ pipe_hw_walk_ctx_t
subint_config_t subint
Sub-interface config.
static u8 * pipe_build_rewrite(vnet_main_t *vnm, u32 sw_if_index, vnet_link_t link_type, const void *dst_address)
@ VNET_SW_INTERFACE_FLAG_ADMIN_UP
Various 'module' level variables.
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
int vnet_delete_pipe_interface(u32 sw_if_index)
static vnet_sw_interface_t * vnet_get_sw_interface(vnet_main_t *vnm, u32 sw_if_index)
@ VNET_HW_INTERFACE_FLAG_LINK_UP
vlib_main_t vlib_node_runtime_t vlib_frame_t * from_frame
#define clib_error_report(e)
static clib_error_t * create_pipe_interfaces(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
static uword vlib_buffer_length_in_chain(vlib_main_t *vm, vlib_buffer_t *b)
Get length in bytes of the buffer chain.
static_always_inline void * clib_memcpy_fast(void *restrict dst, const void *restrict src, size_t n)
static uword clib_bitmap_first_clear(uword *ai)
Return the lowest numbered clear bit in a bitmap.
static vlib_cli_command_t pipe_delete_interface_command
(constructor) VLIB_CLI_COMMAND (pipe_delete_interface_command)
VNET_HW_INTERFACE_CLASS(pipe_hw_interface_class)
#define pool_is_free_index(P, I)
Use free bitmap to query whether given index is free.
#define vec_elt(v, i)
Get vector value at index i.
#define hash_set(h, key, value)
#define CLIB_PREFETCH(addr, size, type)
i16 current_data
signed offset in data[], pre_data[] that we are currently processing.
static void vlib_buffer_advance(vlib_buffer_t *b, word l)
Advance current data pointer by the supplied (signed!) amount.
next_by_ethertype_t l3_next
static uword clib_bitmap_get(uword *ai, uword i)
Gets the ith bit value from a bitmap.
#define PIPE_MAX_INSTANCE
walk_rc_t(* pipe_cb_fn_t)(u32 parent_sw_if_index, u32 pipe_sw_if_index[2], u32 instance, void *ctx)
Call back function when walking all the pipes.
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.
#define static_always_inline
clib_error_t * vnet_create_sw_interface(vnet_main_t *vnm, vnet_sw_interface_t *template, u32 *sw_if_index)
static uword sparse_vec_index(void *v, uword sparse_index)
#define hash_foreach(key_var, value_var, h, body)
struct pipe_main_t_ pipe_main_t
Various 'module' level variables.
sll srl srl sll sra u16x4 i
#define foreach_pipe_rx_next
#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,...)
static vlib_cli_command_t pipe_create_interface_command
(constructor) VLIB_CLI_COMMAND (pipe_create_interface_command)
unformat_function_t unformat_vnet_hw_interface
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.
static u32 pipe_instance_alloc(u8 is_specified, u32 want)
#define CLIB_CACHE_LINE_BYTES
struct _vlib_node_registration vlib_node_registration_t
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
vnet_sw_interface_t * sw_interfaces
uword vlib_node_add_named_next_with_slot(vlib_main_t *vm, uword node, char *name, uword slot)
static clib_error_t * delete_pipe_interfaces(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
ethernet_interface_t * ethernet_get_interface(ethernet_main_t *em, u32 hw_if_index)
static walk_rc_t pipe_hw_walk(vnet_main_t *vnm, u32 hw_if_index, void *args)
int vnet_create_pipe_interface(u8 is_specified, u32 user_instance, u32 *parent_sw_if_index, u32 pipe_sw_if_index[2])
Create a new pipe interface.
#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.
uword unformat_pipe_interface(unformat_input_t *input, va_list *args)
ethernet_main_t ethernet_main
format_function_t format_vnet_sw_if_index_name
unformat_function_t unformat_vnet_sw_interface
description fragment has unexpected format
#define vec_validate_init_empty(V, I, INIT)
Make sure vector is long enough for given index and initialize empty space (no header,...
vlib_put_next_frame(vm, node, next_index, 0)
void ethernet_delete_interface(vnet_main_t *vnm, u32 hw_if_index)
static clib_error_t * pipe_create_sub_interface(vnet_hw_interface_t *hi, u32 sub_id, u32 *sw_if_index)
static clib_error_t * pipe_admin_up_down(vnet_main_t *vnm, u32 hw_if_index, u32 flags)
static pipe_main_t pipe_main
static_always_inline void pipe_determine_next_node(ethernet_main_t *em, u32 is_l20, u32 type0, vlib_buffer_t *b0, pipe_rx_next_t *next0)
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
static u8 * format_pipe_name(u8 *s, va_list *args)
enum vnet_link_t_ vnet_link_t
Link Type: A description of the protocol of packets on the link.
static vlib_main_t * vlib_get_main(void)
void vnet_hw_interface_walk(vnet_main_t *vnm, vnet_hw_interface_walk_t fn, void *ctx)
Walk all the HW interface.
clib_error_t * vnet_hw_interface_set_flags(vnet_main_t *vnm, u32 hw_if_index, vnet_hw_interface_flags_t flags)
pipe_t * pipe_get(u32 sw_if_index)
Get the pipe instnace based on one end.
#define VNET_PIPE_TX_NEXT_ETHERNET_INPUT
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
@ VNET_HW_INTERFACE_CLASS_FLAG_P2P
a point 2 point interface
static u8 * format_pipe_rx_trace(u8 *s, va_list *va)
struct pipe_rx_trace_t_ pipe_rx_trace_t
#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.
VNET_DEVICE_CLASS(pipe_device_class)
vlib_node_registration_t pipe_rx_node
(constructor) VLIB_REGISTER_NODE (pipe_rx_node)
uword * instances
Allocated pipe instances.
vl_api_interface_index_t sw_if_index
u32 sw_if_index
the SW if_index of the other end of the pipe
#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).
enum walk_rc_t_ walk_rc_t
Walk return code.
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)
vnet_interface_main_t interface_main
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,...)
vl_api_wireguard_peer_flags_t flags