X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fplugins%2Fioam%2Fip6%2Fioam_cache_tunnel_select_node.c;h=17016e27100fc6c8a359ac1184febc548aa27535;hb=9f4ac58700639d722315aa3eba238aa9b8e763d4;hp=3df9871e5f636af9ee3f2c32246e36434f410e63;hpb=78372a9a55098ad43c4d6d941b640cce4ff24226;p=vpp.git 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 3df9871e5f6..17016e27100 100644 --- a/src/plugins/ioam/ip6/ioam_cache_tunnel_select_node.c +++ b/src/plugins/ioam/ip6/ioam_cache_tunnel_select_node.c @@ -43,7 +43,7 @@ #include #include #include -#include +#include #include #include #include @@ -67,8 +67,6 @@ format_cache_ts_trace (u8 * s, va_list * args) return s; } -vlib_node_registration_t ioam_cache_ts_node; - #define foreach_cache_ts_error \ _(RECORDED, "ip6 iOAM headers cached") @@ -277,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") \ @@ -311,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; @@ -398,7 +394,7 @@ ip6_reset_ts_hbh_node_fn (vlib_main_t * vm, clib_net_to_host_u32 (tcp0->seq_number) + 1, no_of_responses, now, - vm->cpu_index, &pool_index0)) + vm->thread_index, &pool_index0)) { cache_ts_added++; } @@ -417,16 +413,16 @@ ip6_reset_ts_hbh_node_fn (vlib_main_t * vm, hbh0 = (ip6_hop_by_hop_header_t *) (ip0 + 1); /* $$$ tune, rewrite_length is a multiple of 8 */ - clib_memcpy (hbh0, rewrite, rewrite_length); + clib_memcpy_fast (hbh0, rewrite, rewrite_length); e2e = (ioam_e2e_cache_option_t *) ((u8 *) hbh0 + cm->rewrite_pool_index_offset); - e2e->pool_id = (u8) vm->cpu_index; + e2e->pool_id = (u8) vm->thread_index; e2e->pool_index = pool_index0; ioam_e2e_id_rewrite_handler ((ioam_e2e_id_option_t *) ((u8 *) e2e + sizeof (ioam_e2e_cache_option_t)), - b0); + &cm->sr_localsid_ts); /* Patch the protocol chain, insert the h-b-h (type 0) header */ hbh0->protocol = ip0->protocol; ip0->protocol = 0; @@ -457,7 +453,7 @@ ip6_reset_ts_hbh_node_fn (vlib_main_t * vm, clib_net_to_host_u32 (tcp1->seq_number) + 1, no_of_responses, now, - vm->cpu_index, &pool_index1)) + vm->thread_index, &pool_index1)) { cache_ts_added++; } @@ -477,16 +473,16 @@ ip6_reset_ts_hbh_node_fn (vlib_main_t * vm, hbh1 = (ip6_hop_by_hop_header_t *) (ip1 + 1); /* $$$ tune, rewrite_length is a multiple of 8 */ - clib_memcpy (hbh1, rewrite, rewrite_length); + clib_memcpy_fast (hbh1, rewrite, rewrite_length); e2e = (ioam_e2e_cache_option_t *) ((u8 *) hbh1 + cm->rewrite_pool_index_offset); - e2e->pool_id = (u8) vm->cpu_index; + e2e->pool_id = (u8) vm->thread_index; e2e->pool_index = pool_index1; ioam_e2e_id_rewrite_handler ((ioam_e2e_id_option_t *) ((u8 *) e2e + sizeof (ioam_e2e_cache_option_t)), - b1); + &cm->sr_localsid_ts); /* Patch the protocol chain, insert the h-b-h (type 0) header */ hbh1->protocol = ip1->protocol; ip1->protocol = 0; @@ -564,7 +560,7 @@ ip6_reset_ts_hbh_node_fn (vlib_main_t * vm, clib_net_to_host_u32 (tcp0->seq_number) + 1, no_of_responses, now, - vm->cpu_index, &pool_index0)) + vm->thread_index, &pool_index0)) { cache_ts_added++; } @@ -583,16 +579,16 @@ ip6_reset_ts_hbh_node_fn (vlib_main_t * vm, hbh0 = (ip6_hop_by_hop_header_t *) (ip0 + 1); /* $$$ tune, rewrite_length is a multiple of 8 */ - clib_memcpy (hbh0, rewrite, rewrite_length); + clib_memcpy_fast (hbh0, rewrite, rewrite_length); e2e = (ioam_e2e_cache_option_t *) ((u8 *) hbh0 + cm->rewrite_pool_index_offset); - e2e->pool_id = (u8) vm->cpu_index; + e2e->pool_id = (u8) vm->thread_index; e2e->pool_index = pool_index0; ioam_e2e_id_rewrite_handler ((ioam_e2e_id_option_t *) ((u8 *) e2e + sizeof (ioam_e2e_cache_option_t)), - b0); + &cm->sr_localsid_ts); /* Patch the protocol chain, insert the h-b-h (type 0) header */ hbh0->protocol = ip0->protocol; ip0->protocol = 0; @@ -619,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; @@ -630,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, @@ -647,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 { @@ -688,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) { @@ -703,7 +700,7 @@ expired_cache_ts_timer_callback (u32 * expired_timers) ioam_cache_main_t *cm = &ioam_cache_main; int i; u32 pool_index; - u32 thread_index = os_get_cpu_number (); + u32 thread_index = vlib_get_thread_index (); u32 count = 0; for (i = 0; i < vec_len (expired_timers); i++) @@ -719,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, @@ -726,7 +724,7 @@ ioam_cache_ts_timer_tick_node_fn (vlib_main_t * vm, vlib_frame_t * f) { ioam_cache_main_t *cm = &ioam_cache_main; - u32 my_thread_index = os_get_cpu_number (); + u32 my_thread_index = vlib_get_thread_index (); struct timespec ts, tsrem; tw_timer_expire_timers_16t_2w_512sl (&cm->timer_wheels[my_thread_index],