X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvnet%2Flisp-gpe%2Fdecap.c;h=fd3f1751fe17572bb209254cb96e09b6a340d358;hb=067cd6229a47ea3ba8b59a2a04090e80afb5bd2c;hp=50bfa4938dba1e52e8385b80b1e1d12d88d54d82;hpb=443312bb41bde74e5907db35322877a9f103f2c4;p=vpp.git diff --git a/src/vnet/lisp-gpe/decap.c b/src/vnet/lisp-gpe/decap.c index 50bfa4938db..fd3f1751fe1 100644 --- a/src/vnet/lisp-gpe/decap.c +++ b/src/vnet/lisp-gpe/decap.c @@ -103,7 +103,7 @@ next_index_to_iface (lisp_gpe_main_t * lgm, u32 next_index) } static_always_inline void -incr_decap_stats (vnet_main_t * vnm, u32 cpu_index, u32 length, +incr_decap_stats (vnet_main_t * vnm, u32 thread_index, u32 length, u32 sw_if_index, u32 * last_sw_if_index, u32 * n_packets, u32 * n_bytes) { @@ -122,7 +122,7 @@ incr_decap_stats (vnet_main_t * vnm, u32 cpu_index, u32 length, vlib_increment_combined_counter (im->combined_sw_if_counters + VNET_INTERFACE_COUNTER_RX, - cpu_index, *last_sw_if_index, + thread_index, *last_sw_if_index, *n_packets, *n_bytes); } *last_sw_if_index = sw_if_index; @@ -150,11 +150,11 @@ static uword lisp_gpe_input_inline (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * from_frame, u8 is_v4) { - u32 n_left_from, next_index, *from, *to_next, cpu_index; + u32 n_left_from, next_index, *from, *to_next, thread_index; u32 n_bytes = 0, n_packets = 0, last_sw_if_index = ~0, drops = 0; lisp_gpe_main_t *lgm = vnet_lisp_gpe_get_main (); - cpu_index = os_get_cpu_number (); + thread_index = vm->thread_index; from = vlib_frame_vector_args (from_frame); n_left_from = from_frame->n_vectors; @@ -256,9 +256,9 @@ lisp_gpe_input_inline (vlib_main_t * vm, vlib_node_runtime_t * node, /* map iid/vni to lisp-gpe sw_if_index which is used by ipx_input to * decide the rx vrf and the input features to be applied */ si0 = hash_get (tl0->sw_if_index_by_vni, - clib_net_to_host_u32 (lh0->iid)); + clib_net_to_host_u32 (lh0->iid << 8)); si1 = hash_get (tl1->sw_if_index_by_vni, - clib_net_to_host_u32 (lh1->iid)); + clib_net_to_host_u32 (lh1->iid << 8)); /* Required to make the l2 tag push / pop code work on l2 subifs */ @@ -267,7 +267,7 @@ lisp_gpe_input_inline (vlib_main_t * vm, vlib_node_runtime_t * node, if (si0) { - incr_decap_stats (lgm->vnet_main, cpu_index, + incr_decap_stats (lgm->vnet_main, thread_index, vlib_buffer_length_in_chain (vm, b0), si0[0], &last_sw_if_index, &n_packets, &n_bytes); vnet_buffer (b0)->sw_if_index[VLIB_RX] = si0[0]; @@ -282,7 +282,7 @@ lisp_gpe_input_inline (vlib_main_t * vm, vlib_node_runtime_t * node, if (si1) { - incr_decap_stats (lgm->vnet_main, cpu_index, + incr_decap_stats (lgm->vnet_main, thread_index, vlib_buffer_length_in_chain (vm, b1), si1[0], &last_sw_if_index, &n_packets, &n_bytes); vnet_buffer (b1)->sw_if_index[VLIB_RX] = si1[0]; @@ -397,7 +397,7 @@ lisp_gpe_input_inline (vlib_main_t * vm, vlib_node_runtime_t * node, if (si0) { - incr_decap_stats (lgm->vnet_main, cpu_index, + incr_decap_stats (lgm->vnet_main, thread_index, vlib_buffer_length_in_chain (vm, b0), si0[0], &last_sw_if_index, &n_packets, &n_bytes); vnet_buffer (b0)->sw_if_index[VLIB_RX] = si0[0]; @@ -430,7 +430,7 @@ lisp_gpe_input_inline (vlib_main_t * vm, vlib_node_runtime_t * node, } /* flush iface stats */ - incr_decap_stats (lgm->vnet_main, cpu_index, 0, ~0, &last_sw_if_index, + incr_decap_stats (lgm->vnet_main, thread_index, 0, ~0, &last_sw_if_index, &n_packets, &n_bytes); vlib_node_increment_counter (vm, lisp_gpe_ip4_input_node.index, LISP_GPE_ERROR_NO_TUNNEL, drops); @@ -545,6 +545,55 @@ gpe_decap_init (vlib_main_t * vm) return 0; } +static uword +lisp_gpe_nsh_dummy_input (vlib_main_t * vm, vlib_node_runtime_t * node, + vlib_frame_t * from_frame) +{ + vlib_node_increment_counter (vm, node->node_index, 0, 1); + return from_frame->n_vectors; +} + +static char *lisp_gpe_nsh_dummy_error_strings[] = { + "lisp gpe dummy nsh decap", +}; + +/* *INDENT-OFF* */ +VLIB_REGISTER_NODE (lisp_gpe_nsh_dummy_input_node) = { + .function = lisp_gpe_nsh_dummy_input, + .name = "lisp-gpe-nsh-dummy-input", + .vector_size = sizeof (u32), + .type = VLIB_NODE_TYPE_INTERNAL, + .n_next_nodes = 1, + + .n_errors = 1, + .error_strings = lisp_gpe_nsh_dummy_error_strings, + + .next_nodes = { + [0] = "error-drop", + }, +}; +/* *INDENT-ON* */ + +static clib_error_t * +lisp_add_dummy_nsh_node_command_fn (vlib_main_t * vm, + unformat_input_t * input, + vlib_cli_command_t * cmd) +{ + lisp_gpe_main_t *lgm = vnet_lisp_gpe_get_main (); + vlib_node_add_next (lgm->vlib_main, lisp_gpe_ip4_input_node.index, + lisp_gpe_nsh_dummy_input_node.index); + next_proto_to_next_index[LISP_GPE_NEXT_PROTO_NSH] = + LISP_GPE_INPUT_NEXT_NSH_INPUT; + return 0; +} + +/* *INDENT-OFF* */ +VLIB_CLI_COMMAND (lisp_add_dummy_nsh_node_command, static) = { + .path = "test one nsh add-dummy-decap-node", + .function = lisp_add_dummy_nsh_node_command_fn, +}; +/* *INDENT-ON* */ + VLIB_INIT_FUNCTION (gpe_decap_init); /*