45 #define foreach_ip6_hop_by_hop_ioam_trace_stats \ 46 _(PROCESSED, "Pkts with ip6 hop-by-hop trace options") \ 47 _(PROFILE_MISS, "Pkts with ip6 hop-by-hop trace options but no profile set") \ 48 _(UPDATED, "Pkts with trace updated") \ 49 _(FULL, "Pkts with trace options but no space") 52 #define _(sym,string) string, 59 #define _(sym,str) IP6_IOAM_TRACE_##sym, 90 u32 *elt = va_arg (*args,
u32 *);
91 u8 *trace_type_p = va_arg (*args,
u8 *);
92 u8 trace_type = *trace_type_p;
97 u32 ttl_node_id_host_byte_order = clib_net_to_host_u32 (*elt);
98 s =
format (s,
"ttl 0x%x node id 0x%x ",
99 ttl_node_id_host_byte_order >> 24,
100 ttl_node_id_host_byte_order & 0x00FFFFFF);
107 u32 ingress_host_byte_order = clib_net_to_host_u32 (*elt);
108 s =
format (s,
"ingress 0x%x egress 0x%x ",
109 ingress_host_byte_order >> 16,
110 ingress_host_byte_order & 0xFFFF);
116 u32 ts_in_host_byte_order = clib_net_to_host_u32 (*elt);
117 s =
format (s,
"ts 0x%x \n", ts_in_host_byte_order);
123 u32 appdata_in_host_byte_order = clib_net_to_host_u32 (*elt);
124 s =
format (s,
"app 0x%x ", appdata_in_host_byte_order);
136 u8 trace_data_size = 0;
151 return VNET_API_ERROR_INVALID_VALUE;
154 return VNET_API_ERROR_INVALID_VALUE;
157 sizeof (ioam_trace_option_t) + (profile->
num_elts * trace_data_size);
169 ioam_trace_option_t *trace_option =
NULL;
170 u8 trace_data_size = 0;
171 u8 trace_option_elts = 0;
186 trace_option_elts = profile->
num_elts;
188 trace_option = (ioam_trace_option_t *) rewrite_string;
191 trace_option->hdr.length = 2 +
192 trace_option_elts * trace_data_size;
194 trace_option->data_list_elts_left = trace_option_elts;
196 sizeof (ioam_trace_option_t) + (trace_option_elts * trace_data_size);
210 ioam_trace_option_t *
trace = (ioam_trace_option_t *) opt;
232 trace->data_list_elts_left--;
237 trace->data_list_elts_left *
239 elt = &trace->elts[elt_index];
251 (adj->rewrite_header.sw_if_index & 0xFFFF);
252 *elt = clib_host_to_net_u32 (*elt);
264 *elt = clib_host_to_net_u32 (time_u64.
as_u32[0]);
271 *elt = clib_host_to_net_u32 (profile->
app_data);
287 ioam_trace_option_t *
trace;
288 u8 trace_data_size_in_words = 0;
292 trace = (ioam_trace_option_t *) opt;
295 format (s,
" Trace Type 0x%x , %d elts left ts msb(s) 0x%x\n",
296 trace->ioam_trace_type, trace->data_list_elts_left,
300 format (s,
" Trace Type 0x%x , %d elts left\n", trace->ioam_trace_type,
301 trace->data_list_elts_left);
302 trace_data_size_in_words =
304 elt = &trace->elts[0];
305 while ((
u8 *) elt < ((
u8 *) (&trace->elts[0]) + trace->hdr.length - 2
308 s =
format (s,
" [%d] %U\n", elt_index,
310 elt, &trace->ioam_trace_type);
312 elt += trace_data_size_in_words;
342 .path =
"show ioam trace",
343 .short_help =
"iOAM trace statistics",
374 (
"registration of HBH_OPTION_TYPE_IOAM_TRACE_DATA_LIST failed"));
378 sizeof (ioam_trace_option_t),
382 (
"registration of HBH_OPTION_TYPE_IOAM_TRACE_DATA_LIST for rewrite failed"));
sll srl srl sll sra u16x4 i
static vlib_cli_command_t trace
(constructor) VLIB_CLI_COMMAND (trace)
#define foreach_ip6_hop_by_hop_ioam_trace_stats
static f64 vlib_time_now(vlib_main_t *vm)
int ip6_hbh_register_option(u8 option, int options(vlib_buffer_t *b, ip6_header_t *ip, ip6_hop_by_hop_option_t *opt), u8 *trace(u8 *s, ip6_hop_by_hop_option_t *opt))
vnet_main_t * vnet_get_main(void)
#define VLIB_INIT_FUNCTION(x)
int ip6_hop_by_hop_ioam_trace_rewrite_handler(u8 *rewrite_string, u8 *rewrite_size)
ip6_hop_by_hop_ioam_trace_main_t ip6_hop_by_hop_ioam_trace_main
static u32 counter_index(vlib_main_t *vm, vlib_error_t e)
#define vlib_call_init_function(vm, x)
ip6_hop_by_hop_ioam_main_t ip6_hop_by_hop_ioam_main
int ioam_trace_get_sizeof_handler(u32 *result)
#define clib_error_create(args...)
static u8 fetch_trace_data_size(u8 trace_type)
static u8 * format_ioam_data_list_element(u8 *s, va_list *args)
int ip6_hbh_ioam_trace_data_list_handler(vlib_buffer_t *b, ip6_header_t *ip, ip6_hop_by_hop_option_t *opt)
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
clib_error_t * ip_main_init(vlib_main_t *vm)
#define vec_free(V)
Free vector's memory (no header).
static char * ip6_hop_by_hop_ioam_trace_stats_strings[]
static void ip6_ioam_trace_stats_increment_counter(u32 counter_index, u64 increment)
static clib_error_t * ip6_show_ioam_trace_cmd_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
#define BIT_ING_INTERFACE
#define VLIB_CLI_COMMAND(x,...)
ip_lookup_main_t lookup_main
static trace_profile * trace_profile_find(void)
#define HBH_OPTION_TYPE_IOAM_TRACE_DATA_LIST
#define HBH_OPTION_TYPE_DATA_CHANGE_ENROUTE
static clib_error_t * ip6_hop_by_hop_ioam_trace_init(vlib_main_t *vm)
int ip6_hbh_add_register_option(u8 option, u8 size, int rewrite_options(u8 *rewrite_string, u8 *rewrite_size))
static clib_error_t * ip6_lookup_init(vlib_main_t *vm)
static f64 trace_tsp_mul[4]
u8 * ip6_hbh_ioam_trace_data_list_trace_handler(u8 *s, ip6_hop_by_hop_option_t *opt)
static ip_adjacency_t * ip_get_adjacency(ip_lookup_main_t *lm, u32 adj_index)
u64 counters[ARRAY_LEN(ip6_hop_by_hop_ioam_trace_stats_strings)]