68 #define _(a,b) case VNET_LINK_##a: type = ETHERNET_TYPE_##b; break 81 h->
type = clib_host_to_net_u16 (type);
99 return (&pipe_main.
pipes[sw_if_index]);
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 132 u32 n_left_from, n_left_to_next, n_copy, *from, *to_next;
141 while (n_left_from > 0)
145 n_copy =
clib_min (n_left_from, n_left_to_next);
148 n_left_to_next -= n_copy;
149 n_left_from -= n_copy;
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;
290 u32 n_left_from, next_index, *from, *to_next;
305 while (n_left_from > 0)
309 while (n_left_from >= 4 && n_left_to_next >= 2)
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);
349 pipe0 = &pipe_main.
pipes[sw_if_index0];
350 pipe1 = &pipe_main.
pipes[sw_if_index1];
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);
387 while (n_left_from > 0 && n_left_to_next > 0)
389 u32 bi0, sw_if_index0;
408 type0 = clib_net_to_host_u16 (e0->
type);
409 pipe0 = &pipe_main.
pipes[sw_if_index0];
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) 524 template.sub.id = sub_id;
527 &
template, sw_if_index));
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;
568 instance, address, &hw_if_index,
573 rv = VNET_API_ERROR_INVALID_REGISTRATION;
638 pipe_sw_if_index[id] = sw_if_index;
667 u32 pipe_sw_if_index[2];
669 u32 user_instance = 0;
673 if (
unformat (input,
"instance %d", &user_instance))
680 &sw_if_index, pipe_sw_if_index);
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;
759 if (sw_if_index == ~0)
781 .path =
"pipe delete",
782 .short_help =
"pipe delete <interface>",
unformat_function_t unformat_vnet_hw_interface
#define vec_validate(V, I)
Make sure vector is long enough for given index (no header, unspecified alignment) ...
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index, VLIB_BUFFER_IS_TRACED: trace this buffer.
#define hash_set(h, key, value)
void ethernet_delete_interface(vnet_main_t *vnm, u32 hw_if_index)
vnet_main_t * vnet_get_main(void)
vnet_interface_main_t interface_main
uword vlib_node_add_named_next_with_slot(vlib_main_t *vm, uword node, char *name, uword slot)
pipe_t * pipes
the per-swif-index array of pipes.
i16 current_data
signed offset in data[], pre_data[] that we are currently processing.
#define clib_memcpy_fast(a, b, c)
static clib_error_t * create_pipe_interfaces(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
VNET_DEVICE_CLASS(pipe_device_class)
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
struct pipe_main_t_ pipe_main_t
Various 'module' level variables.
static walk_rc_t pipe_hw_walk(vnet_main_t *vnm, u32 hw_if_index, void *args)
static vnet_hw_interface_t * vnet_get_hw_interface(vnet_main_t *vnm, u32 hw_if_index)
static clib_error_t * delete_pipe_interfaces(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
uword * instances
Allocated pipe instances.
#define VNET_PIPE_TX_NEXT_ETHERNET_INPUT
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 vnet_sw_interface_t * vnet_get_sw_interface(vnet_main_t *vnm, u32 sw_if_index)
uword * sub_interface_sw_if_index_by_id
unformat_function_t unformat_vnet_sw_interface
static int pipe_instance_free(u32 instance)
static uword vlib_buffer_length_in_chain(vlib_main_t *vm, vlib_buffer_t *b)
Get length in bytes of the buffer chain.
static uword pipe_tx(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
format_function_t format_vnet_sw_if_index_name
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.
enum walk_rc_t_ walk_rc_t
Walk return code.
ethernet_main_t ethernet_main
representation of a pipe interface
#define static_always_inline
vl_api_interface_index_t sw_if_index
#define hash_foreach(key_var, value_var, h, body)
#define vlib_prefetch_buffer_header(b, type)
Prefetch buffer metadata.
#define clib_error_return(e, args...)
VNET_HW_INTERFACE_CLASS(pipe_hw_interface_class)
vl_api_fib_path_type_t type
void pipe_walk(pipe_cb_fn_t fn, void *ctx)
Walk all the of pipe interfaces.
static u32 pipe_instance_alloc(u8 is_specified, u32 want)
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
static clib_error_t * pipe_create_sub_interface(vnet_hw_interface_t *hi, u32 sub_id, u32 *sw_if_index)
u32 sw_if_index
the SW if_index of the other end of the pipe
#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.
#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.
#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).
uword unformat_pipe_interface(unformat_input_t *input, va_list *args)
enum pipe_rx_next_t_ pipe_rx_next_t
struct pipe_hw_walk_ctx_t_ pipe_hw_walk_ctx_t
#define VLIB_REGISTER_NODE(x,...)
#define CLIB_PREFETCH(addr, size, type)
int vnet_delete_pipe_interface(u32 sw_if_index)
#define pool_is_free_index(P, I)
Use free bitmap to query whether given index is free.
void vlib_put_next_frame(vlib_main_t *vm, vlib_node_runtime_t *r, u32 next_index, u32 n_vectors_left)
Release pointer to next frame vector data.
static uword clib_bitmap_get(uword *ai, uword i)
Gets the ith bit value from a bitmap.
vlib_main_t vlib_node_runtime_t * node
static u8 * format_pipe_rx_trace(u8 *s, va_list *va)
#define VLIB_CLI_COMMAND(x,...)
static u8 * pipe_build_rewrite(vnet_main_t *vnm, u32 sw_if_index, vnet_link_t link_type, const void *dst_address)
static uword sparse_vec_index(void *v, uword sparse_index)
u16 cached_next_index
Next frame index that vector arguments were last enqueued to last time this node ran.
manual_print typedef address
u8 * format_ethernet_header(u8 *s, va_list *args)
enum vnet_link_t_ vnet_link_t
Link Type: A description of the protocol of packets on the link.
#define PIPE_MAX_INSTANCE
#define foreach_pipe_rx_next
#define clib_error_report(e)
static void vlib_buffer_advance(vlib_buffer_t *b, word l)
Advance current data pointer by the supplied (signed!) amount.
struct pipe_rx_trace_t_ pipe_rx_trace_t
static u8 * format_pipe_name(u8 *s, va_list *args)
static vlib_main_t * vlib_get_main(void)
#define vec_elt(v, i)
Get vector value at index i.
subint_config_t subint
Sub-interface config.
static pipe_main_t pipe_main
next_by_ethertype_t l3_next
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)
ethernet_interface_t * ethernet_get_interface(ethernet_main_t *em, u32 hw_if_index)
void vnet_hw_interface_walk(vnet_main_t *vnm, vnet_hw_interface_walk_t fn, void *ctx)
Walk all the HW interface.
static_always_inline uword pipe_rx(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *from_frame)
pipe_t * pipe_get(u32 sw_if_index)
Get the pipe instnace based on one end.
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)
clib_error_t * vnet_hw_interface_set_flags(vnet_main_t *vnm, u32 hw_if_index, vnet_hw_interface_flags_t flags)
VLIB buffer representation.
vnet_sw_interface_t * sw_interfaces
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
a point 2 point interface
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.
static clib_error_t * pipe_admin_up_down(vnet_main_t *vnm, u32 hw_if_index, u32 flags)
vlib_main_t vlib_node_runtime_t vlib_frame_t * frame
u16 flags
Copy of main node flags.
Various 'module' level variables.
clib_error_t * vnet_create_sw_interface(vnet_main_t *vnm, vnet_sw_interface_t *template, u32 *sw_if_index)
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)
#define VLIB_NODE_FLAG_TRACE
static uword clib_bitmap_first_clear(uword *ai)
Return the lowest numbered clear bit in a bitmap.
#define vec_validate_init_empty(V, I, INIT)
Make sure vector is long enough for given index and initialize empty space (no header, unspecified alignment)
#define CLIB_CACHE_LINE_BYTES
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
vlib_node_registration_t pipe_rx_node
(constructor) VLIB_REGISTER_NODE (pipe_rx_node)