47 u8 data_list_elts_left;
49 }) vxlan_gpe_ioam_trace_option_t;
53 #define foreach_vxlan_gpe_ioam_trace_stats \ 54 _(SUCCESS, "Pkts updated with TRACE records") \ 55 _(FAILED, "Errors in TRACE due to lack of TRACE records") 57 static char *vxlan_gpe_ioam_trace_stats_strings[] = {
58 #define _(sym,string) string, 65 #define _(sym,str) VXLAN_GPE_IOAM_TRACE_##sym, 87 int rewrite_options (
u8 * rewrite_string,
125 u8 is_ipv4,
u8 use_adj),
174 u32 *elt = va_arg (*args,
u32 *);
175 u8 *trace_type_p = va_arg (*args,
u8 *);
176 u8 trace_type = *trace_type_p;
181 u32 ttl_node_id_host_byte_order = clib_net_to_host_u32 (*elt);
182 s =
format (s,
"ttl 0x%x node id 0x%x ",
183 ttl_node_id_host_byte_order >> 24,
184 ttl_node_id_host_byte_order & 0x00FFFFFF);
191 u32 ingress_host_byte_order = clib_net_to_host_u32 (*elt);
192 s =
format (s,
"ingress 0x%x egress 0x%x ",
193 ingress_host_byte_order >> 16,
194 ingress_host_byte_order & 0xFFFF);
200 u32 ts_in_host_byte_order = clib_net_to_host_u32 (*elt);
201 s =
format (s,
"ts 0x%x \n", ts_in_host_byte_order);
207 u32 appdata_in_host_byte_order = clib_net_to_host_u32 (*elt);
208 s =
format (s,
"app 0x%x ", appdata_in_host_byte_order);
220 vxlan_gpe_ioam_trace_option_t *trace_option =
NULL;
221 u8 trace_data_size = 0;
222 u8 trace_option_elts = 0;
236 trace_option_elts = profile->
num_elts;
238 trace_option = (vxlan_gpe_ioam_trace_option_t *) rewrite_string;
240 trace_option->hdr.length = 2 +
241 trace_option_elts * trace_data_size;
243 trace_option->data_list_elts_left = trace_option_elts;
245 sizeof (vxlan_gpe_ioam_trace_option_t) +
246 (trace_option_elts * trace_data_size);
255 u8 is_ipv4,
u8 use_adj)
258 vxlan_gpe_ioam_trace_option_t *
trace =
259 (vxlan_gpe_ioam_trace_option_t *) opt;
279 trace->data_list_elts_left--;
284 trace->data_list_elts_left *
286 elt = &trace->elts[elt_index];
296 *elt = clib_host_to_net_u32 (((ip0->
ttl - 1 + use_adj) << 24) |
309 tx_if = adj->rewrite_header.sw_if_index & 0xFFFF;
315 *elt = clib_host_to_net_u32 (*elt);
324 *elt = clib_host_to_net_u32 ((ip0->
hop_limit << 24) |
336 tx_if = adj->rewrite_header.sw_if_index & 0xFFFF;
342 *elt = clib_host_to_net_u32 (*elt);
355 *elt = clib_host_to_net_u32 (time_u64.
as_u32[0]);
362 *elt = clib_host_to_net_u32 (profile->
app_data);
366 (VXLAN_GPE_IOAM_TRACE_SUCCESS, 1);
371 (VXLAN_GPE_IOAM_TRACE_FAILED, 1);
380 vxlan_gpe_ioam_trace_option_t *
trace;
381 u8 trace_data_size_in_words = 0;
385 trace = (vxlan_gpe_ioam_trace_option_t *) opt;
387 format (s,
" Trace Type 0x%x , %d elts left\n", trace->ioam_trace_type,
388 trace->data_list_elts_left);
389 trace_data_size_in_words =
391 elt = &trace->elts[0];
392 while ((
u8 *) elt < ((
u8 *) (&trace->elts[0]) + trace->hdr.length - 2
395 s =
format (s,
" [%d] %U\n", elt_index,
397 elt, &trace->ioam_trace_type);
399 elt += trace_data_size_in_words;
416 s =
format (s,
" %s - %lu\n", vxlan_gpe_ioam_trace_stats_strings[i],
428 .path =
"show ioam vxlan-gpe trace",
429 .short_help =
"iOAM trace statistics",
459 (
"registration of VXLAN_GPE_OPTION_TYPE_IOAM_TRACE failed"));
464 sizeof (vxlan_gpe_ioam_trace_option_t),
467 (
"registration of VXLAN_GPE_OPTION_TYPE_IOAM_TRACE for rewrite failed"));
490 u8 trace_data_size = 0;
504 return VNET_API_ERROR_INVALID_VALUE;
507 return VNET_API_ERROR_INVALID_VALUE;
510 sizeof (vxlan_gpe_ioam_trace_option_t) +
511 profile->
num_elts * trace_data_size;
static void vxlan_gpe_ioam_trace_stats_increment_counter(u32 counter_index, u64 increment)
sll srl srl sll sra u16x4 i
clib_error_t * vxlan_gpe_init(vlib_main_t *vm)
Feature init function for VXLAN GPE.
static vlib_cli_command_t trace
(constructor) VLIB_CLI_COMMAND (trace)
vnet_main_t * vnet_get_main(void)
vlib_main_t * vlib_main
State convenience vlib_main_t.
static int vxlan_gpe_ioam_trace_get_sizeof_handler(u32 *result)
static f64 vlib_time_now(vlib_main_t *vm)
static u8 fetch_trace_data_size(u16 trace_type)
static trace_profile * trace_profile_find(void)
typedef CLIB_PACKED(struct{vxlan_gpe_ioam_option_t hdr;u8 ioam_trace_type;u8 data_list_elts_left;u32 elts[0];})
static ip_adjacency_t * adj_get(adj_index_t adj_index)
Get a pointer to an adjacency object from its index.
static clib_error_t * vxlan_gpe_ioam_trace_init(vlib_main_t *vm)
#define VLIB_INIT_FUNCTION(x)
static u32 counter_index(vlib_main_t *vm, vlib_error_t e)
vxlan_gpe_ioam_main_t vxlan_gpe_ioam_main
int vxlan_gpe_ioam_trace_rewrite_handler(u8 *rewrite_string, u8 *rewrite_size)
#define clib_error_create(args...)
int vxlan_gpe_trace_profile_setup(void)
int vxlan_gpe_ioam_register_option(u8 option, int options(vlib_buffer_t *b, vxlan_gpe_ioam_option_t *opt, u8 is_ipv4, u8 use_adj), u8 *trace(u8 *s, vxlan_gpe_ioam_option_t *opt))
#define vlib_call_init_function(vm, x)
int vxlan_gpe_ioam_add_register_option(u8 option, u8 size, int rewrite_options(u8 *rewrite_string, u8 *rewrite_size))
VXLAN GPE packet header structure.
u64 counters[ARRAY_LEN(vxlan_gpe_ioam_trace_stats_strings)]
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
#define VXLAN_GPE_OPTION_TYPE_IOAM_TRACE
#define foreach_vxlan_gpe_ioam_trace_stats
The fine-grained event logger allows lightweight, thread-safe event logging at minimum cost...
clib_error_t * ip_main_init(vlib_main_t *vm)
static clib_error_t * vxlan_gpe_show_ioam_trace_cmd_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
vxlan_gpe_ioam_trace_main_t vxlan_gpe_ioam_trace_main
#define vec_free(V)
Free vector's memory (no header).
#define BIT_ING_INTERFACE
#define VLIB_CLI_COMMAND(x,...)
int(* add_options[256])(u8 *rewrite_string, u8 *rewrite_size)
int vxlan_gpe_ioam_unregister_option(u8 option)
int vxlan_gpe_trace_profile_cleanup(void)
int(* options[256])(vlib_buffer_t *b, vxlan_gpe_ioam_option_t *opt, u8 is_ipv4, u8 use_adj)
vxlan_gpe_ioam_trace_stats_t
u8 * vxlan_gpe_ioam_trace_data_list_trace_handler(u8 *s, vxlan_gpe_ioam_option_t *opt)
int vxlan_gpe_ioam_trace_data_list_handler(vlib_buffer_t *b, vxlan_gpe_ioam_option_t *opt, u8 is_ipv4, u8 use_adj)
static f64 trace_tsp_mul[4]
int vxlan_gpe_add_unregister_option(u8 option)
static clib_error_t * ip6_lookup_init(vlib_main_t *vm)
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
u8 *(* trace[256])(u8 *s, vxlan_gpe_ioam_option_t *opt)
static u8 * format_ioam_data_list_element(u8 *s, va_list *args)