38 #define foreach_analyse_error \ 39 _(ANALYSED, "Packets analysed for summarization") \ 40 _(FAILED, "Packets analysis failed") \ 44 #define _(sym,str) ANALYSE_ERROR_##sym, 51 #define _(sym,string) string, 73 s =
format (s,
"IP6-ioam-analyse: flow_id %d, next index %d",
105 error0 = ANALYSE_ERROR_FAILED;
144 u32 n_left_from, *from, *to_next;
145 analyse_next_t next_index;
146 u32 pkts_analysed = 0;
161 while (n_left_from > 0)
167 while (n_left_from > 0 && n_left_to_next > 0)
173 u16 num_ioam_records;
194 limit = data + clib_net_to_host_u16 (ip40->
length);
200 while (num_ioam_records >= 4)
210 num_ioam_records -= 2;
215 u32 flow_id0, flow_id1;
233 ((hbh0->
length + 1) << 3));
236 ((hbh1->
length + 1) << 3));
259 while (__sync_lock_test_and_set (data0->
writer_lock, 1))
265 while (__sync_lock_test_and_set (data1->
writer_lock, 1))
271 else if (error0 == 0)
277 while (__sync_lock_test_and_set (data0->
writer_lock, 1))
283 else if (error1 == 0)
289 while (__sync_lock_test_and_set (data1->
writer_lock, 1))
299 while (num_ioam_records > 0)
317 ((hbh0->
length + 1) << 3));
330 while (__sync_lock_test_and_set (data0->
writer_lock, 1))
343 n_left_to_next, bi0, next0);
364 ioam_trace_option_t *
trace = (ioam_trace_option_t *) opt;
370 (trace->hdr.length - 2)
381 ioam_pot_option_t *pot0;
390 pot0 = (ioam_pot_option_t *) opt0;
391 random = clib_net_to_host_u64 (pot0->random);
392 cumulative = clib_net_to_host_u64 (pot0->cumulative);
396 while (__sync_lock_test_and_set (data->
writer_lock, 1))
411 ioam_e2e_option_t *e2e;
414 e2e = (ioam_e2e_option_t *) opt;
421 int options (
u32 flow_id,
481 .name =
"ip6-hbh-analyse-local",
482 .vector_size =
sizeof (
u32),
485 .n_errors =
ARRAY_LEN (analyse_error_strings),
501 .name =
"ip6-hbh-analyse-remote",
502 .vector_size =
sizeof (
u32),
505 .n_errors =
ARRAY_LEN (analyse_error_strings),
static pot_profile * pot_profile_get_active(void)
static int ip6_ioam_analyse_hbh_e2e(ioam_analyser_data_t *data, ioam_e2e_packet_t *e2e, u16 len)
static vlib_cli_command_t trace
(constructor) VLIB_CLI_COMMAND (trace)
int ip6_ioam_analyse_hbh_trace_internal(u32 flow_id, ip6_hop_by_hop_option_t *opt, u16 len)
int ip6_ioam_analyse_hbh_pot(u32 flow_id, ip6_hop_by_hop_option_t *opt0, 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)
volatile u32 * writer_lock
Lock to since we use this to export the data in other thread.
struct _vlib_node_registration vlib_node_registration_t
int ip6_ioam_analyse_unregister_hbh_handler(u8 option)
#define HBH_OPTION_TYPE_IOAM_PROOF_OF_TRANSIT
IP6-iOAM analyser main structure.
void ip6_ioam_analyse_unregister_handlers()
#define HBH_OPTION_TYPE_IOAM_EDGE_TO_EDGE
u32 pkt_counter
Num of pkts matching this flow.
ip6_ioam_analyser_main_t ioam_analyser_main
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)
vlib_node_registration_t analyse_node_remote
(constructor) VLIB_REGISTER_NODE (analyse_node_remote)
#define CLIB_PREFETCH(addr, size, type)
static uword ip6_ioam_analyse_node_fn(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame)
IPv6 InBandOAM Analyse node.
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.
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.
#define foreach_analyse_error
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)
int ip6_ioam_analyse_hbh_e2e_internal(u32 flow_id, ip6_hop_by_hop_option_t *opt, u16 len)
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.
static void vlib_buffer_advance(vlib_buffer_t *b, word l)
Advance current data pointer by the supplied (signed!) amount.
#define HBH_OPTION_TYPE_IOAM_TRACE_DATA_LIST
static char * analyse_error_strings[]
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
vlib_node_registration_t analyse_node_local
(constructor) VLIB_REGISTER_NODE (analyse_node_local)
#define VLIB_REGISTER_NODE(x,...)
static vlib_buffer_t * vlib_get_buffer(vlib_main_t *vm, u32 buffer_index)
Translate buffer index into buffer pointer.
void ip6_ioam_analyse_register_handlers()
int ip6_ioam_analyse_register_hbh_handler(u8 option, int options(u32 flow_id, ip6_hop_by_hop_option_t *opt, u16 len))