|
FD.io VPP
v21.06-3-gbb25fbf28
Vector Packet Processing
|
Go to the documentation of this file.
18 #include <vpp/app/version.h>
50 #define foreach_ip6_hop_by_hop_ioam_trace_stats \
51 _(PROCESSED, "Pkts with ip6 hop-by-hop trace options") \
52 _(PROFILE_MISS, "Pkts with ip6 hop-by-hop trace options but no profile set") \
53 _(UPDATED, "Pkts with trace updated") \
54 _(FULL, "Pkts with trace options but no space") \
55 _(LOOPBACK, "Pkts with trace options Loopback") \
56 _(LOOPBACK_REPLY, "Pkts with trace options Loopback Reply")
59 #define _(sym,string) string,
66 #define _(sym,str) IP6_IOAM_TRACE_##sym,
98 u8 *trace_type_p = va_arg (*args,
u8 *);
99 u8 trace_type = *trace_type_p;
104 u32 ttl_node_id_host_byte_order = clib_net_to_host_u32 (*
elt);
105 s =
format (s,
"ttl 0x%x node id 0x%x ",
106 ttl_node_id_host_byte_order >> 24,
107 ttl_node_id_host_byte_order & 0x00FFFFFF);
114 u32 ingress_host_byte_order = clib_net_to_host_u32 (*
elt);
115 s =
format (s,
"ingress 0x%x egress 0x%x ",
116 ingress_host_byte_order >> 16,
117 ingress_host_byte_order & 0xFFFF);
123 u32 ts_in_host_byte_order = clib_net_to_host_u32 (*
elt);
124 s =
format (s,
"ts 0x%x \n", ts_in_host_byte_order);
130 u32 appdata_in_host_byte_order = clib_net_to_host_u32 (*
elt);
131 s =
format (s,
"app 0x%x ", appdata_in_host_byte_order);
143 u8 trace_data_size = 0;
158 return VNET_API_ERROR_INVALID_VALUE;
161 return VNET_API_ERROR_INVALID_VALUE;
164 sizeof (ioam_trace_option_t) + (profile->
num_elts * trace_data_size);
176 ioam_trace_option_t *trace_option = NULL;
177 u8 trace_data_size = 0;
178 u8 trace_option_elts = 0;
193 trace_option_elts = profile->
num_elts;
195 trace_option = (ioam_trace_option_t *) rewrite_string;
198 trace_option->hdr.length = 2 +
199 trace_option_elts * trace_data_size;
200 trace_option->trace_hdr.ioam_trace_type =
202 trace_option->trace_hdr.data_list_elts_left = trace_option_elts;
204 sizeof (ioam_trace_option_t) + (trace_option_elts * trace_data_size);
211 ioam_trace_option_t *
trace)
221 ioam_trace_option_t *opt;
239 opt = (ioam_trace_option_t *)
246 *to_next = buf_index;
260 ioam_trace_option_t *
trace = (ioam_trace_option_t *) opt;
289 trace->trace_hdr.data_list_elts_left--;
294 trace->trace_hdr.data_list_elts_left *
296 elt = &
trace->trace_hdr.elts[elt_index];
300 clib_host_to_net_u32 ((
ip->hop_limit << 24) | profile->
node_id);
308 (adj->rewrite_header.sw_if_index & 0xFFFF);
309 *
elt = clib_host_to_net_u32 (*
elt);
321 *
elt = clib_host_to_net_u32 (time_u64.
as_u32[0]);
353 ioam_trace_option_t *
trace;
354 u8 trace_data_size_in_words = 0;
358 trace = (ioam_trace_option_t *) opt;
360 format (s,
" Trace Type 0x%x , %d elts left\n",
361 trace->trace_hdr.ioam_trace_type,
362 trace->trace_hdr.data_list_elts_left);
363 trace_data_size_in_words =
367 ((
u8 *) (&
trace->trace_hdr.elts[0]) +
trace->hdr.length - 2
370 s =
format (s,
" [%d] %U\n", elt_index,
372 elt, &
trace->trace_hdr.ioam_trace_type);
374 elt += trace_data_size_in_words;
404 .path =
"show ioam trace",
405 .short_help =
"iOAM trace statistics",
412 .version = VPP_BUILD_VER,
413 .description =
"Inbound Operations, Administration, and Maintenance (OAM)",
432 (
"registration of HBH_OPTION_TYPE_IOAM_TRACE_DATA_LIST failed"));
436 sizeof (ioam_trace_option_t),
440 (
"registration of HBH_OPTION_TYPE_IOAM_TRACE_DATA_LIST for rewrite failed"));
449 .runs_after =
VLIB_INITS (
"ip_main_init",
"ip6_lookup_init",
450 "ip6_hop_by_hop_ioam_init"),
static vlib_cli_command_t trace
(constructor) VLIB_CLI_COMMAND (trace)
static vlib_buffer_t * vlib_buffer_copy(vlib_main_t *vm, vlib_buffer_t *b)
static clib_error_t * ip6_hop_by_hop_ioam_trace_init(vlib_main_t *vm)
static trace_profile * trace_profile_find(void)
static void udp_ping_create_reply_from_probe_ip6(ip6_header_t *ip, ip6_hop_by_hop_header_t *hbh, udp_ping_t *udp)
Create and send ipv6 udp-ping response packet.
ip6_hop_by_hop_ioam_trace_main_t ip6_hop_by_hop_ioam_trace_main
#define foreach_ip6_hop_by_hop_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)
int ip6_trace_profile_setup(void)
vlib_frame_t * vlib_get_frame_to_node(vlib_main_t *vm, u32 to_node_index)
static f64 trace_tsp_mul[4]
static void ip6_hbh_ioam_trace_set_bit(ioam_trace_option_t *trace, u8 trace_bit)
int ip6_hop_by_hop_ioam_trace_rewrite_handler(u8 *rewrite_string, u8 *rewrite_size)
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))
void vlib_put_frame_to_node(vlib_main_t *vm, u32 to_node_index, vlib_frame_t *f)
#define clib_error_create(args...)
static ip6_hop_by_hop_option_t * ip6_hbh_get_option(ip6_hop_by_hop_header_t *hbh0, u8 option_to_search)
static clib_error_t * ip6_show_ioam_trace_cmd_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
vnet_main_t * vnet_get_main(void)
static u32 vlib_get_buffer_index(vlib_main_t *vm, void *p)
Translate buffer pointer into buffer index.
static void * vlib_frame_vector_args(vlib_frame_t *f)
Get pointer to frame vector data.
u64 counters[ARRAY_LEN(ip6_hop_by_hop_ioam_trace_stats_strings)]
static void ip6_ioam_trace_stats_increment_counter(u32 counter_index, u64 increment)
static vlib_cli_command_t ip6_show_ioam_trace_cmd
(constructor) VLIB_CLI_COMMAND (ip6_show_ioam_trace_cmd)
sll srl srl sll sra u16x4 i
#define VLIB_CLI_COMMAND(x,...)
void vlib_cli_output(vlib_main_t *vm, char *fmt,...)
ip6_hop_by_hop_ioam_main_t ip6_hop_by_hop_ioam_main
#define vec_free(V)
Free vector's memory (no header).
static void ip6_hbh_ioam_loopback_handler(vlib_buffer_t *b, ip6_header_t *ip, ioam_trace_option_t *trace)
vlib_node_t * vlib_get_node_by_name(vlib_main_t *vm, u8 *name)
#define BIT_LOOPBACK_REPLY
int ip6_hbh_ioam_trace_data_list_handler(vlib_buffer_t *b, ip6_header_t *ip, ip6_hop_by_hop_option_t *opt)
description fragment has unexpected format
static char * ip6_hop_by_hop_ioam_trace_stats_strings[]
#define VLIB_INIT_FUNCTION(x)
#define BIT_ING_INTERFACE
static u8 * format_ioam_data_list_element(u8 *s, va_list *args)
int ip6_trace_profile_cleanup(void)
#define HBH_OPTION_TYPE_DATA_CHANGE_ENROUTE
clib_memset(h->entries, 0, sizeof(h->entries[0]) *entries)
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)
static f64 vlib_time_now(vlib_main_t *vm)
u8 options_size[MAX_IP6_HBH_OPTION]
u8 * ip6_hbh_ioam_trace_data_list_trace_handler(u8 *s, ip6_hop_by_hop_option_t *opt)
static u8 fetch_trace_data_size(u16 trace_type)
int ip6_hbh_add_register_option(u8 option, u8 size, int rewrite_options(u8 *rewrite_string, u8 *rewrite_size))
static ip_adjacency_t * adj_get(adj_index_t adj_index)
Get a pointer to an adjacency object from its index.
#define HBH_OPTION_TYPE_IOAM_TRACE_DATA_LIST
VLIB buffer representation.
int ip6_ioam_trace_get_sizeof_handler(u32 *result)