45 #define foreach_li_hit_error \ 46 _(HITS, "LI packets processed") \ 47 _(NO_COLLECTOR, "No collector configured") \ 48 _(BUFFER_ALLOCATION_FAILURE, "Buffer allocation failure") 52 #define _(sym,str) LI_HIT_ERROR_##sym, 59 #define _(sym,string) string, 73 u32 n_left_from, *from, *to_next;
80 n_left_from =
frame->n_vectors;
81 next_index =
node->cached_next_index;
86 LI_HIT_ERROR_NO_COLLECTOR, n_left_from);
95 while (n_left_from > 0)
102 while (n_left_from >= 4 && n_left_to_next >= 2)
104 u32 next0 = LI_HIT_NEXT_INTERFACE_OUTPUT;
105 u32 next1 = LI_HIT_NEXT_INTERFACE_OUTPUT;
106 u32 sw_if_index0, sw_if_index1;
127 to_next[0] = bi0 = from[0];
128 to_next[1] = bi1 = from[1];
155 if (b0->
flags & VLIB_BUFFER_IS_TRACED)
159 t->sw_if_index = sw_if_index0;
162 if (b1->
flags & VLIB_BUFFER_IS_TRACED)
166 t->sw_if_index = sw_if_index1;
173 to_next, n_left_to_next,
174 bi0, bi1, next0, next1);
178 while (n_left_from > 0 && n_left_to_next > 0)
183 ip4_udp_header_t *iu0;
205 (vm,
node->node_index,
206 LI_HIT_ERROR_BUFFER_ALLOCATION_FAILURE, 1);
226 clib_host_to_net_u16 (lm->
ports[0]);
237 && (b0->
flags & VLIB_BUFFER_IS_TRACED)))
245 to_next, n_left_to_next,
259 LI_HIT_ERROR_HITS,
frame->n_vectors);
260 return frame->n_vectors;
266 .vector_size =
sizeof (
u32),
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index, VLIB_BUFFER_IS_TRACED: trace this buffer.
i16 current_data
signed offset in data[], pre_data[] that we are currently processing.
#define VLIB_NODE_FN(node)
static u8 * format_li_hit_trace(u8 *s, va_list *args)
static uword vlib_buffer_length_in_chain(vlib_main_t *vm, vlib_buffer_t *b)
Get length in bytes of the buffer chain.
static vlib_buffer_t * vlib_buffer_copy(vlib_main_t *vm, vlib_buffer_t *b)
vlib_node_registration_t li_hit_node
(constructor) VLIB_REGISTER_NODE (li_hit_node)
vlib_node_registration_t ip4_lookup_node
(constructor) VLIB_REGISTER_NODE (ip4_lookup_node)
#define vlib_prefetch_buffer_header(b, type)
Prefetch buffer metadata.
vlib_frame_t * vlib_get_frame_to_node(vlib_main_t *vm, u32 to_node_index)
#define foreach_li_hit_error
static u32 vlib_get_buffer_index(vlib_main_t *vm, void *p)
Translate buffer pointer into buffer index.
vl_api_fib_path_type_t type
void vlib_put_frame_to_node(vlib_main_t *vm, u32 to_node_index, vlib_frame_t *f)
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)
The fine-grained event logger allows lightweight, thread-safe event logging at minimum cost...
static char * li_hit_error_strings[]
#define VLIB_REGISTER_NODE(x,...)
#define CLIB_PREFETCH(addr, size, type)
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.
vlib_main_t vlib_node_runtime_t * node
static void vlib_buffer_advance(vlib_buffer_t *b, word l)
Advance current data pointer by the supplied (signed!) amount.
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
ip4_address_t * src_addrs
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
VLIB buffer representation.
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
vlib_main_t vlib_node_runtime_t vlib_frame_t * frame
#define VLIB_NODE_FLAG_TRACE
#define CLIB_CACHE_LINE_BYTES
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
static u16 ip4_header_checksum(ip4_header_t *i)
ip4_address_t * collectors