diff options
Diffstat (limited to 'plugins/ioam-plugin/ioam/lib-trace')
-rw-r--r-- | plugins/ioam-plugin/ioam/lib-trace/trace_api.c | 2 | ||||
-rw-r--r-- | plugins/ioam-plugin/ioam/lib-trace/trace_util.c | 35 | ||||
-rw-r--r-- | plugins/ioam-plugin/ioam/lib-trace/trace_util.h | 21 |
3 files changed, 16 insertions, 42 deletions
diff --git a/plugins/ioam-plugin/ioam/lib-trace/trace_api.c b/plugins/ioam-plugin/ioam/lib-trace/trace_api.c index 32c8e23fae3..e35bb7c4243 100644 --- a/plugins/ioam-plugin/ioam/lib-trace/trace_api.c +++ b/plugins/ioam-plugin/ioam/lib-trace/trace_api.c @@ -105,7 +105,6 @@ static void vl_api_trace_profile_add_t_handler int rv = 0; vl_api_trace_profile_add_reply_t *rmp; trace_profile *profile = NULL; - u8 *name = 0; profile = trace_profile_find (); if (profile) @@ -122,7 +121,6 @@ static void vl_api_trace_profile_add_t_handler rv = -3; } ERROROUT: - vec_free (name); TRACE_REPLY_MACRO (VL_API_TRACE_PROFILE_ADD_REPLY); } diff --git a/plugins/ioam-plugin/ioam/lib-trace/trace_util.c b/plugins/ioam-plugin/ioam/lib-trace/trace_util.c index adc02b20f56..5c7f1eefd9c 100644 --- a/plugins/ioam-plugin/ioam/lib-trace/trace_util.c +++ b/plugins/ioam-plugin/ioam/lib-trace/trace_util.c @@ -21,22 +21,13 @@ trace_main_t trace_main; -extern ip6_hop_by_hop_ioam_main_t ip6_hop_by_hop_ioam_main; - static int trace_profile_cleanup (trace_profile * profile) { - int rv; - ip6_hop_by_hop_ioam_main_t *hm = &ip6_hop_by_hop_ioam_main; memset (profile, 0, sizeof (trace_profile)); profile->trace_tsp = TSP_MICROSECONDS; /* Micro seconds */ - hm->options_size[HBH_OPTION_TYPE_IOAM_TRACE_DATA_LIST] = 0; - if (0 != - (rv = - ip6_ioam_set_rewrite (&hm->rewrite, hm->has_trace_option, - hm->has_pot_option, hm->has_seqno_option))) - return (-1); + ip6_trace_profile_cleanup (); /* lib-trace_TODO: Remove this once IOAM-IPv6 transport is a plugin */ return 0; } @@ -65,10 +56,11 @@ int trace_profile_create (trace_profile * profile, u8 trace_type, u8 num_elts, u32 trace_tsp, u32 node_id, u32 app_data) { - u32 trace_size = 0; - int rv; - ip6_hop_by_hop_ioam_main_t *hm = &ip6_hop_by_hop_ioam_main; + if (!trace_type || !num_elts || !(node_id)) + { + return (-1); + } if (profile && !profile->valid) { //rv = trace_profile_cleanup (profile); @@ -79,21 +71,8 @@ trace_profile_create (trace_profile * profile, u8 trace_type, u8 num_elts, profile->app_data = app_data; profile->valid = 1; - if (ioam_trace_get_sizeof_handler (&trace_size) < 0) - return (-1); - - hm->options_size[HBH_OPTION_TYPE_IOAM_TRACE_DATA_LIST] = trace_size; - - if (hm->has_trace_option) - { - if (0 != - (rv = - ip6_ioam_set_rewrite (&hm->rewrite, hm->has_trace_option, - hm->has_pot_option, - hm->has_seqno_option))) - return (-1); - - } + /* lib-trace_TODO: Remove this once IOAM-IPv6 transport is a plugin */ + ip6_trace_profile_setup (); return (0); } diff --git a/plugins/ioam-plugin/ioam/lib-trace/trace_util.h b/plugins/ioam-plugin/ioam/lib-trace/trace_util.h index 4528b18a8b0..556f07ee3f1 100644 --- a/plugins/ioam-plugin/ioam/lib-trace/trace_util.h +++ b/plugins/ioam-plugin/ioam/lib-trace/trace_util.h @@ -18,7 +18,6 @@ #ifndef include_vnet_trace_util_h #define include_vnet_trace_util_h -#include <vnet/ip/ip6_hop_by_hop.h> #define debug_ioam debug_ioam_fn @@ -72,9 +71,8 @@ int trace_util_init (void); /* - * Find a trace profile by ID + * Find a trace profile */ -always_inline trace_profile *trace_profile_find (void); always_inline trace_profile * trace_profile_find (void) @@ -209,15 +207,6 @@ typedef struct } ioam_trace_ts_app_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* */ - static inline u8 fetch_trace_data_size (u8 trace_type) @@ -239,6 +228,14 @@ fetch_trace_data_size (u8 trace_type) } int ioam_trace_get_sizeof_handler (u32 * result); +int ip6_trace_profile_setup (void); +int ip6_trace_profile_cleanup (void); + +#define TSP_SECONDS 0 +#define TSP_MILLISECONDS 1 +#define TSP_MICROSECONDS 2 +#define TSP_NANOSECONDS 3 + #endif /* |