From b89609428977fe4ffae4e0823e28942fd4ac4ee8 Mon Sep 17 00:00:00 2001 From: Filip Tehlar Date: Fri, 1 Mar 2019 03:18:58 -0800 Subject: ioam: migrate old MULTIARCH macros to VLIB_NODE_FN Change-Id: Icb919a053b35ef62f958c60c725d3aae4c32358f Signed-off-by: Filip Tehlar --- src/plugins/ioam/CMakeLists.txt | 4 ++++ src/plugins/ioam/ip6/ioam_cache.c | 7 +++++++ src/plugins/ioam/ip6/ioam_cache.h | 3 +++ src/plugins/ioam/ip6/ioam_cache_node.c | 14 ++++---------- src/plugins/ioam/ip6/ioam_cache_tunnel_select_node.c | 18 +++++++++--------- 5 files changed, 27 insertions(+), 19 deletions(-) (limited to 'src/plugins/ioam') diff --git a/src/plugins/ioam/CMakeLists.txt b/src/plugins/ioam/CMakeLists.txt index 3f465591e44..145c156619e 100644 --- a/src/plugins/ioam/CMakeLists.txt +++ b/src/plugins/ioam/CMakeLists.txt @@ -65,6 +65,10 @@ add_vpp_plugin(ioam udp-ping/udp_ping_export.c udp-ping/udp_ping_api.c + MULTIARCH_SOURCES + ip6/ioam_cache_node.c + ip6/ioam_cache_tunnel_select_node.c + API_FILES lib-pot/pot.api export/ioam_export.api diff --git a/src/plugins/ioam/ip6/ioam_cache.c b/src/plugins/ioam/ip6/ioam_cache.c index fcacae0cf2c..d315bc6c61c 100644 --- a/src/plugins/ioam/ip6/ioam_cache.c +++ b/src/plugins/ioam/ip6/ioam_cache.c @@ -371,6 +371,7 @@ VLIB_CLI_COMMAND (show_ioam_cache_command, static) = static clib_error_t * ioam_cache_init (vlib_main_t * vm) { + vlib_node_t *node; ioam_cache_main_t *em = &ioam_cache_main; clib_error_t *error = 0; u8 *name; @@ -405,6 +406,12 @@ ioam_cache_init (vlib_main_t * vm) em->error_node_index = error_node->index; em->vlib_main = vm; + node = vlib_get_node_by_name (vm, (u8 *) "ip6-add-from-cache-hop-by-hop"); + em->ip6_add_from_cache_hbh_node_index = node->index; + + node = vlib_get_node_by_name (vm, (u8 *) "ip6-add-syn-hop-by-hop"); + em->ip6_reset_ts_hbh_node_index = node->index; + vec_free (name); return error; diff --git a/src/plugins/ioam/ip6/ioam_cache.h b/src/plugins/ioam/ip6/ioam_cache.h index e75deba73f7..dc4ae0053fa 100644 --- a/src/plugins/ioam/ip6/ioam_cache.h +++ b/src/plugins/ioam/ip6/ioam_cache.h @@ -205,6 +205,9 @@ typedef struct u32 ip6_hbh_pop_node_index; u32 error_node_index; u32 cleanup_process_node_index; + + u32 ip6_add_from_cache_hbh_node_index; + u32 ip6_reset_ts_hbh_node_index; } ioam_cache_main_t; extern ioam_cache_main_t ioam_cache_main; diff --git a/src/plugins/ioam/ip6/ioam_cache_node.c b/src/plugins/ioam/ip6/ioam_cache_node.c index 59bc1a64811..018077f3934 100644 --- a/src/plugins/ioam/ip6/ioam_cache_node.c +++ b/src/plugins/ioam/ip6/ioam_cache_node.c @@ -217,8 +217,6 @@ format_ip6_add_from_cache_hbh_trace (u8 * s, va_list * args) return s; } -vlib_node_registration_t ip6_add_from_cache_hbh_node; - #define foreach_ip6_add_from_cache_hbh_error \ _(PROCESSED, "Pkts w/ added ip6 hop-by-hop options") @@ -249,10 +247,9 @@ typedef enum } ip6_ioam_cache_input_next_t; -static uword -ip6_add_from_cache_hbh_node_fn (vlib_main_t * vm, - vlib_node_runtime_t * node, - vlib_frame_t * frame) +VLIB_NODE_FN (ip6_add_from_cache_hbh_node) (vlib_main_t * vm, + vlib_node_runtime_t * node, + vlib_frame_t * frame) { ioam_cache_main_t *cm = &ioam_cache_main; u32 n_left_from, *from, *to_next; @@ -384,7 +381,7 @@ ip6_add_from_cache_hbh_node_fn (vlib_main_t * vm, vlib_put_next_frame (vm, node, next_index, n_left_to_next); } - vlib_node_increment_counter (vm, ip6_add_from_cache_hbh_node.index, + vlib_node_increment_counter (vm, cm->ip6_add_from_cache_hbh_node_index, IP6_ADD_FROM_CACHE_HBH_ERROR_PROCESSED, processed); return frame->n_vectors; @@ -392,7 +389,6 @@ ip6_add_from_cache_hbh_node_fn (vlib_main_t * vm, /* *INDENT-OFF* */ VLIB_REGISTER_NODE (ip6_add_from_cache_hbh_node) = { - .function = ip6_add_from_cache_hbh_node_fn, .name = "ip6-add-from-cache-hop-by-hop", .vector_size = sizeof (u32), .format_trace = format_ip6_add_from_cache_hbh_trace, @@ -410,8 +406,6 @@ VLIB_REGISTER_NODE (ip6_add_from_cache_hbh_node) = }; /* *INDENT-ON* */ -VLIB_NODE_FUNCTION_MULTIARCH (ip6_add_from_cache_hbh_node, - ip6_add_from_cache_hbh_node_fn) /* * fd.io coding-style-patch-verification: ON * diff --git a/src/plugins/ioam/ip6/ioam_cache_tunnel_select_node.c b/src/plugins/ioam/ip6/ioam_cache_tunnel_select_node.c index 63bcaff14b2..17016e27100 100644 --- a/src/plugins/ioam/ip6/ioam_cache_tunnel_select_node.c +++ b/src/plugins/ioam/ip6/ioam_cache_tunnel_select_node.c @@ -275,8 +275,6 @@ format_ip6_reset_ts_hbh_trace (u8 * s, va_list * args) return s; } -vlib_node_registration_t ip6_reset_ts_hbh_node; - #define foreach_ip6_reset_ts_hbh_error \ _(PROCESSED, "iOAM Syn/Ack Pkts processed") \ _(SAVED, "iOAM Syn Pkts state saved") \ @@ -309,9 +307,9 @@ typedef enum } ip6_ioam_cache_ts_input_next_t; -static uword -ip6_reset_ts_hbh_node_fn (vlib_main_t * vm, - vlib_node_runtime_t * node, vlib_frame_t * frame) +VLIB_NODE_FN (ip6_reset_ts_hbh_node) (vlib_main_t * vm, + vlib_node_runtime_t * node, + vlib_frame_t * frame) { ioam_cache_main_t *cm = &ioam_cache_main; u32 n_left_from, *from, *to_next; @@ -617,9 +615,9 @@ ip6_reset_ts_hbh_node_fn (vlib_main_t * vm, vlib_put_next_frame (vm, node, next_index, n_left_to_next); } - vlib_node_increment_counter (vm, ip6_reset_ts_hbh_node.index, + vlib_node_increment_counter (vm, cm->ip6_reset_ts_hbh_node_index, IP6_RESET_TS_HBH_ERROR_PROCESSED, processed); - vlib_node_increment_counter (vm, ip6_reset_ts_hbh_node.index, + vlib_node_increment_counter (vm, cm->ip6_reset_ts_hbh_node_index, IP6_RESET_TS_HBH_ERROR_SAVED, cache_ts_added); return frame->n_vectors; @@ -628,7 +626,6 @@ ip6_reset_ts_hbh_node_fn (vlib_main_t * vm, /* *INDENT-OFF* */ VLIB_REGISTER_NODE (ip6_reset_ts_hbh_node) = { - .function = ip6_reset_ts_hbh_node_fn, .name = "ip6-add-syn-hop-by-hop", .vector_size = sizeof (u32), .format_trace = format_ip6_reset_ts_hbh_trace, @@ -645,10 +642,11 @@ VLIB_REGISTER_NODE (ip6_reset_ts_hbh_node) = }, }; -VLIB_NODE_FUNCTION_MULTIARCH (ip6_reset_ts_hbh_node, ip6_reset_ts_hbh_node_fn) /* *INDENT-ON* */ +#ifndef CLIB_MARCH_VARIANT vlib_node_registration_t ioam_cache_ts_timer_tick_node; +#endif /* CLIB_MARCH_VARIANT */ typedef struct { @@ -686,6 +684,7 @@ static char *ioam_cache_ts_timer_tick_error_strings[] = { #undef _ }; +#ifndef CLIB_MARCH_VARIANT void ioam_cache_ts_timer_node_enable (vlib_main_t * vm, u8 enable) { @@ -717,6 +716,7 @@ expired_cache_ts_timer_callback (u32 * expired_timers) ioam_cache_ts_timer_tick_node.index, IOAM_CACHE_TS_TIMER_TICK_ERROR_TIMER, count); } +#endif /* CLIB_MARCH_VARIANT */ static uword ioam_cache_ts_timer_tick_node_fn (vlib_main_t * vm, -- cgit 1.2.3-korg