X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvnet%2Fmpls%2Fmpls_output.c;h=a1d2d3baa88fea2297fbca1adc370f6771a0c4ec;hb=4a58e49cf;hp=247f531df9f68606bff1b32d107d4e34a4a595f0;hpb=eb284a1f8f10d752285a0a59e75bc54acae50779;p=vpp.git diff --git a/src/vnet/mpls/mpls_output.c b/src/vnet/mpls/mpls_output.c index 247f531df9f..a1d2d3baa88 100644 --- a/src/vnet/mpls/mpls_output.c +++ b/src/vnet/mpls/mpls_output.c @@ -16,10 +16,10 @@ */ #include -#include #include #include #include +#include typedef struct { /* Adjacency taken. */ @@ -200,36 +200,32 @@ mpls_output_inline (vlib_main_t * vm, } if (mode == MPLS_OUTPUT_MIDCHAIN_MODE) { - adj0->sub_type.midchain.fixup_func - (vm, adj0, p0, - adj0->sub_type.midchain.fixup_data); - adj1->sub_type.midchain.fixup_func - (vm, adj1, p1, - adj1->sub_type.midchain.fixup_data); - } + adj_midchain_fixup (vm, adj0, p0, VNET_LINK_MPLS); + adj_midchain_fixup (vm, adj1, p1, VNET_LINK_MPLS); + } - p0->error = error_node->errors[error0]; - p1->error = error_node->errors[error1]; + p0->error = error_node->errors[error0]; + p1->error = error_node->errors[error1]; - if (PREDICT_FALSE(p0->flags & VLIB_BUFFER_IS_TRACED)) - { - mpls_output_trace_t *tr = vlib_add_trace (vm, node, - p0, sizeof (*tr)); - tr->adj_index = vnet_buffer(p0)->ip.adj_index[VLIB_TX]; - tr->flow_hash = vnet_buffer(p0)->ip.flow_hash; - } - if (PREDICT_FALSE(p1->flags & VLIB_BUFFER_IS_TRACED)) - { - mpls_output_trace_t *tr = vlib_add_trace (vm, node, - p1, sizeof (*tr)); - tr->adj_index = vnet_buffer(p1)->ip.adj_index[VLIB_TX]; - tr->flow_hash = vnet_buffer(p1)->ip.flow_hash; - } + if (PREDICT_FALSE (p0->flags & VLIB_BUFFER_IS_TRACED)) + { + mpls_output_trace_t *tr = + vlib_add_trace (vm, node, p0, sizeof (*tr)); + tr->adj_index = vnet_buffer (p0)->ip.adj_index[VLIB_TX]; + tr->flow_hash = vnet_buffer (p0)->ip.flow_hash; + } + if (PREDICT_FALSE (p1->flags & VLIB_BUFFER_IS_TRACED)) + { + mpls_output_trace_t *tr = + vlib_add_trace (vm, node, p1, sizeof (*tr)); + tr->adj_index = vnet_buffer (p1)->ip.adj_index[VLIB_TX]; + tr->flow_hash = vnet_buffer (p1)->ip.flow_hash; + } - vlib_validate_buffer_enqueue_x2 (vm, node, next_index, - to_next, n_left_to_next, - pi0, pi1, next0, next1); - } + vlib_validate_buffer_enqueue_x2 (vm, node, next_index, to_next, + n_left_to_next, pi0, pi1, next0, + next1); + } while (n_left_from > 0 && n_left_to_next > 0) { @@ -249,9 +245,9 @@ mpls_output_inline (vlib_main_t * vm, hdr0 = vlib_buffer_get_current (p0); /* Guess we are only writing on simple Ethernet header. */ - vnet_rewrite_one_header (adj0[0], hdr0, + vnet_rewrite_one_header (adj0[0], hdr0, sizeof (ethernet_header_t)); - + /* Update packet buffer attributes/set output interface. */ rw_len0 = adj0[0].rewrite_header.data_bytes; vnet_buffer (p0)->mpls.save_rewrite_length = rw_len0; @@ -289,21 +285,19 @@ mpls_output_inline (vlib_main_t * vm, } if (mode == MPLS_OUTPUT_MIDCHAIN_MODE) { - adj0->sub_type.midchain.fixup_func - (vm, adj0, p0, - adj0->sub_type.midchain.fixup_data); - } + adj_midchain_fixup (vm, adj0, p0, VNET_LINK_MPLS); + } - p0->error = error_node->errors[error0]; + p0->error = error_node->errors[error0]; from += 1; n_left_from -= 1; to_next += 1; n_left_to_next -= 1; - - if (PREDICT_FALSE(p0->flags & VLIB_BUFFER_IS_TRACED)) + + if (PREDICT_FALSE(p0->flags & VLIB_BUFFER_IS_TRACED)) { - mpls_output_trace_t *tr = vlib_add_trace (vm, node, + mpls_output_trace_t *tr = vlib_add_trace (vm, node, p0, sizeof (*tr)); tr->adj_index = vnet_buffer(p0)->ip.adj_index[VLIB_TX]; tr->flow_hash = vnet_buffer(p0)->ip.flow_hash; @@ -430,7 +424,7 @@ mpls_frag (vlib_main_t * vm, /* the size of the MPLS stack */ encap_size = vnet_buffer(p0)->l3_hdr_offset - p0->current_data; - + /* IP fragmentation */ if (is_ip4) error0 = ip4_frag_do_fragment (vm, pi0, @@ -467,7 +461,7 @@ mpls_frag (vlib_main_t * vm, } else { - vlib_error_count (vm, next_index, error0, 1); + vlib_error_count (vm, mpls_output_node.index, error0, 1); vec_add1 (frags, pi0); /* Get rid of the original buffer */ next0 = MPLS_FRAG_NEXT_DROP; } @@ -612,9 +606,9 @@ VLIB_NODE_FN (mpls_adj_incomplete_node) (vlib_main_t * vm, else { next0 = MPLS_ADJ_INCOMPLETE_NEXT_IP6; - } + } - if (PREDICT_FALSE(p0->flags & VLIB_BUFFER_IS_TRACED)) + if (PREDICT_FALSE(p0->flags & VLIB_BUFFER_IS_TRACED)) { mpls_adj_incomplete_trace_t *tr = vlib_add_trace (vm, node, p0, sizeof (*tr)); @@ -664,4 +658,3 @@ VLIB_REGISTER_NODE (mpls_adj_incomplete_node) = { #undef _ }, }; -