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);
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;
233 if (0 == size_of_traceopt_per_node)
236 size_of_all_traceopts = trace_len;
238 ptr = (
u8 *) trace->elts;
239 max_nodes = (
u8) (size_of_all_traceopts / size_of_traceopt_per_node);
240 num_nodes = max_nodes - trace->data_list_elts_left;
245 path = trace_record->
path;
250 for (j = max_nodes, k = 0; k < num_nodes; j--, k++)
253 (
u8 *) ((
u8 *) trace->elts +
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))
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;
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)
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",
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_always_inline void clib_spinlock_unlock(clib_spinlock_t *p)
static_always_inline void clib_spinlock_lock(clib_spinlock_t *p)
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.
#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)
static void clib_spinlock_init(clib_spinlock_t *p)
#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.
sll srl srl sll sra u16x4 i
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.
clib_spinlock_t writer_lock
Lock to since we use this to export the data in other thread.
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)
u8 is_free
Flag to indicate whether node is allocated.
u8 num_nodes
No of nodes in path.
f64 end
end of the time range
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]