16 #ifndef PLUGINS_IOAM_PLUGIN_IOAM_ANALYSE_IOAM_ANALYSE_H_
17 #define PLUGINS_IOAM_PLUGIN_IOAM_ANALYSE_IOAM_ANALYSE_H_
27 #define IOAM_FLOW_TEMPLATE_ID 260
28 #define IOAM_TRACE_MAX_NODES 10
29 #define IOAM_MAX_PATHS_PER_FLOW 10
134 u16 size_of_all_traceopts;
135 u8 size_of_traceopt_per_node;
137 u32 *start_elt, *end_elt, *uturn_elt;;
138 u32 start_time, end_time;
143 if (size_of_traceopt_per_node == 0)
145 size_of_all_traceopts = trace_len;
147 num_nodes = (
u8) (size_of_all_traceopts / size_of_traceopt_per_node);
148 if ((num_nodes == 0) || (num_nodes <=
trace->data_list_elts_left))
151 num_nodes -=
trace->data_list_elts_left;
153 start_elt =
trace->elts;
156 (
u32) ((size_of_traceopt_per_node /
sizeof (
u32)) * (num_nodes - 1));
163 uturn_elt = start_elt - size_of_traceopt_per_node /
sizeof (
u32);
165 if ((clib_net_to_host_u32 (*start_elt) >> 24) <=
166 (clib_net_to_host_u32 (*uturn_elt) >> 24))
169 while (!done && (start_elt = uturn_elt) != end_elt);
181 start_time = clib_net_to_host_u32 (*start_elt);
182 end_time = clib_net_to_host_u32 (*end_elt);
184 return (
f64) (end_time - start_time);
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;
233 if (0 == size_of_traceopt_per_node)
236 size_of_all_traceopts = trace_len;
239 max_nodes = (
u8) (size_of_all_traceopts / size_of_traceopt_per_node);
240 num_nodes = max_nodes -
trace->data_list_elts_left;
250 for (j = max_nodes, k = 0; k < num_nodes; j--, k++)
254 (size_of_traceopt_per_node * (j - 1)));
256 nodeid = clib_net_to_host_u32 (*((
u32 *) ptr)) & 0x00ffffff;
259 if (nodeid !=
path[k].node_id)
265 ingress_if = clib_net_to_host_u16 (*((
u16 *) ptr));
267 egress_if = clib_net_to_host_u16 (*((
u16 *) ptr));
268 if ((ingress_if !=
path[k].ingress_if) ||
269 (egress_if !=
path[k].egress_if))
275 path[k].state_up = 1;
284 ioam_trace_hdr_t *
trace,
u16 pak_len,
288 u16 size_of_traceopt_per_node;
289 u16 size_of_all_traceopts;
290 u8 i, j, k, num_nodes, max_nodes;
293 u16 ingress_if, egress_if;
303 if (size_of_traceopt_per_node == 0)
305 size_of_all_traceopts = trace_len;
308 max_nodes = (
u8) (size_of_all_traceopts / size_of_traceopt_per_node);
309 num_nodes = max_nodes -
trace->data_list_elts_left;
316 (num_nodes != trace_record->
num_nodes) ||
322 for (j = max_nodes, k = 0; k < num_nodes; j--, k++)
326 (size_of_traceopt_per_node * (j - 1)));
328 nodeid = clib_net_to_host_u32 (*((
u32 *) ptr)) & 0x00ffffff;
331 if (nodeid !=
path[k].node_id)
337 ingress_if = clib_net_to_host_u16 (*((
u16 *) ptr));
339 egress_if = clib_net_to_host_u16 (*((
u16 *) ptr));
340 if ((ingress_if !=
path[k].ingress_if) ||
341 (egress_if !=
path[k].egress_if))
372 for (j = max_nodes, k = 0; k < num_nodes; j--, k++)
375 (
u8 *) ((
u8 *)
trace->elts + (size_of_traceopt_per_node * (j - 1)));
377 path[k].node_id = clib_net_to_host_u32 (*((
u32 *) ptr)) & 0x00ffffff;
383 path[k].ingress_if = clib_net_to_host_u16 (*((
u16 *) ptr));
385 path[k].egress_if = clib_net_to_host_u16 (*((
u16 *) ptr));
391 for (k = 0; k < num_nodes; k++)
392 path[k].state_up = 1;
400 if (delay < trace_record->min_delay)
402 else if (delay > trace_record->
max_delay)
407 (
u32) ((sum + delay) / (
data->seqno_data.rx_packets + 1));
416 ioam_e2e_packet_t * e2e,
u16 len)
421 (
u64) clib_net_to_host_u32 (e2e->e2e_data));
432 u32 num_of_elts = va_arg (*args,
u32);
435 for (
i = 0;
i < num_of_elts;
i++)
439 "node_id: 0x%x, ingress_if: 0x%x, egress_if:0x%x, state:%s\n",
458 s =
format (s,
"Trace data: \n");
476 s =
format (s,
"\nPOT data: \n");
477 s =
format (s,
"sfc_validated_count : %u\n",
479 s =
format (s,
"sfc_invalidated_count : %u\n",
482 s =
format (s,
"\nSeqno Data:\n");
485 "Lost Packets : %lu\n"
486 "Duplicate Packets : %lu\n"
487 "Reordered Packets : %lu\n",