|
FD.io VPP
v21.06-3-gbb25fbf28
Vector Packet Processing
|
Go to the documentation of this file.
46 u8 data_list_elts_left;
48 }) vxlan_gpe_ioam_trace_option_t;
52 #define foreach_vxlan_gpe_ioam_trace_stats \
53 _(SUCCESS, "Pkts updated with TRACE records") \
54 _(FAILED, "Errors in TRACE due to lack of TRACE records")
56 static char *vxlan_gpe_ioam_trace_stats_strings[] = {
57 #define _(sym,string) string,
64 #define _(sym,str) VXLAN_GPE_IOAM_TRACE_##sym,
86 int rewrite_options (
u8 * rewrite_string,
124 u8 is_ipv4,
u8 use_adj),
133 if (
im->options[option])
154 hm->
trace[option] = NULL;
174 u8 *trace_type_p = va_arg (*args,
u8 *);
175 u8 trace_type = *trace_type_p;
180 u32 ttl_node_id_host_byte_order = clib_net_to_host_u32 (*
elt);
181 s =
format (s,
"ttl 0x%x node id 0x%x ",
182 ttl_node_id_host_byte_order >> 24,
183 ttl_node_id_host_byte_order & 0x00FFFFFF);
190 u32 ingress_host_byte_order = clib_net_to_host_u32 (*
elt);
191 s =
format (s,
"ingress 0x%x egress 0x%x ",
192 ingress_host_byte_order >> 16,
193 ingress_host_byte_order & 0xFFFF);
199 u32 ts_in_host_byte_order = clib_net_to_host_u32 (*
elt);
200 s =
format (s,
"ts 0x%x \n", ts_in_host_byte_order);
206 u32 appdata_in_host_byte_order = clib_net_to_host_u32 (*
elt);
207 s =
format (s,
"app 0x%x ", appdata_in_host_byte_order);
219 vxlan_gpe_ioam_trace_option_t *trace_option = NULL;
220 u8 trace_data_size = 0;
221 u8 trace_option_elts = 0;
235 trace_option_elts = profile->
num_elts;
237 trace_option = (vxlan_gpe_ioam_trace_option_t *) rewrite_string;
239 trace_option->hdr.length = 2 +
240 trace_option_elts * trace_data_size;
242 trace_option->data_list_elts_left = trace_option_elts;
244 sizeof (vxlan_gpe_ioam_trace_option_t) +
245 (trace_option_elts * trace_data_size);
254 u8 is_ipv4,
u8 use_adj)
257 vxlan_gpe_ioam_trace_option_t *
trace =
258 (vxlan_gpe_ioam_trace_option_t *) opt;
278 trace->data_list_elts_left--;
283 trace->data_list_elts_left *
295 *
elt = clib_host_to_net_u32 (((ip0->
ttl - 1 + use_adj) << 24) |
308 tx_if = adj->rewrite_header.sw_if_index & 0xFFFF;
314 *
elt = clib_host_to_net_u32 (*
elt);
335 tx_if = adj->rewrite_header.sw_if_index & 0xFFFF;
341 *
elt = clib_host_to_net_u32 (*
elt);
354 *
elt = clib_host_to_net_u32 (time_u64.
as_u32[0]);
365 (VXLAN_GPE_IOAM_TRACE_SUCCESS, 1);
370 (VXLAN_GPE_IOAM_TRACE_FAILED, 1);
379 vxlan_gpe_ioam_trace_option_t *
trace;
380 u8 trace_data_size_in_words = 0;
384 trace = (vxlan_gpe_ioam_trace_option_t *) opt;
386 format (s,
" Trace Type 0x%x , %d elts left\n",
trace->ioam_trace_type,
387 trace->data_list_elts_left);
388 trace_data_size_in_words =
394 s =
format (s,
" [%d] %U\n", elt_index,
398 elt += trace_data_size_in_words;
415 s =
format (s,
" %s - %lu\n", vxlan_gpe_ioam_trace_stats_strings[
i],
427 .path =
"show ioam vxlan-gpe trace",
428 .short_help =
"iOAM trace statistics",
448 (
"registration of VXLAN_GPE_OPTION_TYPE_IOAM_TRACE failed"));
453 sizeof (vxlan_gpe_ioam_trace_option_t),
456 (
"registration of VXLAN_GPE_OPTION_TYPE_IOAM_TRACE for rewrite failed"));
465 .runs_after =
VLIB_INITS(
"ip_main_init",
"ip6_lookup_init",
486 u8 trace_data_size = 0;
500 return VNET_API_ERROR_INVALID_VALUE;
503 return VNET_API_ERROR_INVALID_VALUE;
506 sizeof (vxlan_gpe_ioam_trace_option_t) +
507 profile->
num_elts * trace_data_size;
vnet_interface_main_t * im
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))
static vlib_cli_command_t trace
(constructor) VLIB_CLI_COMMAND (trace)
vxlan_gpe_ioam_trace_stats_t
static trace_profile * trace_profile_find(void)
int vxlan_gpe_ioam_add_register_option(u8 option, u8 size, int rewrite_options(u8 *rewrite_string, u8 *rewrite_size))
vxlan_gpe_ioam_main_t vxlan_gpe_ioam_main
static clib_error_t * vxlan_gpe_show_ioam_trace_cmd_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
int vxlan_gpe_trace_profile_cleanup(void)
vlib_main_t * vlib_main
State convenience vlib_main_t.
vlib_main_t * vm
X-connect all packets from the HOST to the PHY.
static u32 counter_index(vlib_main_t *vm, vlib_error_t e)
@ VXLAN_GPE_IOAM_TRACE_N_STATS
u64 counters[ARRAY_LEN(vxlan_gpe_ioam_trace_stats_strings)]
#define foreach_vxlan_gpe_ioam_trace_stats
static vlib_cli_command_t vxlan_gpe_show_ioam_trace_cmd
(constructor) VLIB_CLI_COMMAND (vxlan_gpe_show_ioam_trace_cmd)
int vxlan_gpe_add_unregister_option(u8 option)
u8 * vxlan_gpe_ioam_trace_data_list_trace_handler(u8 *s, vxlan_gpe_ioam_option_t *opt)
#define clib_error_create(args...)
static clib_error_t * vxlan_gpe_ioam_trace_init(vlib_main_t *vm)
vnet_main_t * vnet_get_main(void)
vxlan_gpe_ioam_trace_main_t vxlan_gpe_ioam_trace_main
static void vxlan_gpe_ioam_trace_stats_increment_counter(u32 counter_index, u64 increment)
sll srl srl sll sra u16x4 i
#define VLIB_CLI_COMMAND(x,...)
int vxlan_gpe_trace_profile_setup(void)
int vxlan_gpe_ioam_unregister_option(u8 option)
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
static int vxlan_gpe_ioam_trace_get_sizeof_handler(u32 *result)
#define vec_free(V)
Free vector's memory (no header).
VXLAN GPE packet header structure.
int(* add_options[256])(u8 *rewrite_string, u8 *rewrite_size)
static u8 * format_ioam_data_list_element(u8 *s, va_list *args)
description fragment has unexpected format
#define VLIB_INIT_FUNCTION(x)
static struct option options[]
int vxlan_gpe_ioam_trace_rewrite_handler(u8 *rewrite_string, u8 *rewrite_size)
#define BIT_ING_INTERFACE
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
typedef CLIB_PACKED(struct { vxlan_gpe_ioam_option_t hdr;u8 ioam_trace_type;u8 data_list_elts_left;u32 elts[0];})
static void * vlib_buffer_get_current(vlib_buffer_t *b)
Get pointer to current data to process.
clib_error_t *() vlib_init_function_t(struct vlib_main_t *vm)
int(* options[256])(vlib_buffer_t *b, vxlan_gpe_ioam_option_t *opt, u8 is_ipv4, u8 use_adj)
static f64 vlib_time_now(vlib_main_t *vm)
#define VXLAN_GPE_OPTION_TYPE_IOAM_TRACE
u8 *(* trace[256])(u8 *s, vxlan_gpe_ioam_option_t *opt)
static u8 fetch_trace_data_size(u16 trace_type)
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 ip_adjacency_t * adj_get(adj_index_t adj_index)
Get a pointer to an adjacency object from its index.
static f64 trace_tsp_mul[4]
VLIB buffer representation.