31 u8 *
a = va_arg (*args,
u8 *);
32 return format (s,
"%02x:%02x:%02x:%02x:%02x:%02x",
33 a[0], a[1], a[2], a[3], a[4], a[5]);
43 s =
format (s,
"SAMPLE: sw_if_index %d, next index %d\n",
45 s =
format (s,
" new src %U -> new dst %U",
54 #define foreach_sample_error \ 55 _(SWAPPED, "Mac swap packets processed") 58 #define _(sym,str) SAMPLE_ERROR_##sym, 65 #define _(sym,string) string, 75 #define foreach_mac_address_offset \ 88 u32 n_left_from, * from, * to_next;
96 while (n_left_from > 0)
101 to_next, n_left_to_next);
103 while (n_left_from >= 4 && n_left_to_next >= 2)
107 u32 sw_if_index0, sw_if_index1;
128 to_next[0] = bi0 = from[0];
129 to_next[1] = bi1 = from[1];
145 #define _(a) tmp0[a] = en0->src_address[a]; 148 #define _(a) en0->src_address[a] = en0->dst_address[a]; 151 #define _(a) en0->dst_address[a] = tmp0[a]; 155 #define _(a) tmp1[a] = en1->src_address[a]; 158 #define _(a) en1->src_address[a] = en1->dst_address[a]; 161 #define _(a) en1->dst_address[a] = tmp1[a]; 178 if (b0->
flags & VLIB_BUFFER_IS_TRACED)
190 if (b1->
flags & VLIB_BUFFER_IS_TRACED)
205 to_next, n_left_to_next,
206 bi0, bi1, next0, next1);
209 while (n_left_from > 0 && n_left_to_next > 0)
236 #define _(a) tmp0[a] = en0->src_address[a]; 239 #define _(a) en0->src_address[a] = en0->dst_address[a]; 242 #define _(a) en0->dst_address[a] = tmp0[a]; 252 && (b0->
flags & VLIB_BUFFER_IS_TRACED))) {
267 to_next, n_left_to_next,
275 SAMPLE_ERROR_SWAPPED, pkts_swapped);
282 .vector_size =
sizeof (
u32),
vlib_node_registration_t sample_node
(constructor) VLIB_REGISTER_NODE (sample_node)
static u8 * format_mac_address(u8 *s, va_list *args)
i16 current_data
signed offset in data[], pre_data[] that we are currently processing.
#define foreach_sample_error
#define vlib_prefetch_buffer_header(b, type)
Prefetch buffer metadata.
static u8 * format_sample_trace(u8 *s, va_list *args)
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
#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).
static void vlib_node_increment_counter(vlib_main_t *vm, u32 node_index, u32 counter_index, u64 increment)
#define VLIB_REGISTER_NODE(x,...)
#define CLIB_PREFETCH(addr, size, type)
#define clib_memcpy(a, b, c)
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 sample_node_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
u16 cached_next_index
Next frame index that vector arguments were last enqueued to last time this node ran.
static char * sample_error_strings[]
static void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
struct _vlib_node_registration vlib_node_registration_t
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
u16 flags
Copy of main node flags.
#define VLIB_NODE_FLAG_TRACE
#define CLIB_CACHE_LINE_BYTES
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index, 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.
#define foreach_mac_address_offset