X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvnet%2Fpolicer%2Fnode_funcs.c;h=21b9393a22257ade8c68e65a5a49141345030441;hb=492d7790f;hp=be8ce58799ac0e342b58b8d5011b25e19e942dba;hpb=fce88656cc1b0da8731a71c4a6efa759e0df3fa8;p=vpp.git diff --git a/src/vnet/policer/node_funcs.c b/src/vnet/policer/node_funcs.c index be8ce58799a..21b9393a222 100644 --- a/src/vnet/policer/node_funcs.c +++ b/src/vnet/policer/node_funcs.c @@ -127,28 +127,38 @@ vnet_policer_inline (vlib_main_t *vm, vlib_node_runtime_t *node, pi1 = pm->policer_index_by_sw_if_index[sw_if_index1]; act0 = vnet_policer_police (vm, b0, pi0, time_in_policer_periods, - POLICE_CONFORM /* no chaining */, false); + POLICE_CONFORM /* no chaining */, true); act1 = vnet_policer_police (vm, b1, pi1, time_in_policer_periods, - POLICE_CONFORM /* no chaining */, false); + POLICE_CONFORM /* no chaining */, true); - if (PREDICT_FALSE (act0 == QOS_ACTION_DROP)) /* drop action */ + if (PREDICT_FALSE (act0 == QOS_ACTION_HANDOFF)) + { + next0 = VNET_POLICER_NEXT_HANDOFF; + vnet_buffer (b0)->policer.index = pi0; + } + else if (PREDICT_FALSE (act0 == QOS_ACTION_DROP)) { next0 = VNET_POLICER_NEXT_DROP; b0->error = node->errors[VNET_POLICER_ERROR_DROP]; } - else /* transmit or mark-and-transmit action */ + else /* transmit or mark-and-transmit action */ { transmitted++; vnet_feature_next (&next0, b0); } - if (PREDICT_FALSE (act1 == QOS_ACTION_DROP)) /* drop action */ + if (PREDICT_FALSE (act1 == QOS_ACTION_HANDOFF)) + { + next1 = VNET_POLICER_NEXT_HANDOFF; + vnet_buffer (b1)->policer.index = pi1; + } + else if (PREDICT_FALSE (act1 == QOS_ACTION_DROP)) /* drop action */ { next1 = VNET_POLICER_NEXT_DROP; b1->error = node->errors[VNET_POLICER_ERROR_DROP]; } - else /* transmit or mark-and-transmit action */ + else /* transmit or mark-and-transmit action */ { transmitted++; vnet_feature_next (&next1, b1); @@ -201,14 +211,19 @@ vnet_policer_inline (vlib_main_t *vm, vlib_node_runtime_t *node, pi0 = pm->policer_index_by_sw_if_index[sw_if_index0]; act0 = vnet_policer_police (vm, b0, pi0, time_in_policer_periods, - POLICE_CONFORM /* no chaining */, false); + POLICE_CONFORM /* no chaining */, true); - if (PREDICT_FALSE (act0 == QOS_ACTION_DROP)) /* drop action */ + if (PREDICT_FALSE (act0 == QOS_ACTION_HANDOFF)) + { + next0 = VNET_POLICER_NEXT_HANDOFF; + vnet_buffer (b0)->policer.index = pi0; + } + else if (PREDICT_FALSE (act0 == QOS_ACTION_DROP)) { next0 = VNET_POLICER_NEXT_DROP; b0->error = node->errors[VNET_POLICER_ERROR_DROP]; } - else /* transmit or mark-and-transmit action */ + else /* transmit or mark-and-transmit action */ { transmitted++; vnet_feature_next (&next0, b0); @@ -254,6 +269,7 @@ VLIB_REGISTER_NODE (policer_input_node) = { .n_next_nodes = VNET_POLICER_N_NEXT, .next_nodes = { [VNET_POLICER_NEXT_DROP] = "error-drop", + [VNET_POLICER_NEXT_HANDOFF] = "policer-input-handoff", }, }; @@ -263,6 +279,28 @@ VNET_FEATURE_INIT (policer_input_node, static) = { .runs_before = VNET_FEATURES ("ethernet-input"), }; +static char *policer_input_handoff_error_strings[] = { "congestion drop" }; + +VLIB_NODE_FN (policer_input_handoff_node) +(vlib_main_t *vm, vlib_node_runtime_t *node, vlib_frame_t *frame) +{ + return policer_handoff (vm, node, frame, vnet_policer_main.fq_index, ~0); +} + +VLIB_REGISTER_NODE (policer_input_handoff_node) = { + .name = "policer-input-handoff", + .vector_size = sizeof (u32), + .format_trace = format_policer_handoff_trace, + .type = VLIB_NODE_TYPE_INTERNAL, + .n_errors = ARRAY_LEN(policer_input_handoff_error_strings), + .error_strings = policer_input_handoff_error_strings, + + .n_next_nodes = 1, + .next_nodes = { + [0] = "error-drop", + }, +}; + typedef struct { u32 sw_if_index; @@ -349,9 +387,9 @@ policer_classify_inline (vlib_main_t * vm, p2 = vlib_get_buffer (vm, from[2]); vlib_prefetch_buffer_header (p1, STORE); - CLIB_PREFETCH (p1->data, CLIB_CACHE_LINE_BYTES, STORE); + clib_prefetch_store (p1->data); vlib_prefetch_buffer_header (p2, STORE); - CLIB_PREFETCH (p2->data, CLIB_CACHE_LINE_BYTES, STORE); + clib_prefetch_store (p2->data); } bi0 = from[0];