aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/ioam-plugin/ioam/encap/ip6_ioam_trace.c
diff options
context:
space:
mode:
authorVengada Govindan <venggovi@cisco.com>2016-10-12 05:54:09 -0700
committerVengada Govindan <venggovi@cisco.com>2016-12-09 06:15:02 +0000
commit6d403a013276f095e542c9b6281db96354fa6f07 (patch)
tree3954b21a8fe2bb789d42f6f6234344d39c4e1e4d /plugins/ioam-plugin/ioam/encap/ip6_ioam_trace.c
parentc9b20bc7a5399fd1e7bf2d33e7c4f1f08ef1c1e4 (diff)
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 <venggovi@cisco.com>
Diffstat (limited to 'plugins/ioam-plugin/ioam/encap/ip6_ioam_trace.c')
-rw-r--r--plugins/ioam-plugin/ioam/encap/ip6_ioam_trace.c56
1 files changed, 49 insertions, 7 deletions
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);
/*