39 #define foreach_analyse_error \ 40 _(ANALYSED, "Packets analysed for summarization") \ 41 _(FAILED, "Packets analysis failed") \ 45 #define _(sym,str) ANALYSE_ERROR_##sym, 52 #define _(sym,string) string, 74 s =
format (s,
"IP6-ioam-analyse: flow_id %d, next index %d",
106 error0 = ANALYSE_ERROR_FAILED;
145 u32 n_left_from, *from, *to_next;
146 analyse_next_t next_index;
147 u32 pkts_analysed = 0;
162 while (n_left_from > 0)
168 while (n_left_from > 0 && n_left_to_next > 0)
174 u16 num_ioam_records;
195 limit = data + clib_net_to_host_u16 (ip40->
length);
201 while (num_ioam_records >= 4)
211 num_ioam_records -= 2;
216 u32 flow_id0, flow_id1;
234 ((hbh0->
length + 1) << 3));
237 ((hbh1->
length + 1) << 3));
270 else if (error0 == 0)
281 else if (error1 == 0)
296 while (num_ioam_records > 0)
314 ((hbh0->
length + 1) << 3));
339 n_left_to_next, bi0, next0);
360 ioam_trace_option_t *
trace = (ioam_trace_option_t *) opt;
366 (trace->hdr.length - 2)
377 ioam_pot_option_t *pot0;
386 pot0 = (ioam_pot_option_t *) opt0;
387 random = clib_net_to_host_u64 (pot0->random);
388 cumulative = clib_net_to_host_u64 (pot0->cumulative);
406 ioam_e2e_option_t *e2e;
409 e2e = (ioam_e2e_option_t *) opt;
476 .name =
"ip6-hbh-analyse-local",
477 .vector_size =
sizeof (
u32),
480 .n_errors =
ARRAY_LEN (analyse_error_strings),
496 .name =
"ip6-hbh-analyse-remote",
497 .vector_size =
sizeof (
u32),
500 .n_errors =
ARRAY_LEN (analyse_error_strings),
static pot_profile * pot_profile_get_active(void)
static vlib_cli_command_t trace
(constructor) VLIB_CLI_COMMAND (trace)
static_always_inline void clib_spinlock_unlock(clib_spinlock_t *p)
static_always_inline void clib_spinlock_lock(clib_spinlock_t *p)
int ip6_ioam_analyse_hbh_e2e_internal(u32 flow_id, ip6_hop_by_hop_option_t *opt, u16 len)
int ip6_ioam_analyse_unregister_hbh_handler(u8 option)
static int ip6_ioam_analyse_hbh_e2e(ioam_analyser_data_t *data, ioam_e2e_packet_t *e2e, u16 len)
u32 bytes_counter
Num of bytes matching this flow.
ioam_analyse_pot_data pot_data
Analysed iOAM pot data.
static ioam_analyser_data_t * ioam_analyse_get_data_from_flow_id(u32 flow_id)
static char * analyse_error_strings[]
void ip6_ioam_analyse_register_handlers()
#define HBH_OPTION_TYPE_IOAM_PROOF_OF_TRANSIT
int ip6_ioam_analyse_hbh_trace_internal(u32 flow_id, ip6_hop_by_hop_option_t *opt, u16 len)
IP6-iOAM analyser main structure.
#define HBH_OPTION_TYPE_IOAM_EDGE_TO_EDGE
u32 pkt_counter
Num of pkts matching this flow.
vl_api_fib_path_type_t type
int ip6_ioam_analyse_hbh_pot(u32 flow_id, ip6_hop_by_hop_option_t *opt0, u16 len)
static u8 * format_analyse_trace(u8 *s, va_list *args)
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
u32 sfc_invalidated_count
Number of packets invalidated (failed through the service chain) within the timestamps.
u32 node_index
Node index.
u8 pot_validate(pot_profile *profile, u64 cumulative, u64 random)
#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 foreach_analyse_error
#define VLIB_REGISTER_NODE(x,...)
int ip6_ioam_analyse_register_hbh_handler(u8 option, int options(u32 flow_id, ip6_hop_by_hop_option_t *opt, u16 len))
#define CLIB_PREFETCH(addr, size, type)
ip6_ioam_analyser_main_t ioam_analyser_main
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.
void ip6_ioam_analyse_unregister_handlers()
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.
u32 sfc_validated_count
Number of packets validated (passes through the service chain) within the timestamps.
static uword ip6_ioam_analyse_node_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
IPv6 InBandOAM Analyse node.
int(* analyse_hbh_handler[MAX_IP6_HBH_OPTION])(u32 flow_id, ip6_hop_by_hop_option_t *opt, u16 len)
Array of function pointer to analyse each hop-by-hop option.
vlib_node_registration_t analyse_node_local
(constructor) VLIB_REGISTER_NODE (analyse_node_local)
static void vlib_buffer_advance(vlib_buffer_t *b, word l)
Advance current data pointer by the supplied (signed!) amount.
clib_spinlock_t writer_lock
Lock to since we use this to export the data in other thread.
#define HBH_OPTION_TYPE_IOAM_TRACE_DATA_LIST
struct _vlib_node_registration vlib_node_registration_t
vlib_main_t vlib_node_runtime_t vlib_frame_t * frame
VLIB buffer representation.
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
static int ip6_ioam_analyse_hbh_trace(ioam_analyser_data_t *data, ioam_trace_hdr_t *trace, u16 pak_len, u16 trace_len)
#define DEFAULT_EXPORT_SIZE
static struct option options[]
static u8 ioam_analyse_hbh(u32 flow_id, ip6_hop_by_hop_header_t *hbh0, ip6_hop_by_hop_option_t *opt0, ip6_hop_by_hop_option_t *limit0, u16 len)
vlib_node_registration_t analyse_node_remote
(constructor) VLIB_REGISTER_NODE (analyse_node_remote)
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.