X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvnet%2Fl2%2Fl2_output_classify.c;h=1e55afcaa4d961b2d1ab715422fe9cac0a7fbaf8;hb=e5d34919b;hp=c1bdaddc06eb501a9fce6a6ee382730646f2d327;hpb=e9f929b52ddb741ec1e4cb2d92c6be1e798933a0;p=vpp.git diff --git a/src/vnet/l2/l2_output_classify.c b/src/vnet/l2/l2_output_classify.c index c1bdaddc06e..1e55afcaa4d 100644 --- a/src/vnet/l2/l2_output_classify.c +++ b/src/vnet/l2/l2_output_classify.c @@ -59,10 +59,12 @@ format_l2_output_classify_trace (u8 * s, va_list * args) return s; } +extern l2_output_classify_main_t l2_output_classify_main; + +#ifndef CLIB_MARCH_VARIANT /** l2 output classifier main data structure. */ l2_output_classify_main_t l2_output_classify_main; - -vlib_node_registration_t l2_output_classify_node; +#endif /* CLIB_MARCH_VARIANT */ #define foreach_l2_output_classify_error \ _(MISS, "Classify misses") \ @@ -99,7 +101,7 @@ static char *l2_output_classify_error_strings[] = { * @em Uses: * - (l2_output_classify_runtime_t *) * rt->classify_table_index_by_sw_if_index - * Head of the per-interface, perprotocol classifier table chain + * Head of the per-interface, per-protocol classifier table chain * for a specific interface. ~0 => send pkts to the next * feature in the L2 feature chain. * - vnet_buffer(b)->sw_if_index[VLIB_TX] @@ -134,9 +136,9 @@ static char *l2_output_classify_error_strings[] = { * Classifier hits in other than the first table */ -static uword -l2_output_classify_node_fn (vlib_main_t * vm, - vlib_node_runtime_t * node, vlib_frame_t * frame) +VLIB_NODE_FN (l2_output_classify_node) (vlib_main_t * vm, + vlib_node_runtime_t * node, + vlib_frame_t * frame) { u32 n_left_from, *from, *to_next; l2_output_classify_next_t next_index; @@ -144,14 +146,11 @@ l2_output_classify_node_fn (vlib_main_t * vm, vnet_classify_main_t *vcm = cm->vnet_classify_main; l2_output_classify_runtime_t *rt = (l2_output_classify_runtime_t *) node->runtime_data; - u32 feature_bitmap0; u32 hits = 0; u32 misses = 0; u32 chain_hits = 0; f64 now; u32 n_next_nodes; - u32 cached_sw_if_index = (u32) ~ 0; - u32 cached_next_index = (u32) ~ 0; u32 sw_if_index0; n_next_nodes = node->n_next_nodes; @@ -163,7 +162,7 @@ l2_output_classify_node_fn (vlib_main_t * vm, /* First pass: compute hash */ - while (n_left_from > 2) + while (n_left_from >= 4) { vlib_buffer_t *b0, *b1; u32 bi0, bi1; @@ -178,15 +177,15 @@ l2_output_classify_node_fn (vlib_main_t * vm, /* prefetch next iteration */ { - vlib_buffer_t *p1, *p2; + vlib_buffer_t *p2, *p3; - p1 = vlib_get_buffer (vm, from[1]); p2 = vlib_get_buffer (vm, from[2]); + p3 = vlib_get_buffer (vm, from[3]); - vlib_prefetch_buffer_header (p1, STORE); - CLIB_PREFETCH (p1->data, CLIB_CACHE_LINE_BYTES, STORE); vlib_prefetch_buffer_header (p2, STORE); CLIB_PREFETCH (p2->data, CLIB_CACHE_LINE_BYTES, STORE); + vlib_prefetch_buffer_header (p3, STORE); + CLIB_PREFETCH (p3->data, CLIB_CACHE_LINE_BYTES, STORE); } bi0 = from[0]; @@ -347,12 +346,6 @@ l2_output_classify_node_fn (vlib_main_t * vm, table_index0 = vnet_buffer (b0)->l2_classify.table_index; e0 = 0; vnet_buffer (b0)->l2_classify.opaque_index = ~0; - /* Remove ourself from the feature bitmap */ - feature_bitmap0 = vnet_buffer (b0)->l2.feature_bitmap - & ~L2OUTPUT_FEAT_OUTPUT_CLASSIFY; - - /* save for next feature graph nodes */ - vnet_buffer (b0)->l2.feature_bitmap = feature_bitmap0; if (PREDICT_TRUE (table_index0 != ~0)) { @@ -405,20 +398,13 @@ l2_output_classify_node_fn (vlib_main_t * vm, if (PREDICT_FALSE (next0 == 0)) b0->error = node->errors[L2_OUTPUT_CLASSIFY_ERROR_DROP]; + /* Determine the next node and remove ourself from bitmap */ if (PREDICT_FALSE (next0 == ~0)) - { - sw_if_index0 = vnet_buffer (b0)->sw_if_index[VLIB_TX]; - - /* Determine next node */ - l2_output_dispatch (cm->vlib_main, - cm->vnet_main, - node, - l2_output_classify_node.index, - &cached_sw_if_index, - &cached_next_index, - &cm->next_nodes, - b0, sw_if_index0, feature_bitmap0, &next0); - } + next0 = vnet_l2_feature_next (b0, cm->l2_out_feat_next, + L2OUTPUT_FEAT_OUTPUT_CLASSIFY); + else + vnet_buffer (b0)->l2.feature_bitmap &= + ~L2OUTPUT_FEAT_OUTPUT_CLASSIFY; if (PREDICT_FALSE ((node->flags & VLIB_NODE_FLAG_TRACE) && (b0->flags & VLIB_BUFFER_IS_TRACED))) @@ -452,7 +438,6 @@ l2_output_classify_node_fn (vlib_main_t * vm, /* *INDENT-OFF* */ VLIB_REGISTER_NODE (l2_output_classify_node) = { - .function = l2_output_classify_node_fn, .name = "l2-output-classify", .vector_size = sizeof (u32), .format_trace = format_l2_output_classify_trace, @@ -472,9 +457,7 @@ VLIB_REGISTER_NODE (l2_output_classify_node) = { }; /* *INDENT-ON* */ -VLIB_NODE_FUNCTION_MULTIARCH (l2_output_classify_node, - l2_output_classify_node_fn); - +#ifndef CLIB_MARCH_VARIANT /** l2 output classsifier feature initialization. */ clib_error_t * l2_output_classify_init (vlib_main_t * vm) @@ -493,13 +476,10 @@ l2_output_classify_init (vlib_main_t * vm) l2_output_classify_node.index, L2OUTPUT_N_FEAT, l2output_get_feat_names (), - cm->next_nodes.feat_next_node_index); + cm->l2_out_feat_next); rt->l2cm = cm; rt->vcm = cm->vnet_classify_main; - /* Initialize the output node mapping table */ - l2output_init_output_node_vec (&cm->next_nodes.output_node_index_vec); - return 0; } @@ -587,6 +567,7 @@ vnet_l2_output_classify_set_tables (u32 sw_if_index, return 0; } +#endif /* CLIB_MARCH_VARIANT */ static clib_error_t * int_l2_output_classify_command_fn (vlib_main_t * vm,