36 s =
format (s,
"SPAN: mirrored %U -> %U",
43 #define foreach_span_error \ 44 _(HITS, "SPAN incomming packets processed") 48 #define _(sym,str) SPAN_ERROR_##sym, 55 #define _(sym,string) string, 66 u32 *to_mirror_next = 0;
82 if (mirror_frames[i] == 0)
83 mirror_frames[i] = vnet_get_frame_to_sw_interface (vnm, i);
84 to_mirror_next = vlib_frame_vector_args (mirror_frames[i]);
85 to_mirror_next += mirror_frames[i]->n_vectors;
86 c0 = vlib_buffer_copy (vm, b0);
87 vnet_buffer (c0)->sw_if_index[VLIB_TX] = i;
88 c0->flags |= VNET_BUFFER_SPAN_CLONE;
89 to_mirror_next[0] = vlib_get_buffer_index (vm, c0);
90 mirror_frames[i]->n_vectors++;
101 u32 n_left_from, *from, *to_next;
102 u32 n_span_packets = 0;
115 while (n_left_from > 0)
121 while (n_left_from >= 4 && n_left_to_next >= 2)
134 to_next[0] = bi0 = from[0];
135 to_next[1] = bi1 = from[1];
143 sw_if_index0 =
vnet_buffer (b0)->sw_if_index[rxtx];
144 sw_if_index1 =
vnet_buffer (b1)->sw_if_index[rxtx];
169 to_next, n_left_to_next,
170 bi0, bi1, next0, next1);
172 while (n_left_from > 0 && n_left_to_next > 0)
181 to_next[0] = bi0 = from[0];
188 sw_if_index0 =
vnet_buffer (b0)->sw_if_index[rxtx];
201 n_left_to_next, bi0, next0);
208 for (sw_if_index = 0; sw_if_index <
vec_len (mirror_frames); sw_if_index++)
210 if (mirror_frames[sw_if_index] == 0)
214 mirror_frames[sw_if_index]);
215 mirror_frames[sw_if_index] = 0;
240 .name =
"span-input",
241 .vector_size =
sizeof (
u32),
260 .name =
"span-output",
261 .vector_size =
sizeof (
u32),
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.
sll srl srl sll sra u16x4 i
bad routing header type(not 4)") sr_error (NO_MORE_SEGMENTS
vlib_node_registration_t span_input_node
(constructor) VLIB_REGISTER_NODE (span_input_node)
vlib_node_registration_t span_node
struct _vlib_node_registration vlib_node_registration_t
#define vec_validate_aligned(V, I, A)
Make sure vector is long enough for given index (no header, specified alignment)
u8 * format_span_trace(u8 *s, va_list *args)
format_function_t format_vnet_sw_if_index_name
#define static_always_inline
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
static char * span_error_strings[]
#define clib_bitmap_foreach(i, ai, body)
Macro to iterate across set bits in a bitmap.
span_interface_t * interfaces
static_always_inline void span_mirror(vlib_main_t *vm, span_interface_t *si0, vlib_buffer_t *b0, vlib_frame_t **mirror_frames, int is_rx)
vlib_node_registration_t span_output_node
(constructor) VLIB_REGISTER_NODE (span_output_node)
#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 vnet_feature_next(u32 sw_if_index, u32 *next0, vlib_buffer_t *b0)
#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).
clib_bitmap_t * tx_mirror_ports
static void vlib_node_increment_counter(vlib_main_t *vm, u32 node_index, u32 counter_index, u64 increment)
static void vnet_put_frame_to_sw_interface(vnet_main_t *vnm, u32 sw_if_index, vlib_frame_t *f)
static uword span_input_node_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
#define VNET_BUFFER_SPAN_CLONE
static_always_inline uword span_node_inline_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame, int is_rx)
VLIB_NODE_FUNCTION_MULTIARCH(dpdk_input_node, dpdk_input)
#define foreach_span_error
#define VLIB_BUFFER_IS_TRACED
static void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
static uword span_output_node_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
clib_bitmap_t * rx_mirror_ports
#define VLIB_REGISTER_NODE(x,...)
#define CLIB_CACHE_LINE_BYTES
u32 flags
buffer flags: VLIB_BUFFER_IS_TRACED: trace this buffer.
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.