65 s =
format (s,
"CACHE: flow_label %d, next index %d",
70 #define foreach_cache_ts_error \ 71 _(RECORDED, "ip6 iOAM headers cached") 75 #define _(sym,str) CACHE_TS_ERROR_##sym, 82 #define _(sym,string) string, 99 u32 n_left_from, *from, *to_next;
107 while (n_left_from > 0)
113 while (n_left_from > 0 && n_left_to_next > 0)
122 u32 cache_ts_index = 0;
123 u8 cache_thread_id = 0;
133 if (IP_PROTOCOL_TCP ==
150 (tcp0->ack_number), &hbh_cmp,
152 &cache_thread_id, 1))
194 if (0 ==
ioam_cache_ts_lookup (ip0, hbh0->
protocol, clib_net_to_host_u16 (tcp0->src_port), clib_net_to_host_u16 (tcp0->dst_port), clib_net_to_host_u32 (tcp0->ack_number), &hbh_cmp, &cache_ts_index, &cache_thread_id, 1))
206 if (p0->
flags & VLIB_BUFFER_IS_TRACED)
223 to_next, n_left_to_next,
231 CACHE_TS_ERROR_RECORDED, recorded);
242 .name =
"ip6-ioam-tunnel-select",
243 .vector_size =
sizeof (
u32),
273 format (s,
"IP6_IOAM_RESET_TUNNEL_SELECT_HBH: next index %d",
278 #define foreach_ip6_reset_ts_hbh_error \ 279 _(PROCESSED, "iOAM Syn/Ack Pkts processed") \ 280 _(SAVED, "iOAM Syn Pkts state saved") \ 281 _(REMOVED, "iOAM Syn/Ack Pkts state removed") 285 #define _(sym,str) IP6_RESET_TS_HBH_ERROR_##sym, 292 #define _(sym,string) string, 297 #define foreach_ip6_ioam_cache_ts_input_next \ 298 _(IP6_LOOKUP, "ip6-lookup") \ 299 _(DROP, "error-drop") 303 #define _(s,n) IP6_IOAM_CACHE_TS_INPUT_NEXT_##s, 315 u32 n_left_from, *from, *to_next;
317 u32 processed = 0, cache_ts_added = 0;
321 ioam_e2e_cache_option_t *e2e = 0;
325 n_left_from =
frame->n_vectors;
326 next_index =
node->cached_next_index;
328 while (n_left_from > 0)
335 while (n_left_from >= 4 && n_left_to_next >= 2)
342 u32 tcp_offset0, tcp_offset1;
344 u64 *copy_src0, *copy_dst0, *copy_src1, *copy_dst1;
346 u32 pool_index0 = 0, pool_index1 = 0;
348 next0 = next1 = IP6_IOAM_CACHE_TS_INPUT_NEXT_IP6_LOOKUP;
364 to_next[0] = bi0 = from[0];
365 to_next[1] = bi1 = from[1];
377 if (IP_PROTOCOL_TCP !=
386 if (no_of_responses > 0)
395 (tcp0->seq_number) + 1,
396 no_of_responses, now,
402 copy_dst0 = (
u64 *) (((
u8 *) ip0) - rewrite_length);
403 copy_src0 = (
u64 *) ip0;
405 copy_dst0[0] = copy_src0[0];
406 copy_dst0[1] = copy_src0[1];
407 copy_dst0[2] = copy_src0[2];
408 copy_dst0[3] = copy_src0[3];
409 copy_dst0[4] = copy_src0[4];
418 (ioam_e2e_cache_option_t *) ((
u8 *) hbh0 +
421 e2e->pool_index = pool_index0;
424 sizeof (ioam_e2e_cache_option_t)),
436 if (IP_PROTOCOL_TCP !=
445 if (no_of_responses > 0)
454 (tcp1->seq_number) + 1,
455 no_of_responses, now,
462 copy_dst1 = (
u64 *) (((
u8 *) ip1) - rewrite_length);
463 copy_src1 = (
u64 *) ip1;
465 copy_dst1[0] = copy_src1[0];
466 copy_dst1[1] = copy_src1[1];
467 copy_dst1[2] = copy_src1[2];
468 copy_dst1[3] = copy_src1[3];
469 copy_dst1[4] = copy_src1[4];
478 (ioam_e2e_cache_option_t *) ((
u8 *) hbh1 +
481 e2e->pool_index = pool_index1;
484 sizeof (ioam_e2e_cache_option_t)),
498 if (b0->
flags & VLIB_BUFFER_IS_TRACED)
504 if (b1->
flags & VLIB_BUFFER_IS_TRACED)
515 to_next, n_left_to_next,
516 bi0, bi1, next0, next1);
518 while (n_left_from > 0 && n_left_to_next > 0)
527 u64 *copy_src0, *copy_dst0;
531 next0 = IP6_IOAM_CACHE_TS_INPUT_NEXT_IP6_LOOKUP;
543 if (IP_PROTOCOL_TCP !=
552 if (no_of_responses > 0)
561 (tcp0->seq_number) + 1,
562 no_of_responses, now,
568 copy_dst0 = (
u64 *) (((
u8 *) ip0) - rewrite_length);
569 copy_src0 = (
u64 *) ip0;
571 copy_dst0[0] = copy_src0[0];
572 copy_dst0[1] = copy_src0[1];
573 copy_dst0[2] = copy_src0[2];
574 copy_dst0[3] = copy_src0[3];
575 copy_dst0[4] = copy_src0[4];
584 (ioam_e2e_cache_option_t *) ((
u8 *) hbh0 +
587 e2e->pool_index = pool_index0;
590 sizeof (ioam_e2e_cache_option_t)),
602 && (b0->
flags & VLIB_BUFFER_IS_TRACED)))
611 to_next, n_left_to_next,
619 IP6_RESET_TS_HBH_ERROR_PROCESSED, processed);
621 IP6_RESET_TS_HBH_ERROR_SAVED, cache_ts_added);
623 return frame->n_vectors;
629 .name =
"ip6-add-syn-hop-by-hop",
630 .vector_size =
sizeof (
u32),
639 #define _(s,n) [IP6_IOAM_CACHE_TS_INPUT_NEXT_##s] = n, 647 #ifndef CLIB_MARCH_VARIANT 665 s =
format (s,
"IOAM_CACHE_TS_TIMER_TICK: thread index %d",
670 #define foreach_ioam_cache_ts_timer_tick_error \ 671 _(TIMER, "Timer events") 675 #define _(sym,str) IOAM_CACHE_TS_TIMER_TICK_ERROR_##sym, 682 #define _(sym,string) string, 687 #ifndef CLIB_MARCH_VARIANT 693 0 ? VLIB_NODE_STATE_DISABLED :
694 VLIB_NODE_STATE_POLLING);
706 for (i = 0; i <
vec_len (expired_timers); i++)
709 pool_index = expired_timers[
i] & 0x0FFFFFFF;
717 IOAM_CACHE_TS_TIMER_TICK_ERROR_TIMER, count);
728 struct timespec ts, tsrem;
730 tw_timer_expire_timers_16t_2w_512sl (&cm->
timer_wheels[my_thread_index],
734 while (nanosleep (&ts, &tsrem) < 0)
744 .name =
"ioam-cache-ts-timer-tick",
753 .state = VLIB_NODE_STATE_DISABLED,
u32 flags
buffer flags: VLIB_BUFFER_FREE_LIST_INDEX_MASK: bits used to store free list index, VLIB_BUFFER_IS_TRACED: trace this buffer.
u8 rewrite_pool_index_offset
ip6_address_t sr_localsid_ts
#define clib_memcpy_fast(a, b, c)
static f64 vlib_time_now(vlib_main_t *vm)
static int ip6_ioam_analyse_compare_path_delay(ip6_hop_by_hop_header_t *hbh0, ip6_hop_by_hop_header_t *hbh1, bool oneway)
#define VLIB_NODE_FN(node)
static int ioam_cache_ts_update(u32 thread_id, i32 pool_index, u32 buffer_index, ip6_hop_by_hop_header_t *hbh)
struct _tcp_header tcp_header_t
ip_lookup_next_t
An adjacency is a representation of an attached L3 peer.
static char * ip6_reset_ts_hbh_error_strings[]
#define foreach_ip6_ioam_cache_ts_input_next
vlib_node_registration_t ioam_cache_ts_node
(constructor) VLIB_REGISTER_NODE (ioam_cache_ts_node)
#define vlib_prefetch_buffer_header(b, type)
Prefetch buffer metadata.
static int ioam_cache_ts_add(ip6_header_t *ip0, u16 src_port, u16 dst_port, u32 seq_no, u8 max_responses, u64 now, u32 thread_id, u32 *pool_index)
#define foreach_ip6_reset_ts_hbh_error
u32 ip6_reset_ts_hbh_node_index
ioam_cache_ts_timer_tick_error_t
tw_timer_wheel_16t_2w_512sl_t * timer_wheels
per thread single-wheel
static void ioam_cache_ts_check_and_send(u32 thread_id, i32 pool_index)
#define foreach_ioam_cache_ts_timer_tick_error
static void ioam_e2e_id_rewrite_handler(ioam_e2e_id_option_t *e2e_option, ip6_address_t *address)
vl_api_fib_path_type_t type
vlib_node_registration_t ip6_reset_ts_hbh_node
(constructor) VLIB_REGISTER_NODE (ip6_reset_ts_hbh_node)
vlib_node_registration_t ioam_cache_ts_timer_tick_node
(constructor) VLIB_REGISTER_NODE (ioam_cache_ts_timer_tick_node)
void ioam_cache_ts_timer_node_enable(vlib_main_t *vm, u8 enable)
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
void expired_cache_ts_timer_callback(u32 *expired_timers)
static int ioam_cache_ts_lookup(ip6_header_t *ip0, u8 protocol, u16 src_port, u16 dst_port, u32 seq_no, ip6_hop_by_hop_header_t **hbh, u32 *pool_index, u8 *thread_id, u8 response_seen)
#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)
static u8 * format_ioam_cache_ts_timer_tick_trace(u8 *s, va_list *args)
#define VLIB_REGISTER_NODE(x,...)
static_always_inline uword vlib_get_thread_index(void)
#define CLIB_PREFETCH(addr, size, type)
sll srl srl sll sra u16x4 i
static u8 * format_cache_ts_trace(u8 *s, va_list *args)
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
u16 cached_next_index
Next frame index that vector arguments were last enqueued to last time this node ran.
ip6_ioam_cache_ts_input_next_t
static uword ioam_cache_ts_timer_tick_node_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *f)
static void vlib_buffer_advance(vlib_buffer_t *b, word l)
Advance current data pointer by the supplied (signed!) amount.
static void vlib_node_set_state(vlib_main_t *vm, u32 node_index, vlib_node_state_t new_state)
Set node dispatch state.
static void ioam_cache_ts_send(u32 thread_id, i32 pool_index)
static int ip6_locate_header(vlib_buffer_t *p0, ip6_header_t *ip0, int find_hdr_type, u32 *offset)
#define foreach_cache_ts_error
struct _vlib_node_registration vlib_node_registration_t
static uword ip6_ioam_cache_ts_node_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
vlib_main_t vlib_node_runtime_t vlib_frame_t * frame
VLIB buffer representation.
static char * cache_ts_error_strings[]
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
ioam_cache_main_t ioam_cache_main
static u8 * format_ip6_reset_ts_hbh_trace(u8 *s, va_list *args)
Segment Routing data structures definitions.
static char * ioam_cache_ts_timer_tick_error_strings[]
u16 flags
Copy of main node flags.
void * vlib_add_trace(vlib_main_t *vm, vlib_node_runtime_t *r, vlib_buffer_t *b, u32 n_data_bytes)
#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.
#define IOAM_CACHE_TS_TICK