|
FD.io VPP
v21.06-3-gbb25fbf28
Vector Packet Processing
|
Go to the documentation of this file.
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;
static vlib_cli_command_t trace
(constructor) VLIB_CLI_COMMAND (trace)
int nsh_md2_ioam_trace_rewrite_handler(u8 *rewrite_string, u8 *rewrite_size)
nsh_md2_ioam_trace_stats_t
static int nsh_md2_ioam_trace_get_sizeof_handler(u32 *result)
#define foreach_nsh_md2_ioam_trace_stats
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)
static_always_inline void * clib_memcpy_fast(void *restrict dst, const void *restrict src, size_t n)
int nsh_md2_ioam_trace_profile_setup(void)
static clib_error_t * nsh_md2_ioam_show_ioam_trace_cmd_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
u8 options_size[MAX_MD2_OPTIONS]
static trace_profile * nsh_trace_profile_find(void)
#define clib_error_create(args...)
nsh_md2_ioam_main_t nsh_md2_ioam_main
vnet_main_t * vnet_get_main(void)
#define NSH_MD2_IOAM_OPTION_TYPE_TRACE
static vlib_cli_command_t nsh_md2_ioam_show_ioam_trace_cmd
(constructor) VLIB_CLI_COMMAND (nsh_md2_ioam_show_ioam_trace_cmd)
static clib_error_t * nsh_md2_ioam_trace_init(vlib_main_t *vm)
int nsh_md2_ioam_trace_pop_handler(vlib_buffer_t *b, nsh_tlv_header_t *opt)
int nsh_md2_ioam_trace_data_list_handler(vlib_buffer_t *b, nsh_tlv_header_t *opt)
sll srl srl sll sra u16x4 i
#define VLIB_CLI_COMMAND(x,...)
static u8 * format_ioam_data_list_element(u8 *s, va_list *args)
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
static void nsh_md2_ioam_trace_stats_increment_counter(u32 counter_index, u64 increment)
int nsh_md2_ioam_trace_profile_cleanup(void)
#define vec_free(V)
Free vector's memory (no header).
static f64 trace_tsp_mul[4]
int nsh_md2_register_option(u16 class, u8 type, u8 option_size, int add_options(u8 *opt, u8 *opt_size), int options(vlib_buffer_t *b, nsh_tlv_header_t *opt), int swap_options(vlib_buffer_t *b, nsh_tlv_header_t *old_opt, nsh_tlv_header_t *new_opt), int pop_options(vlib_buffer_t *b, nsh_tlv_header_t *opt), u8 *trace(u8 *s, nsh_tlv_header_t *opt))
description fragment has unexpected format
int nsh_md2_ioam_trace_swap_handler(vlib_buffer_t *b, nsh_tlv_header_t *old_opt, nsh_tlv_header_t *new_opt)
#define VLIB_INIT_FUNCTION(x)
#define BIT_ING_INTERFACE
nsh_md2_ioam_trace_main_t nsh_md2_ioam_trace_main
u8 * nsh_md2_ioam_trace_data_list_trace_handler(u8 *s, nsh_tlv_header_t *opt)
u64 counters[ARRAY_LEN(nsh_md2_ioam_trace_stats_strings)]
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
@ NSH_MD2_IOAM_TRACE_N_STATS
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)
typedef CLIB_PACKED(struct { u16 class;u8 type;u8 length;u8 data_list_elts_left;u16 ioam_trace_type;u8 reserve;u32 elts[0];})
static f64 vlib_time_now(vlib_main_t *vm)
#define NSH_MD2_IOAM_TRACE_SIZE_DUMMY
static u8 fetch_trace_data_size(u16 trace_type)
vl_api_fib_path_type_t type
VLIB buffer representation.