16 #ifndef PLUGINS_IOAM_PLUGIN_IOAM_ANALYSE_IOAM_ANALYSE_H_ 17 #define PLUGINS_IOAM_PLUGIN_IOAM_ANALYSE_IOAM_ANALYSE_H_ 26 #define IOAM_FLOW_TEMPLATE_ID 260 27 #define IOAM_TRACE_MAX_NODES 10 28 #define IOAM_MAX_PATHS_PER_FLOW 10 133 u16 size_of_all_traceopts;
134 u8 size_of_traceopt_per_node;
136 u32 *start_elt, *end_elt, *uturn_elt;;
137 u32 start_time, end_time;
142 if (size_of_traceopt_per_node == 0)
144 size_of_all_traceopts = trace_len;
146 num_nodes = (
u8) (size_of_all_traceopts / size_of_traceopt_per_node);
147 if ((num_nodes == 0) || (num_nodes <= trace->data_list_elts_left))
150 num_nodes -= trace->data_list_elts_left;
152 start_elt = trace->elts;
155 (
u32) ((size_of_traceopt_per_node /
sizeof (
u32)) * (num_nodes - 1));
162 uturn_elt = start_elt - size_of_traceopt_per_node /
sizeof (
u32);
164 if ((clib_net_to_host_u32 (*start_elt) >> 24) <=
165 (clib_net_to_host_u32 (*uturn_elt) >> 24))
168 while (!done && (start_elt = uturn_elt) != end_elt);
180 start_time = clib_net_to_host_u32 (*start_elt);
181 end_time = clib_net_to_host_u32 (*end_elt);
183 return (
f64) (end_time - start_time);
194 while (__sync_lock_test_and_set (data->
writer_lock, 1))
206 path = trace_record->
path;
208 for (k = 0; k < trace_record->
num_nodes; k++)
209 path[k].state_up = 0;
216 ioam_trace_hdr_t *
trace,
u16 trace_len)
221 u8 i, j, k, num_nodes, max_nodes;
224 u16 ingress_if, egress_if;
225 u16 size_of_traceopt_per_node;
226 u16 size_of_all_traceopts;
228 while (__sync_lock_test_and_set (data->
writer_lock, 1))
234 if (0 == size_of_traceopt_per_node)
237 size_of_all_traceopts = trace_len;
239 ptr = (
u8 *) trace->elts;
240 max_nodes = (
u8) (size_of_all_traceopts / size_of_traceopt_per_node);
241 num_nodes = max_nodes - trace->data_list_elts_left;
246 path = trace_record->
path;
251 for (j = max_nodes, k = 0; k < num_nodes; j--, k++)
254 (
u8 *) ((
u8 *) trace->elts +
255 (size_of_traceopt_per_node * (j - 1)));
257 nodeid = clib_net_to_host_u32 (*((
u32 *) ptr)) & 0x00ffffff;
260 if (nodeid != path[k].node_id)
266 ingress_if = clib_net_to_host_u16 (*((
u16 *) ptr));
268 egress_if = clib_net_to_host_u16 (*((
u16 *) ptr));
269 if ((ingress_if != path[k].ingress_if) ||
270 (egress_if != path[k].egress_if))
285 ioam_trace_hdr_t *
trace,
u16 pak_len,
289 u16 size_of_traceopt_per_node;
290 u16 size_of_all_traceopts;
291 u8 i, j, k, num_nodes, max_nodes;
294 u16 ingress_if, egress_if;
298 while (__sync_lock_test_and_set (data->
writer_lock, 1))
305 if (size_of_traceopt_per_node == 0)
307 size_of_all_traceopts = trace_len;
309 ptr = (
u8 *) trace->elts;
310 max_nodes = (
u8) (size_of_all_traceopts / size_of_traceopt_per_node);
311 num_nodes = max_nodes - trace->data_list_elts_left;
318 (num_nodes != trace_record->
num_nodes) ||
319 (trace->ioam_trace_type != trace_record->
trace_type))
322 path = trace_record->
path;
324 for (j = max_nodes, k = 0; k < num_nodes; j--, k++)
327 (
u8 *) ((
u8 *) trace->elts +
328 (size_of_traceopt_per_node * (j - 1)));
330 nodeid = clib_net_to_host_u32 (*((
u32 *) ptr)) & 0x00ffffff;
333 if (nodeid != path[k].node_id)
339 ingress_if = clib_net_to_host_u16 (*((
u16 *) ptr));
341 egress_if = clib_net_to_host_u16 (*((
u16 *) ptr));
342 if ((ingress_if != path[k].ingress_if) ||
343 (egress_if != path[k].egress_if))
363 trace_record->
trace_type = trace->ioam_trace_type;
374 for (j = max_nodes, k = 0; k < num_nodes; j--, k++)
377 (
u8 *) ((
u8 *) trace->elts + (size_of_traceopt_per_node * (j - 1)));
379 path[k].
node_id = clib_net_to_host_u32 (*((
u32 *) ptr)) & 0x00ffffff;
387 path[k].
egress_if = clib_net_to_host_u16 (*((
u16 *) ptr));
393 for (k = 0; k < num_nodes; k++)
394 path[k].state_up = 1;
402 if (delay < trace_record->min_delay)
404 else if (delay > trace_record->
max_delay)
418 ioam_e2e_packet_t * e2e,
u16 len)
420 while (__sync_lock_test_and_set (data->
writer_lock, 1))
424 (
u64) clib_net_to_host_u32 (e2e->e2e_data));
434 u32 num_of_elts = va_arg (*args,
u32);
437 for (i = 0; i < num_of_elts; i++)
441 "node_id: 0x%x, ingress_if: 0x%x, egress_if:0x%x, state:%s\n",
460 s =
format (s,
"Trace data: \n");
478 s =
format (s,
"\nPOT data: \n");
479 s =
format (s,
"sfc_validated_count : %u\n",
481 s =
format (s,
"sfc_invalidated_count : %u\n",
484 s =
format (s,
"\nSeqno Data:\n");
487 "Lost Packets : %lu\n" 488 "Duplicate Packets : %lu\n" 489 "Reordered Packets : %lu\n",
u32 bytes_counter
Num of bytes in the flow going over path.
static vlib_cli_command_t trace
(constructor) VLIB_CLI_COMMAND (trace)
u8 pad[3]
log2 (size of the packing page block)
u32 max_delay
Maximum Dealay for the flow.
static int ip6_ioam_analyse_hbh_e2e(ioam_analyser_data_t *data, ioam_e2e_packet_t *e2e, u16 len)
static u8 * print_analyse_flow(u8 *s, ioam_analyser_data_t *record)
ioam_path_map_t path[IOAM_TRACE_MAX_NODES]
Actual PATH flow has taken.
u32 min_delay
Minumum Dealay for the flow.
#define TRACE_TYPE_IF_TS_APP
seqno_rx_info seqno_data
Analysed iOAM seqno data.
u32 bytes_counter
Num of bytes matching this flow.
static void ioam_analyse_init_data(ioam_analyser_data_t *data)
ioam_analyse_pot_data pot_data
Analysed iOAM pot data.
volatile u32 * writer_lock
Lock to since we use this to export the data in other thread.
#define IOAM_TRACE_MAX_NODES
u32 pkt_sent
Num of pkts sent for this flow.
static u8 fetch_trace_data_size(u16 trace_type)
static f64 ip6_ioam_analyse_calc_delay(ioam_trace_hdr_t *trace, u16 trace_len, u8 oneway)
CLIB_CACHE_LINE_ALIGN_MARK(cacheline0)
#define vec_validate_aligned(V, I, A)
Make sure vector is long enough for given index (no header, specified alignment)
static void ioam_analyze_seqno(seqno_rx_info *seqno_rx, u64 seqno)
Analysed iOAM trace data.
static void ip6_ioam_analyse_set_paths_down(ioam_analyser_data_t *data)
u32 pkt_counter
Num of pkts in the flow going over path.
u32 pkt_counter
Num of pkts matching this flow.
static u8 * format_path_map(u8 *s, va_list *args)
#define IOAM_MAX_PATHS_PER_FLOW
ioam_analyse_trace_data trace_data
Analysed iOAM trace data.
u32 sfc_invalidated_count
Number of packets invalidated (failed through the service chain) within the timestamps.
struct ioam_analyser_data_t_ * chached_data_list
Cache of previously analysed data, useful for export.
#define BIT_ING_INTERFACE
struct ioam_analyser_data_t_ ioam_analyser_data_t
Analysed iOAM data.
u32 sfc_validated_count
Number of packets validated (passes through the service chain) within the timestamps.
u8 trace_type
Data contained in trace - NodeId, TTL, Ingress & Egress Link, Timestamp.
static int ip6_ioam_analyse_hbh_trace(ioam_analyser_data_t *data, ioam_trace_hdr_t *trace, u16 pak_len, u16 trace_len)
static void * clib_mem_alloc_aligned(uword size, uword align)
u8 is_free
Flag to indicate whether node is allocated.
u8 num_nodes
No of nodes in path.
static void ip6_ioam_analyse_hbh_trace_loopback(ioam_analyser_data_t *data, ioam_trace_hdr_t *trace, u16 trace_len)
u32 mean_delay
Average Dealay for the flow.
#define CLIB_CACHE_LINE_BYTES
ioam_analyse_trace_record path_data[IOAM_MAX_PATHS_PER_FLOW]