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 131 u16 size_of_all_traceopts;
132 u8 size_of_traceopt_per_node;
134 u32 *start_elt, *end_elt, *uturn_elt;;
135 u32 start_time, end_time;
140 if (size_of_traceopt_per_node == 0)
142 size_of_all_traceopts = trace_len;
144 num_nodes = (
u8) (size_of_all_traceopts / size_of_traceopt_per_node);
145 if ((num_nodes == 0) || (num_nodes <= trace->data_list_elts_left))
148 num_nodes -= trace->data_list_elts_left;
150 start_elt = trace->elts;
153 (
u32) ((size_of_traceopt_per_node /
sizeof (
u32)) * (num_nodes - 1));
160 uturn_elt = start_elt - size_of_traceopt_per_node /
sizeof (
u32);
162 if ((clib_net_to_host_u32 (*start_elt) >> 24) <=
163 (clib_net_to_host_u32 (*uturn_elt) >> 24))
166 while (!done && (start_elt = uturn_elt) != end_elt);
178 start_time = clib_net_to_host_u32 (*start_elt);
179 end_time = clib_net_to_host_u32 (*end_elt);
181 return (
f64) (end_time - start_time);
192 while (__sync_lock_test_and_set (data->
writer_lock, 1))
204 path = trace_record->
path;
206 for (k = 0; k < trace_record->
num_nodes; k++)
207 path[k].state_up = 0;
214 ioam_trace_hdr_t *
trace,
u16 trace_len)
219 u8 i, j, k, num_nodes, max_nodes;
222 u16 ingress_if, egress_if;
223 u16 size_of_traceopt_per_node;
224 u16 size_of_all_traceopts;
226 while (__sync_lock_test_and_set (data->
writer_lock, 1))
232 if (0 == size_of_traceopt_per_node)
235 size_of_all_traceopts = trace_len;
237 ptr = (
u8 *) trace->elts;
238 max_nodes = (
u8) (size_of_all_traceopts / size_of_traceopt_per_node);
239 num_nodes = max_nodes - trace->data_list_elts_left;
244 path = trace_record->
path;
249 for (j = max_nodes, k = 0; k < num_nodes; j--, k++)
252 (
u8 *) ((
u8 *) trace->elts +
253 (size_of_traceopt_per_node * (j - 1)));
255 nodeid = clib_net_to_host_u32 (*((
u32 *) ptr)) & 0x00ffffff;
258 if (nodeid != path[k].node_id)
264 ingress_if = clib_net_to_host_u16 (*((
u16 *) ptr));
266 egress_if = clib_net_to_host_u16 (*((
u16 *) ptr));
267 if ((ingress_if != path[k].ingress_if) ||
268 (egress_if != path[k].egress_if))
283 ioam_trace_hdr_t *
trace,
u16 pak_len,
287 u16 size_of_traceopt_per_node;
288 u16 size_of_all_traceopts;
289 u8 i, j, k, num_nodes, max_nodes;
292 u16 ingress_if, egress_if;
296 while (__sync_lock_test_and_set (data->
writer_lock, 1))
303 if (size_of_traceopt_per_node == 0)
305 size_of_all_traceopts = trace_len;
307 ptr = (
u8 *) trace->elts;
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) ||
317 (trace->ioam_trace_type != trace_record->
trace_type))
320 path = trace_record->
path;
322 for (j = max_nodes, k = 0; k < num_nodes; j--, k++)
325 (
u8 *) ((
u8 *) trace->elts +
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))
361 trace_record->
trace_type = trace->ioam_trace_type;
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;
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)
416 ioam_e2e_packet_t * e2e,
u16 len)
418 while (__sync_lock_test_and_set (data->
writer_lock, 1))
422 (
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",
u32 bytes_counter
Num of bytes in the flow going over path.
u8 pad[3]
log2 (size of the packing page block)
sll srl srl sll sra u16x4 i
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)
static vlib_cli_command_t trace
(constructor) VLIB_CLI_COMMAND (trace)
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)
#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]