|
FD.io VPP
v21.06-3-gbb25fbf28
Vector Packet Processing
|
Go to the documentation of this file.
37 s =
format (s,
"SPAN: mirrored %U -> %U",
44 #define foreach_span_error \
45 _(HITS, "SPAN incoming packets processed")
49 #define _(sym,str) SPAN_ERROR_##sym,
56 #define _(sym,string) string,
69 u32 *to_mirror_next = 0;
90 if (mirror_frames[
i] == 0)
104 c0->
flags |= VNET_BUFFER_F_SPAN_CLONE;
106 vnet_buffer (c0)->l2.feature_bitmap = L2OUTPUT_FEAT_OUTPUT;
120 c0->
flags |= VLIB_BUFFER_IS_TRACED;
165 to_next[0] = bi0 =
from[0];
166 to_next[1] = bi1 =
from[1];
174 sw_if_index0 =
vnet_buffer (b0)->sw_if_index[rxtx];
175 sw_if_index1 =
vnet_buffer (b1)->sw_if_index[rxtx];
207 to_next, n_left_to_next,
208 bi0, bi1, next0, next1);
218 to_next[0] = bi0 =
from[0];
225 sw_if_index0 =
vnet_buffer (b0)->sw_if_index[rxtx];
247 n_left_to_next, bi0, next0);
267 return frame->n_vectors;
296 #define span_node_defs \
297 .vector_size = sizeof (u32), \
298 .format_trace = format_span_trace, \
299 .type = VLIB_NODE_TYPE_INTERNAL, \
300 .n_errors = ARRAY_LEN(span_error_strings), \
301 .error_strings = span_error_strings, \
310 .name =
"span-input",
315 .name =
"span-output",
320 .name =
"span-l2-input",
325 .name =
"span-l2-output",
328 #ifndef CLIB_MARCH_VARIANT
355 #undef span_node_defs
vlib_main_t vlib_node_runtime_t vlib_frame_t * frame
static vlib_buffer_t * vlib_buffer_copy(vlib_main_t *vm, vlib_buffer_t *b)
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.
clib_error_t * span_init(vlib_main_t *vm)
vlib_main_t vlib_node_runtime_t * node
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
vlib_frame_t * vlib_get_frame_to_node(vlib_main_t *vm, u32 to_node_index)
vlib_node_registration_t span_input_node
(constructor) VLIB_REGISTER_NODE (span_input_node)
#define foreach_span_error
static char * span_error_strings[]
span_mirror_t mirror_rxtx[SPAN_FEAT_N][VLIB_N_RX_TX]
static u8 * format_span_trace(u8 *s, va_list *args)
void vlib_put_frame_to_node(vlib_main_t *vm, u32 to_node_index, vlib_frame_t *f)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
#define VLIB_NODE_FN(node)
char ** l2output_get_feat_names(void)
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
vnet_main_t * vnet_get_main(void)
static_always_inline void vnet_feature_next(u32 *next0, vlib_buffer_t *b0)
static u32 vlib_get_buffer_index(vlib_main_t *vm, void *p)
Translate buffer pointer into buffer index.
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
#define vec_validate_aligned(V, I, A)
Make sure vector is long enough for given index (no header, specified alignment)
static vlib_frame_t * vnet_get_frame_to_sw_interface(vnet_main_t *vnm, u32 sw_if_index)
static_always_inline void span_mirror(vlib_main_t *vm, vlib_node_runtime_t *node, u32 sw_if_index0, vlib_buffer_t *b0, vlib_frame_t **mirror_frames, vlib_rx_or_tx_t rxtx, span_feat_t sf)
clib_bitmap_t * mirror_ports
#define static_always_inline
sll srl srl sll sra u16x4 i
#define CLIB_CACHE_LINE_BYTES
struct _vlib_node_registration vlib_node_registration_t
vlib_node_registration_t span_l2_output_node
(constructor) VLIB_REGISTER_NODE (span_l2_output_node)
static_always_inline uword span_node_inline_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame, vlib_rx_or_tx_t rxtx, span_feat_t sf)
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.
format_function_t format_vnet_sw_if_index_name
description fragment has unexpected format
vlib_put_next_frame(vm, node, next_index, 0)
#define VLIB_INIT_FUNCTION(x)
vlib_node_registration_t span_output_node
(constructor) VLIB_REGISTER_NODE (span_output_node)
static void vnet_put_frame_to_sw_interface(vnet_main_t *vnm, u32 sw_if_index, vlib_frame_t *f)
vlib_node_registration_t span_l2_input_node
(constructor) VLIB_REGISTER_NODE (span_l2_input_node)
vlib_node_registration_t l2output_node
(constructor) VLIB_REGISTER_NODE (l2output_node)
void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
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.
#define clib_bitmap_foreach(i, ai)
Macro to iterate across set bits in a bitmap.
span_interface_t * interfaces
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.
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,...)