X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;ds=inline;f=src%2Fvnet%2Fadj%2Fadj_l2.c;h=a289158c7f388d2d936a4678c95569beab2ce3d3;hb=4c16d80067b35973ebc5a86d685db52fea2fd052;hp=fb64e50563399d1e417076650cba116e2e0aed3c;hpb=4868ff65eddfd694a1485d6c6c355f9a8ca9011d;p=vpp.git diff --git a/src/vnet/adj/adj_l2.c b/src/vnet/adj/adj_l2.c index fb64e505633..a289158c7f3 100644 --- a/src/vnet/adj/adj_l2.c +++ b/src/vnet/adj/adj_l2.c @@ -52,7 +52,7 @@ adj_l2_rewrite_inline (vlib_main_t * vm, { u32 * from = vlib_frame_vector_args (frame); u32 n_left_from, n_left_to_next, * to_next, next_index; - u32 cpu_index = os_get_cpu_number(); + u32 thread_index = vlib_get_thread_index(); ethernet_main_t * em = ðernet_main; n_left_from = frame->n_vectors; @@ -81,9 +81,6 @@ adj_l2_rewrite_inline (vlib_main_t * vm, adj_index0 = vnet_buffer (p0)->ip.adj_index[VLIB_TX]; - /* We should never rewrite a pkt using the MISS adjacency */ - ASSERT(adj_index0); - adj0 = adj_get (adj_index0); /* Guess we are only writing on simple Ethernet header. */ @@ -94,9 +91,14 @@ adj_l2_rewrite_inline (vlib_main_t * vm, rw_len0 = adj0[0].rewrite_header.data_bytes; vnet_buffer(p0)->ip.save_rewrite_length = rw_len0; vnet_buffer(p0)->sw_if_index[VLIB_TX] = adj0->rewrite_header.sw_if_index; + /* since we are coming out of the L2 world, where the vlib_buffer + * union is used for other things, make sure it is clean for + * MPLS from now on. + */ + vnet_buffer(p0)->mpls.first = 0; vlib_increment_combined_counter(&adjacency_counters, - cpu_index, + thread_index, adj_index0, /* packet increment */ 0, /* byte increment */ rw_len0); @@ -106,14 +108,16 @@ adj_l2_rewrite_inline (vlib_main_t * vm, adj0[0].rewrite_header.max_l3_packet_bytes))) { /* Don't adjust the buffer for ttl issue; icmp-error node wants - * to see the IP headerr */ + * to see the IP header */ p0->current_data -= rw_len0; p0->current_length += rw_len0; tx_sw_if_index0 = adj0[0].rewrite_header.sw_if_index; if (is_midchain) { - adj0->sub_type.midchain.fixup_func(vm, adj0, p0); + adj0->sub_type.midchain.fixup_func( + vm, adj0, p0, + adj0->sub_type.midchain.fixup_data); } vnet_buffer (p0)->sw_if_index[VLIB_TX] = tx_sw_if_index0; @@ -148,16 +152,14 @@ adj_l2_rewrite_inline (vlib_main_t * vm, return frame->n_vectors; } -static uword -adj_l2_rewrite (vlib_main_t * vm, +VLIB_NODE_FN (adj_l2_rewrite_node) (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame) { return adj_l2_rewrite_inline (vm, node, frame, 0); } -static uword -adj_l2_midchain (vlib_main_t * vm, +VLIB_NODE_FN (adj_l2_midchain_node) (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame) { @@ -165,7 +167,6 @@ adj_l2_midchain (vlib_main_t * vm, } VLIB_REGISTER_NODE (adj_l2_rewrite_node) = { - .function = adj_l2_rewrite, .name = "adj-l2-rewrite", .vector_size = sizeof (u32), @@ -177,10 +178,7 @@ VLIB_REGISTER_NODE (adj_l2_rewrite_node) = { }, }; -VLIB_NODE_FUNCTION_MULTIARCH (adj_l2_rewrite_node, adj_l2_rewrite) - VLIB_REGISTER_NODE (adj_l2_midchain_node) = { - .function = adj_l2_midchain, .name = "adj-l2-midchain", .vector_size = sizeof (u32), @@ -191,5 +189,3 @@ VLIB_REGISTER_NODE (adj_l2_midchain_node) = { [ADJ_L2_REWRITE_NEXT_DROP] = "error-drop", }, }; - -VLIB_NODE_FUNCTION_MULTIARCH (adj_l2_midchain_node, adj_l2_midchain)