32 #define NSH_MD2_IOAM_TRACE_SIZE_DUMMY 20
46 u8 data_list_elts_left;
50 }) nsh_md2_ioam_trace_option_t;
54 #define foreach_nsh_md2_ioam_trace_stats \
55 _(SUCCESS, "Pkts updated with TRACE records") \
56 _(FAILED, "Errors in TRACE due to lack of TRACE records")
58 static char *nsh_md2_ioam_trace_stats_strings[] = {
59 #define _(sym,string) string,
66 #define _(sym,str) NSH_MD2_IOAM_TRACE_##sym,
112 u8 *trace_type_p = va_arg (*args,
u8 *);
113 u8 trace_type = *trace_type_p;
118 u32 ttl_node_id_host_byte_order = clib_net_to_host_u32 (*
elt);
119 s =
format (s,
"ttl 0x%x node id 0x%x ",
120 ttl_node_id_host_byte_order >> 24,
121 ttl_node_id_host_byte_order & 0x00FFFFFF);
128 u32 ingress_host_byte_order = clib_net_to_host_u32 (*
elt);
129 s =
format (s,
"ingress 0x%x egress 0x%x ",
130 ingress_host_byte_order >> 16,
131 ingress_host_byte_order & 0xFFFF);
137 u32 ts_in_host_byte_order = clib_net_to_host_u32 (*
elt);
138 s =
format (s,
"ts 0x%x \n", ts_in_host_byte_order);
144 u32 appdata_in_host_byte_order = clib_net_to_host_u32 (*
elt);
145 s =
format (s,
"app 0x%x ", appdata_in_host_byte_order);
157 nsh_md2_ioam_trace_option_t *trace_option = NULL;
158 u8 trace_data_size = 0;
159 u8 trace_option_elts = 0;
172 trace_option_elts = profile->
num_elts;
175 trace_option = (nsh_md2_ioam_trace_option_t *) rewrite_string;
176 trace_option->class = clib_host_to_net_u16 (0x9);
178 trace_option->length = (trace_option_elts * trace_data_size) + 4;
179 trace_option->data_list_elts_left = trace_option_elts;
180 trace_option->ioam_trace_type =
184 sizeof (nsh_md2_ioam_trace_option_t) +
185 (trace_option_elts * trace_data_size);
193 nsh_tlv_header_t * opt)
196 nsh_md2_ioam_trace_option_t *
trace =
197 (nsh_md2_ioam_trace_option_t *) ((
u8 *) opt);
204 u16 ioam_trace_type = 0;
219 trace->data_list_elts_left--;
224 trace->data_list_elts_left *
230 *
elt = clib_host_to_net_u32 (((ip0->
ttl - 1) << 24) |
241 *
elt = clib_host_to_net_u32 (*
elt);
254 *
elt = clib_host_to_net_u32 (time_u64.
as_u32[0]);
265 (NSH_MD2_IOAM_TRACE_SUCCESS, 1);
270 (NSH_MD2_IOAM_TRACE_FAILED, 1);
280 nsh_md2_ioam_trace_option_t *
trace;
281 u8 trace_data_size_in_words = 0;
284 u16 ioam_trace_type = 0;
286 trace = (nsh_md2_ioam_trace_option_t *) ((
u8 *) opt);
287 ioam_trace_type = clib_net_to_host_u16 (
trace->ioam_trace_type);
291 format (s,
" Trace Type 0x%x , %d elts left\n", ioam_trace_type,
292 trace->data_list_elts_left);
296 s =
format (s,
" [%d] %U\n", elt_index,
299 elt += trace_data_size_in_words;
306 nsh_tlv_header_t * old_opt,
307 nsh_tlv_header_t * new_opt)
311 new_opt->length + sizeof (nsh_tlv_header_t));
326 s =
format (s,
" %s - %lu\n", nsh_md2_ioam_trace_stats_strings[
i],
338 .path =
"show ioam nsh-lisp-gpe trace",
339 .short_help =
"iOAM trace statistics",
359 gm->unix_time_0 = (
u32) time (0);
365 (clib_host_to_net_u16 (0x9),
374 (
"registration of NSH_MD2_IOAM_OPTION_TYPE_TRACE failed"));
382 .runs_after =
VLIB_INITS (
"nsh_init",
"nsh_md2_ioam_init"),
401 u8 trace_data_size = 0;
415 return VNET_API_ERROR_INVALID_VALUE;
418 return VNET_API_ERROR_INVALID_VALUE;
421 sizeof (nsh_md2_ioam_trace_option_t) +
422 profile->
num_elts * trace_data_size;