33 static u8 * format_li_hit_trace (
u8 * s, va_list * args)
37 li_hit_trace_t * t = va_arg (*args, li_hit_trace_t *);
39 s =
format (s,
"LI_HIT: next index %d", t->next_index);
46 #define foreach_li_hit_error \ 47 _(HITS, "LI packets processed") \ 48 _(NO_COLLECTOR, "No collector configured") 51 #define _(sym,str) LI_HIT_ERROR_##sym, 57 static char * li_hit_error_strings[] = {
58 #define _(sym,string) string, 73 u32 n_left_from, * from, * to_next;
74 li_hit_next_t next_index;
76 u32 * to_int_next = 0;
86 LI_HIT_ERROR_NO_COLLECTOR,
96 while (n_left_from > 0)
101 to_next, n_left_to_next);
104 while (n_left_from >= 4 && n_left_to_next >= 2)
106 u32 next0 = LI_HIT_NEXT_INTERFACE_OUTPUT;
107 u32 next1 = LI_HIT_NEXT_INTERFACE_OUTPUT;
108 u32 sw_if_index0, sw_if_index1;
129 to_next[0] = bi0 = from[0];
130 to_next[1] = bi1 = from[1];
161 t->sw_if_index = sw_if_index0;
162 t->next_index = next0;
168 t->sw_if_index = sw_if_index1;
169 t->next_index = next1;
175 to_next, n_left_to_next,
176 bi0, bi1, next0, next1);
180 while (n_left_from > 0 && n_left_to_next > 0)
185 ip4_udp_header_t * iu0;
188 u32 next0 = LI_HIT_NEXT_ETHERNET;
220 clib_host_to_net_u16(lm->
ports[0]);
234 t->next_index = next0;
239 to_next, n_left_to_next,
260 .vector_size =
sizeof (
u32),
261 .format_trace = format_li_hit_trace,
264 .n_errors =
ARRAY_LEN(li_hit_error_strings),
265 .error_strings = li_hit_error_strings,
267 .n_next_nodes = LI_HIT_N_NEXT,
271 [LI_HIT_NEXT_ETHERNET] =
"ethernet-input-not-l2",
288 .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)
bad routing header type(not 4)") sr_error (NO_MORE_SEGMENTS
struct _vlib_node_registration vlib_node_registration_t
vlib_node_registration_t li_hit_node
(constructor) VLIB_REGISTER_NODE (li_hit_node)
static clib_error_t * li_init(vlib_main_t *vm)
always_inline void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
vlib_node_registration_t ip4_lookup_node
(constructor) VLIB_REGISTER_NODE (ip4_lookup_node)
i16 current_data
signed offset in data[], pre_data[] that we are currently processing.
#define VLIB_INIT_FUNCTION(x)
always_inline uword vlib_buffer_length_in_chain(vlib_main_t *vm, vlib_buffer_t *b)
Get length in bytes of the buffer chain.
#define clib_warning(format, args...)
always_inline void * vlib_frame_vector_args(vlib_frame_t *f)
always_inline void vlib_node_increment_counter(vlib_main_t *vm, u32 node_index, u32 counter_index, u64 increment)
void vlib_put_frame_to_node(vlib_main_t *vm, u32 to_node_index, vlib_frame_t *f)
#define vlib_validate_buffer_enqueue_x2(vm, node, next_index, to_next, n_left_to_next, bi0, bi1, next0, next1)
#define vlib_validate_buffer_enqueue_x1(vm, node, next_index, to_next, n_left_to_next, bi0, next0)
#define vlib_get_next_frame(vm, node, next_index, vectors, n_vectors_left)
always_inline u16 ip4_header_checksum(ip4_header_t *i)
#define CLIB_PREFETCH(addr, size, type)
#define VLIB_NODE_FLAG_TRACE
#define VLIB_BUFFER_IS_TRACED
ip4_address_t * src_addrs
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
always_inline void vlib_buffer_advance(vlib_buffer_t *b, word l)
Advance current data pointer by the supplied (signed!) amount.
always_inline void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
#define vlib_prefetch_buffer_header(b, type)
Prefetch buffer metadata.
static vlib_buffer_t * vlib_dpdk_clone_buffer(vlib_main_t *vm, vlib_buffer_t *b)
#define VLIB_REGISTER_NODE(x,...)
static uword li_hit_node_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
vlib_frame_t * vlib_get_frame_to_node(vlib_main_t *vm, u32 to_node_index)
#define CLIB_CACHE_LINE_BYTES
u32 flags
buffer flags: VLIB_BUFFER_IS_TRACED: trace this buffer.
always_inline vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
always_inline u32 vlib_get_buffer_index(vlib_main_t *vm, void *p)
Translate buffer pointer into buffer index.
ip4_address_t * collectors