From 6d403a013276f095e542c9b6281db96354fa6f07 Mon Sep 17 00:00:00 2001 From: Vengada Govindan Date: Wed, 12 Oct 2016 05:54:09 -0700 Subject: VPP-470: Introduce VxLAN-GPE as transport for iOAM. See Jira ticket for more details - New plugins created to (a) Add VxLAN-GPE as transport (b) Provide export infra for VxLAN-GPE. Change-Id: Ife50c7434f53d17a4783062310f73d063d53494c Signed-off-by: Vengada Govindan --- plugins/ioam-plugin/ioam/encap/ip6_ioam_trace.c | 56 +++++++++++++++++++++---- 1 file changed, 49 insertions(+), 7 deletions(-) (limited to 'plugins/ioam-plugin/ioam/encap/ip6_ioam_trace.c') diff --git a/plugins/ioam-plugin/ioam/encap/ip6_ioam_trace.c b/plugins/ioam-plugin/ioam/encap/ip6_ioam_trace.c index 16e10817d00..e63db6e4ec5 100644 --- a/plugins/ioam-plugin/ioam/encap/ip6_ioam_trace.c +++ b/plugins/ioam-plugin/ioam/encap/ip6_ioam_trace.c @@ -38,6 +38,15 @@ typedef union u32 as_u32[2]; } time_u64_t; +/* *INDENT-OFF* */ +typedef CLIB_PACKED(struct { + ip6_hop_by_hop_option_t hdr; + u8 ioam_trace_type; + u8 data_list_elts_left; + u32 elts[0]; /* Variable type. So keep it generic */ +}) ioam_trace_option_t; +/* *INDENT-ON* */ + extern ip6_hop_by_hop_ioam_main_t ip6_hop_by_hop_ioam_main; extern ip6_main_t ip6_main; @@ -130,7 +139,7 @@ format_ioam_data_list_element (u8 * s, va_list * args) int -ioam_trace_get_sizeof_handler (u32 * result) +ip6_ioam_trace_get_sizeof_handler (u32 * result) { u16 size = 0; u8 trace_data_size = 0; @@ -290,12 +299,6 @@ ip6_hbh_ioam_trace_data_list_trace_handler (u8 * s, int elt_index = 0; trace = (ioam_trace_option_t *) opt; -#if 0 - s = - format (s, " Trace Type 0x%x , %d elts left ts msb(s) 0x%x\n", - trace->ioam_trace_type, trace->data_list_elts_left, - t->timestamp_msbs); -#endif s = format (s, " Trace Type 0x%x , %d elts left\n", trace->ioam_trace_type, trace->data_list_elts_left); @@ -385,6 +388,45 @@ ip6_hop_by_hop_ioam_trace_init (vlib_main_t * vm) return (0); } +int +ip6_trace_profile_cleanup (void) +{ + ip6_hop_by_hop_ioam_main_t *hm = &ip6_hop_by_hop_ioam_main; + + hm->options_size[HBH_OPTION_TYPE_IOAM_TRACE_DATA_LIST] = 0; + + return 0; + +} + + +int +ip6_trace_profile_setup (void) +{ + u32 trace_size = 0; + ip6_hop_by_hop_ioam_main_t *hm = &ip6_hop_by_hop_ioam_main; + + trace_profile *profile = NULL; + + + profile = trace_profile_find (); + + if (PREDICT_FALSE (!profile)) + { + ip6_ioam_trace_stats_increment_counter (IP6_IOAM_TRACE_PROFILE_MISS, 1); + return (-1); + } + + + if (ip6_ioam_trace_get_sizeof_handler (&trace_size) < 0) + return (-1); + + hm->options_size[HBH_OPTION_TYPE_IOAM_TRACE_DATA_LIST] = trace_size; + + return (0); +} + + VLIB_INIT_FUNCTION (ip6_hop_by_hop_ioam_trace_init); /* -- cgit 1.2.3-korg