X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvnet%2Fpolicer%2Fnode_funcs.c;h=fd7f197e905a0657e100e315087cac605eb190bf;hb=8e20fe7ab445e2de80caabb298aef8a658f6d4ab;hp=9a25dbb3cc6ce0511a5cb1515269baafac2c71e1;hpb=d2fec4a255e00a5e6f5285cd878edf1a26d4a659;p=vpp.git diff --git a/src/vnet/policer/node_funcs.c b/src/vnet/policer/node_funcs.c index 9a25dbb3cc6..fd7f197e905 100644 --- a/src/vnet/policer/node_funcs.c +++ b/src/vnet/policer/node_funcs.c @@ -22,6 +22,8 @@ #include #include #include +#include +#include /* Dispatch functions meant to be instantiated elsewhere */ @@ -270,14 +272,15 @@ vnet_policer_inline (vlib_main_t * vm, return frame->n_vectors; } -uword -vnet_policer_by_sw_if_index (vlib_main_t * vm, - vlib_node_runtime_t * node, vlib_frame_t * frame) +VLIB_NODE_FN (policer_by_sw_if_index_node) (vlib_main_t * vm, + vlib_node_runtime_t * node, + vlib_frame_t * frame) { return vnet_policer_inline (vm, node, frame, VNET_POLICER_INDEX_BY_SW_IF_INDEX); } +#ifndef CLIB_MARCH_VARIANT uword vnet_policer_by_opaque (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame) @@ -296,6 +299,7 @@ void vnet_policer_node_funcs_reference (void) { } +#endif /* CLIB_MARCH_VARIANT */ #define TEST_CODE 1 @@ -303,8 +307,7 @@ vnet_policer_node_funcs_reference (void) #ifdef TEST_CODE /* *INDENT-OFF* */ -VLIB_REGISTER_NODE (policer_by_sw_if_index_node, static) = { - .function = vnet_policer_by_sw_if_index, +VLIB_REGISTER_NODE (policer_by_sw_if_index_node) = { .name = "policer-by-sw-if-index", .vector_size = sizeof (u32), .format_trace = format_policer_trace, @@ -321,12 +324,10 @@ VLIB_REGISTER_NODE (policer_by_sw_if_index_node, static) = { [VNET_POLICER_NEXT_DROP] = "error-drop", }, }; - -VLIB_NODE_FUNCTION_MULTIARCH (policer_by_sw_if_index_node, - vnet_policer_by_sw_if_index); /* *INDENT-ON* */ +#ifndef CLIB_MARCH_VARIANT int test_policer_add_del (u32 rx_sw_if_index, u8 * config_name, int is_add) { @@ -460,6 +461,7 @@ VLIB_CLI_COMMAND (test_patch_command, static) = { .function = test_policer_command_fn, }; /* *INDENT-ON* */ +#endif /* CLIB_MARCH_VARIANT */ #endif /* TEST_CODE */ @@ -490,7 +492,7 @@ format_policer_classify_trace (u8 * s, va_list * args) #define foreach_policer_classify_error \ _(MISS, "Policer classify misses") \ _(HIT, "Policer classify hits") \ -_(CHAIN_HIT, "Polcier classify hits after chain walk") \ +_(CHAIN_HIT, "Policer classify hits after chain walk") \ _(DROP, "Policer classify action drop") typedef enum @@ -521,7 +523,6 @@ policer_classify_inline (vlib_main_t * vm, u32 hits = 0; u32 misses = 0; u32 chain_hits = 0; - u32 drop = 0; u32 n_next_nodes; u64 time_in_policer_periods; @@ -707,7 +708,6 @@ policer_classify_inline (vlib_main_t * vm, { next0 = POLICER_CLASSIFY_NEXT_INDEX_DROP; b0->error = node->errors[POLICER_CLASSIFY_ERROR_DROP]; - drop++; } hits++; } @@ -743,7 +743,6 @@ policer_classify_inline (vlib_main_t * vm, next0 = POLICER_CLASSIFY_NEXT_INDEX_DROP; b0->error = node->errors[POLICER_CLASSIFY_ERROR_DROP]; - drop++; } hits++; chain_hits++; @@ -778,15 +777,13 @@ policer_classify_inline (vlib_main_t * vm, POLICER_CLASSIFY_ERROR_HIT, hits); vlib_node_increment_counter (vm, node->node_index, POLICER_CLASSIFY_ERROR_CHAIN_HIT, chain_hits); - vlib_node_increment_counter (vm, node->node_index, - POLICER_CLASSIFY_ERROR_DROP, drop); return frame->n_vectors; } -static uword -ip4_policer_classify (vlib_main_t * vm, - vlib_node_runtime_t * node, vlib_frame_t * frame) +VLIB_NODE_FN (ip4_policer_classify_node) (vlib_main_t * vm, + vlib_node_runtime_t * node, + vlib_frame_t * frame) { return policer_classify_inline (vm, node, frame, POLICER_CLASSIFY_TABLE_IP4); @@ -794,7 +791,6 @@ ip4_policer_classify (vlib_main_t * vm, /* *INDENT-OFF* */ VLIB_REGISTER_NODE (ip4_policer_classify_node) = { - .function = ip4_policer_classify, .name = "ip4-policer-classify", .vector_size = sizeof (u32), .format_trace = format_policer_classify_trace, @@ -805,13 +801,11 @@ VLIB_REGISTER_NODE (ip4_policer_classify_node) = { [POLICER_CLASSIFY_NEXT_INDEX_DROP] = "error-drop", }, }; - -VLIB_NODE_FUNCTION_MULTIARCH (ip4_policer_classify_node, ip4_policer_classify); /* *INDENT-ON* */ -static uword -ip6_policer_classify (vlib_main_t * vm, - vlib_node_runtime_t * node, vlib_frame_t * frame) +VLIB_NODE_FN (ip6_policer_classify_node) (vlib_main_t * vm, + vlib_node_runtime_t * node, + vlib_frame_t * frame) { return policer_classify_inline (vm, node, frame, POLICER_CLASSIFY_TABLE_IP6); @@ -819,7 +813,6 @@ ip6_policer_classify (vlib_main_t * vm, /* *INDENT-OFF* */ VLIB_REGISTER_NODE (ip6_policer_classify_node) = { - .function = ip6_policer_classify, .name = "ip6-policer-classify", .vector_size = sizeof (u32), .format_trace = format_policer_classify_trace, @@ -830,20 +823,17 @@ VLIB_REGISTER_NODE (ip6_policer_classify_node) = { [POLICER_CLASSIFY_NEXT_INDEX_DROP] = "error-drop", }, }; - -VLIB_NODE_FUNCTION_MULTIARCH (ip6_policer_classify_node, ip6_policer_classify); /* *INDENT-ON* */ -static uword -l2_policer_classify (vlib_main_t * vm, - vlib_node_runtime_t * node, vlib_frame_t * frame) +VLIB_NODE_FN (l2_policer_classify_node) (vlib_main_t * vm, + vlib_node_runtime_t * node, + vlib_frame_t * frame) { return policer_classify_inline (vm, node, frame, POLICER_CLASSIFY_TABLE_L2); } /* *INDENT-OFF* */ VLIB_REGISTER_NODE (l2_policer_classify_node) = { - .function = l2_policer_classify, .name = "l2-policer-classify", .vector_size = sizeof (u32), .format_trace = format_policer_classify_trace, @@ -854,10 +844,9 @@ VLIB_REGISTER_NODE (l2_policer_classify_node) = { [POLICER_CLASSIFY_NEXT_INDEX_DROP] = "error-drop", }, }; - -VLIB_NODE_FUNCTION_MULTIARCH (l2_policer_classify_node, l2_policer_classify); /* *INDENT-ON* */ +#ifndef CLIB_MARCH_VARIANT static clib_error_t * policer_classify_init (vlib_main_t * vm) { @@ -878,6 +867,7 @@ policer_classify_init (vlib_main_t * vm) } VLIB_INIT_FUNCTION (policer_classify_init); +#endif /* CLIB_MARCH_VARIANT */ /* * fd.io coding-style-patch-verification: ON