diff options
Diffstat (limited to 'src/vnet/ip')
-rw-r--r-- | src/vnet/ip/ip4_punt_drop.c | 62 | ||||
-rw-r--r-- | src/vnet/ip/ip4_reassembly.c | 38 | ||||
-rw-r--r-- | src/vnet/ip/ip4_source_check.c | 24 | ||||
-rw-r--r-- | src/vnet/ip/ip6_hop_by_hop.c | 32 | ||||
-rw-r--r-- | src/vnet/ip/ip6_input.c | 9 | ||||
-rw-r--r-- | src/vnet/ip/ip6_punt_drop.c | 66 | ||||
-rw-r--r-- | src/vnet/ip/ip6_reassembly.c | 33 | ||||
-rw-r--r-- | src/vnet/ip/ip_in_out_acl.c | 38 | ||||
-rw-r--r-- | src/vnet/ip/punt.c | 38 |
9 files changed, 166 insertions, 174 deletions
diff --git a/src/vnet/ip/ip4_punt_drop.c b/src/vnet/ip/ip4_punt_drop.c index e36980ce9ed..85409857f38 100644 --- a/src/vnet/ip/ip4_punt_drop.c +++ b/src/vnet/ip/ip4_punt_drop.c @@ -32,6 +32,11 @@ VNET_FEATURE_ARC_INIT (ip4_drop) = }; /* *INDENT-ON* */ +extern ip_punt_policer_t ip4_punt_policer_cfg; +extern ip_punt_redirect_t ip4_punt_redirect_cfg; +extern ip_punt_redirect_rx_t uninit_rx_redirect; + +#ifndef CLIB_MARCH_VARIANT u8 * format_ip_punt_policer_trace (u8 * s, va_list * args) { @@ -46,6 +51,7 @@ format_ip_punt_policer_trace (u8 * s, va_list * args) ip_punt_policer_t ip4_punt_policer_cfg = { .policer_index = ~0, }; +#endif /* CLIB_MARCH_VARIANT */ static char *ip4_punt_policer_error_strings[] = { #define _(sym,string) string, @@ -53,9 +59,9 @@ static char *ip4_punt_policer_error_strings[] = { #undef _ }; -static uword -ip4_punt_policer (vlib_main_t * vm, - vlib_node_runtime_t * node, vlib_frame_t * frame) +VLIB_NODE_FN (ip4_punt_policer_node) (vlib_main_t * vm, + vlib_node_runtime_t * node, + vlib_frame_t * frame) { return (ip_punt_policer (vm, node, frame, vnet_feat_arc_ip4_punt.feature_arc_index, @@ -63,8 +69,7 @@ ip4_punt_policer (vlib_main_t * vm, } /* *INDENT-OFF* */ -VLIB_REGISTER_NODE (ip4_punt_policer_node, static) = { - .function = ip4_punt_policer, +VLIB_REGISTER_NODE (ip4_punt_policer_node) = { .name = "ip4-punt-policer", .vector_size = sizeof (u32), .n_next_nodes = IP_PUNT_POLICER_N_NEXT, @@ -77,16 +82,14 @@ VLIB_REGISTER_NODE (ip4_punt_policer_node, static) = { }, }; -VLIB_NODE_FUNCTION_MULTIARCH (ip4_punt_policer_node, - ip4_punt_policer); - -VNET_FEATURE_INIT (ip4_punt_policer_node, static) = { +VNET_FEATURE_INIT (ip4_punt_policer_node) = { .arc_name = "ip4-punt", .node_name = "ip4-punt-policer", .runs_before = VNET_FEATURES("ip4-punt-redirect"), }; /* *INDENT-ON* */ +#ifndef CLIB_MARCH_VARIANT u8 * format_ip_punt_redirect_trace (u8 * s, va_list * args) { @@ -119,6 +122,7 @@ ip_punt_redirect_t ip4_punt_redirect_cfg = { }, }; /* *INDENT-ON* */ +#endif /* CLIB_MARCH_VARIANT */ #define foreach_ip4_punt_redirect_error \ @@ -138,9 +142,9 @@ static char *ip4_punt_redirect_error_strings[] = { #undef _ }; -static uword -ip4_punt_redirect (vlib_main_t * vm, - vlib_node_runtime_t * node, vlib_frame_t * frame) +VLIB_NODE_FN (ip4_punt_redirect_node) (vlib_main_t * vm, + vlib_node_runtime_t * node, + vlib_frame_t * frame) { return (ip_punt_redirect (vm, node, frame, vnet_feat_arc_ip4_punt.feature_arc_index, @@ -148,8 +152,7 @@ ip4_punt_redirect (vlib_main_t * vm, } /* *INDENT-OFF* */ -VLIB_REGISTER_NODE (ip4_punt_redirect_node, static) = { - .function = ip4_punt_redirect, +VLIB_REGISTER_NODE (ip4_punt_redirect_node) = { .name = "ip4-punt-redirect", .vector_size = sizeof (u32), .n_next_nodes = IP_PUNT_REDIRECT_N_NEXT, @@ -165,9 +168,6 @@ VLIB_REGISTER_NODE (ip4_punt_redirect_node, static) = { }, }; -VLIB_NODE_FUNCTION_MULTIARCH (ip4_punt_redirect_node, - ip4_punt_redirect); - VNET_FEATURE_INIT (ip4_punt_redirect_node, static) = { .arc_name = "ip4-punt", .node_name = "ip4-punt-redirect", @@ -175,8 +175,8 @@ VNET_FEATURE_INIT (ip4_punt_redirect_node, static) = { }; /* *INDENT-ON* */ -static uword -ip4_drop (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame) +VLIB_NODE_FN (ip4_drop_node) (vlib_main_t * vm, vlib_node_runtime_t * node, + vlib_frame_t * frame) { if (node->flags & VLIB_NODE_FLAG_TRACE) ip4_forward_next_trace (vm, node, frame, VLIB_TX); @@ -186,9 +186,9 @@ ip4_drop (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame) } -static uword -ip4_not_enabled (vlib_main_t * vm, - vlib_node_runtime_t * node, vlib_frame_t * frame) +VLIB_NODE_FN (ip4_not_enabled_node) (vlib_main_t * vm, + vlib_node_runtime_t * node, + vlib_frame_t * frame) { if (node->flags & VLIB_NODE_FLAG_TRACE) ip4_forward_next_trace (vm, node, frame, VLIB_TX); @@ -208,9 +208,8 @@ ip4_punt (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame) } /* *INDENT-OFF* */ -VLIB_REGISTER_NODE (ip4_drop_node, static) = +VLIB_REGISTER_NODE (ip4_drop_node) = { - .function = ip4_drop, .name = "ip4-drop", .vector_size = sizeof (u32), .format_trace = format_ip4_forward_next_trace, @@ -220,11 +219,8 @@ VLIB_REGISTER_NODE (ip4_drop_node, static) = }, }; -VLIB_NODE_FUNCTION_MULTIARCH (ip4_drop_node, ip4_drop); - -VLIB_REGISTER_NODE (ip4_not_enabled_node, static) = +VLIB_REGISTER_NODE (ip4_not_enabled_node) = { - .function = ip4_not_enabled, .name = "ip4-not-enabled", .vector_size = sizeof (u32), .format_trace = format_ip4_forward_next_trace, @@ -234,9 +230,7 @@ VLIB_REGISTER_NODE (ip4_not_enabled_node, static) = }, }; -VLIB_NODE_FUNCTION_MULTIARCH (ip4_not_enabled_node, ip4_not_enabled); - -VLIB_REGISTER_NODE (ip4_punt_node, static) = +VLIB_REGISTER_NODE (ip4_punt_node) = { .function = ip4_punt, .name = "ip4-punt", @@ -261,6 +255,7 @@ VNET_FEATURE_INIT (ip4_drop_end_of_arc, static) = { }; /* *INDENT-ON */ +#ifndef CLIB_MARCH_VARIANT void ip4_punt_policer_add_del (u8 is_add, u32 policer_index) { @@ -269,6 +264,7 @@ ip4_punt_policer_add_del (u8 is_add, u32 policer_index) vnet_feature_enable_disable ("ip4-punt", "ip4-punt-policer", 0, is_add, 0, 0); } +#endif /* CLIB_MARCH_VARIANT */ static clib_error_t * ip4_punt_police_cmd (vlib_main_t * vm, @@ -330,6 +326,7 @@ VLIB_CLI_COMMAND (ip4_punt_policer_command, static) = }; /* *INDENT-ON* */ +#ifndef CLIB_MARCH_VARIANT /* * an uninitalised rx-redirect strcut used to pad the vector */ @@ -407,6 +404,7 @@ ip4_punt_redirect_del (u32 rx_sw_if_index) ip_punt_redirect_del (&ip4_punt_redirect_cfg, rx_sw_if_index); } +#endif /* CLIB_MARCH_VARIANT */ static clib_error_t * ip4_punt_redirect_cmd (vlib_main_t * vm, @@ -487,6 +485,7 @@ VLIB_CLI_COMMAND (ip4_punt_redirect_command, static) = }; /* *INDENT-ON* */ +#ifndef CLIB_MARCH_VARIANT u8 * format_ip_punt_redirect (u8 * s, va_list * args) { @@ -556,6 +555,7 @@ ip4_punt_redirect_entries (u32 sw_if_index) return prs; } +#endif /* CLIB_MARCH_VARIANT */ static clib_error_t * ip4_punt_redirect_show_cmd (vlib_main_t * vm, diff --git a/src/vnet/ip/ip4_reassembly.c b/src/vnet/ip/ip4_reassembly.c index 86e5e3936cb..446df33a0a4 100644 --- a/src/vnet/ip/ip4_reassembly.c +++ b/src/vnet/ip/ip4_reassembly.c @@ -171,7 +171,11 @@ typedef struct } ip4_reass_main_t; +extern ip4_reass_main_t ip4_reass_main; + +#ifndef CLIB_MARCH_VARIANT ip4_reass_main_t ip4_reass_main; +#endif /* CLIB_MARCH_VARIANT */ typedef enum { @@ -212,6 +216,9 @@ typedef struct u32 total_data_len; } ip4_reass_trace_t; +extern vlib_node_registration_t ip4_reass_node; +extern vlib_node_registration_t ip4_reass_node_feature; + static void ip4_reass_trace_details (vlib_main_t * vm, u32 bi, ip4_reass_range_trace_t * trace) @@ -235,7 +242,7 @@ format_ip4_reass_range_trace (u8 * s, va_list * args) return s; } -u8 * +static u8 * format_ip4_reass_trace (u8 * s, va_list * args) { CLIB_UNUSED (vlib_main_t * vm) = va_arg (*args, vlib_main_t *); @@ -351,7 +358,7 @@ ip4_reass_on_timeout (vlib_main_t * vm, ip4_reass_main_t * rm, vec_free (to_free); } -ip4_reass_t * +static ip4_reass_t * ip4_reass_find_or_create (vlib_main_t * vm, ip4_reass_main_t * rm, ip4_reass_per_thread_t * rt, ip4_reass_kv_t * kv, u8 * do_handoff) @@ -1055,16 +1062,14 @@ static char *ip4_reassembly_error_strings[] = { #undef _ }; -static uword -ip4_reassembly (vlib_main_t * vm, vlib_node_runtime_t * node, - vlib_frame_t * frame) +VLIB_NODE_FN (ip4_reass_node) (vlib_main_t * vm, vlib_node_runtime_t * node, + vlib_frame_t * frame) { return ip4_reassembly_inline (vm, node, frame, false /* is_feature */ ); } /* *INDENT-OFF* */ -VLIB_REGISTER_NODE (ip4_reass_node, static) = { - .function = ip4_reassembly, +VLIB_REGISTER_NODE (ip4_reass_node) = { .name = "ip4-reassembly", .vector_size = sizeof (u32), .format_trace = format_ip4_reass_trace, @@ -1081,18 +1086,15 @@ VLIB_REGISTER_NODE (ip4_reass_node, static) = { }; /* *INDENT-ON* */ -VLIB_NODE_FUNCTION_MULTIARCH (ip4_reass_node, ip4_reassembly); - -static uword -ip4_reassembly_feature (vlib_main_t * vm, - vlib_node_runtime_t * node, vlib_frame_t * frame) +VLIB_NODE_FN (ip4_reass_node_feature) (vlib_main_t * vm, + vlib_node_runtime_t * node, + vlib_frame_t * frame) { return ip4_reassembly_inline (vm, node, frame, true /* is_feature */ ); } /* *INDENT-OFF* */ -VLIB_REGISTER_NODE (ip4_reass_node_feature, static) = { - .function = ip4_reassembly_feature, +VLIB_REGISTER_NODE (ip4_reass_node_feature) = { .name = "ip4-reassembly-feature", .vector_size = sizeof (u32), .format_trace = format_ip4_reass_trace, @@ -1108,8 +1110,6 @@ VLIB_REGISTER_NODE (ip4_reass_node_feature, static) = { }; /* *INDENT-ON* */ -VLIB_NODE_FUNCTION_MULTIARCH (ip4_reass_node_feature, ip4_reassembly_feature); - /* *INDENT-OFF* */ VNET_FEATURE_INIT (ip4_reassembly_feature, static) = { .arc_name = "ip4-unicast", @@ -1119,6 +1119,7 @@ VNET_FEATURE_INIT (ip4_reassembly_feature, static) = { }; /* *INDENT-ON* */ +#ifndef CLIB_MARCH_VARIANT always_inline u32 ip4_reass_get_nbuckets () { @@ -1135,6 +1136,7 @@ ip4_reass_get_nbuckets () return nbuckets; } +#endif /* CLIB_MARCH_VARIANT */ typedef enum { @@ -1147,6 +1149,7 @@ typedef struct clib_bihash_16_8_t *new_hash; } ip4_rehash_cb_ctx; +#ifndef CLIB_MARCH_VARIANT static void ip4_rehash_cb (clib_bihash_kv_16_8_t * kv, void *_ctx) { @@ -1257,6 +1260,7 @@ ip4_reass_init_function (vlib_main_t * vm) } VLIB_INIT_FUNCTION (ip4_reass_init_function); +#endif /* CLIB_MARCH_VARIANT */ static uword ip4_reass_walk_expired (vlib_main_t * vm, @@ -1440,6 +1444,7 @@ VLIB_CLI_COMMAND (show_ip4_reassembly_cmd, static) = { }; /* *INDENT-ON* */ +#ifndef CLIB_MARCH_VARIANT vnet_api_error_t ip4_reass_enable_disable (u32 sw_if_index, u8 enable_disable) { @@ -1447,6 +1452,7 @@ ip4_reass_enable_disable (u32 sw_if_index, u8 enable_disable) "ip4-reassembly-feature", sw_if_index, enable_disable, 0, 0); } +#endif /* CLIB_MARCH_VARIANT */ #define foreach_ip4_reassembly_handoff_error \ diff --git a/src/vnet/ip/ip4_source_check.c b/src/vnet/ip/ip4_source_check.c index 2e4226f2108..b3d4b001e9e 100644 --- a/src/vnet/ip/ip4_source_check.c +++ b/src/vnet/ip/ip4_source_check.c @@ -274,19 +274,17 @@ ip4_source_check_inline (vlib_main_t * vm, return frame->n_vectors; } -static uword -ip4_source_check_reachable_via_any (vlib_main_t * vm, - vlib_node_runtime_t * node, - vlib_frame_t * frame) +VLIB_NODE_FN (ip4_check_source_reachable_via_any) (vlib_main_t * vm, + vlib_node_runtime_t * node, + vlib_frame_t * frame) { return ip4_source_check_inline (vm, node, frame, IP4_SOURCE_CHECK_REACHABLE_VIA_ANY); } -static uword -ip4_source_check_reachable_via_rx (vlib_main_t * vm, - vlib_node_runtime_t * node, - vlib_frame_t * frame) +VLIB_NODE_FN (ip4_check_source_reachable_via_rx) (vlib_main_t * vm, + vlib_node_runtime_t * node, + vlib_frame_t * frame) { return ip4_source_check_inline (vm, node, frame, IP4_SOURCE_CHECK_REACHABLE_VIA_RX); @@ -294,7 +292,6 @@ ip4_source_check_reachable_via_rx (vlib_main_t * vm, /* *INDENT-OFF* */ VLIB_REGISTER_NODE (ip4_check_source_reachable_via_any) = { - .function = ip4_source_check_reachable_via_any, .name = "ip4-source-check-via-any", .vector_size = sizeof (u32), @@ -308,12 +305,8 @@ VLIB_REGISTER_NODE (ip4_check_source_reachable_via_any) = { }; /* *INDENT-ON* */ -VLIB_NODE_FUNCTION_MULTIARCH (ip4_check_source_reachable_via_any, - ip4_source_check_reachable_via_any); - /* *INDENT-OFF* */ VLIB_REGISTER_NODE (ip4_check_source_reachable_via_rx) = { - .function = ip4_source_check_reachable_via_rx, .name = "ip4-source-check-via-rx", .vector_size = sizeof (u32), @@ -327,9 +320,6 @@ VLIB_REGISTER_NODE (ip4_check_source_reachable_via_rx) = { }; /* *INDENT-ON* */ -VLIB_NODE_FUNCTION_MULTIARCH (ip4_check_source_reachable_via_rx, - ip4_source_check_reachable_via_rx); - static clib_error_t * set_ip_source_check (vlib_main_t * vm, unformat_input_t * input, vlib_cli_command_t * cmd) @@ -535,6 +525,7 @@ VLIB_CLI_COMMAND (ip_source_check_accept_command, static) = { /* *INDENT-ON* */ +#ifndef CLIB_MARCH_VARIANT /* Dummy init function to get us linked in. */ clib_error_t * ip4_source_check_init (vlib_main_t * vm) @@ -543,6 +534,7 @@ ip4_source_check_init (vlib_main_t * vm) } VLIB_INIT_FUNCTION (ip4_source_check_init); +#endif /* CLIB_MARCH_VARIANT */ /* * fd.io coding-style-patch-verification: ON diff --git a/src/vnet/ip/ip6_hop_by_hop.c b/src/vnet/ip/ip6_hop_by_hop.c index 38cdbfffeaa..da0197061e2 100644 --- a/src/vnet/ip/ip6_hop_by_hop.c +++ b/src/vnet/ip/ip6_hop_by_hop.c @@ -41,7 +41,9 @@ * in-band OAM can be enabled for IPv6 traffic. */ +#ifndef CLIB_MARCH_VARIANT ip6_hop_by_hop_ioam_main_t ip6_hop_by_hop_ioam_main; +#endif /* CLIB_MARCH_VARIANT */ #define foreach_ip6_hbyh_ioam_input_next \ _(IP6_REWRITE, "ip6-rewrite") \ @@ -56,6 +58,7 @@ typedef enum IP6_HBYH_IOAM_INPUT_N_NEXT, } ip6_hbyh_ioam_input_next_t; +#ifndef CLIB_MARCH_VARIANT static uword unformat_opaque_ioam (unformat_input_t * input, va_list * args) { @@ -196,6 +199,7 @@ ip6_hbh_flow_handler_unregister (u8 option) hm->flow_handler[option] = NULL; return (0); } +#endif /* CLIB_MARCH_VARIANT */ typedef struct { @@ -215,7 +219,7 @@ format_ip6_add_hop_by_hop_trace (u8 * s, va_list * args) return s; } -vlib_node_registration_t ip6_add_hop_by_hop_node; +extern vlib_node_registration_t ip6_add_hop_by_hop_node; #define foreach_ip6_add_hop_by_hop_error \ _(PROCESSED, "Pkts w/ added ip6 hop-by-hop options") @@ -234,9 +238,9 @@ static char *ip6_add_hop_by_hop_error_strings[] = { #undef _ }; -static uword -ip6_add_hop_by_hop_node_fn (vlib_main_t * vm, - vlib_node_runtime_t * node, vlib_frame_t * frame) +VLIB_NODE_FN (ip6_add_hop_by_hop_node) (vlib_main_t * vm, + vlib_node_runtime_t * node, + vlib_frame_t * frame) { ip6_hop_by_hop_ioam_main_t *hm = &ip6_hop_by_hop_ioam_main; u32 n_left_from, *from, *to_next; @@ -437,7 +441,7 @@ ip6_add_hop_by_hop_node_fn (vlib_main_t * vm, /* *INDENT-OFF* */ VLIB_REGISTER_NODE (ip6_add_hop_by_hop_node) = /* *INDENT-OFF* */ { - .function = ip6_add_hop_by_hop_node_fn,.name = + .name = "ip6-add-hop-by-hop",.vector_size = sizeof (u32),.format_trace = format_ip6_add_hop_by_hop_trace,.type = VLIB_NODE_TYPE_INTERNAL,.n_errors = @@ -455,8 +459,6 @@ VLIB_REGISTER_NODE (ip6_add_hop_by_hop_node) = /* *INDENT-OFF* */ /* *INDENT-ON* */ -VLIB_NODE_FUNCTION_MULTIARCH (ip6_add_hop_by_hop_node, - ip6_add_hop_by_hop_node_fn); /* The main h-b-h tracer was already invoked, no need to do much here */ typedef struct { @@ -476,6 +478,7 @@ format_ip6_pop_hop_by_hop_trace (u8 * s, va_list * args) return s; } +#ifndef CLIB_MARCH_VARIANT int ip6_hbh_pop_register_option (u8 option, int options (vlib_buffer_t * b, @@ -509,8 +512,9 @@ ip6_hbh_pop_unregister_option (u8 option) hm->pop_options[option] = NULL; return (0); } +#endif /* CLIB_MARCH_VARIANT */ -vlib_node_registration_t ip6_pop_hop_by_hop_node; +extern vlib_node_registration_t ip6_pop_hop_by_hop_node; #define foreach_ip6_pop_hop_by_hop_error \ _(PROCESSED, "Pkts w/ removed ip6 hop-by-hop options") \ @@ -577,9 +581,9 @@ ioam_pop_hop_by_hop_processing (vlib_main_t * vm, } } -static uword -ip6_pop_hop_by_hop_node_fn (vlib_main_t * vm, - vlib_node_runtime_t * node, vlib_frame_t * frame) +VLIB_NODE_FN (ip6_pop_hop_by_hop_node) (vlib_main_t * vm, + vlib_node_runtime_t * node, + vlib_frame_t * frame) { u32 n_left_from, *from, *to_next; ip_lookup_next_t next_index; @@ -779,7 +783,7 @@ ip6_pop_hop_by_hop_node_fn (vlib_main_t * vm, /* *INDENT-OFF* */ VLIB_REGISTER_NODE (ip6_pop_hop_by_hop_node) = { - .function = ip6_pop_hop_by_hop_node_fn,.name = + .name = "ip6-pop-hop-by-hop",.vector_size = sizeof (u32),.format_trace = format_ip6_pop_hop_by_hop_trace,.type = VLIB_NODE_TYPE_INTERNAL,.sibling_of = "ip6-lookup",.n_errors = @@ -790,8 +794,7 @@ VLIB_REGISTER_NODE (ip6_pop_hop_by_hop_node) = /* *INDENT-ON* */ -VLIB_NODE_FUNCTION_MULTIARCH (ip6_pop_hop_by_hop_node, - ip6_pop_hop_by_hop_node_fn); +#ifndef CLIB_MARCH_VARIANT static clib_error_t * ip6_hop_by_hop_ioam_init (vlib_main_t * vm) { @@ -1157,6 +1160,7 @@ vnet_register_ioam_end_of_path_callback (void *cb) hm->ioam_end_of_path_cb = cb; } +#endif /* CLIB_MARCH_VARIANT */ /* * fd.io coding-style-patch-verification: ON * diff --git a/src/vnet/ip/ip6_input.c b/src/vnet/ip/ip6_input.c index a01920a7b48..0450064eafe 100644 --- a/src/vnet/ip/ip6_input.c +++ b/src/vnet/ip/ip6_input.c @@ -62,8 +62,8 @@ format_ip6_input_trace (u8 * s, va_list * va) /* Validate IP v6 packets and pass them either to forwarding code or drop exception packets. */ -static uword -ip6_input (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame) +VLIB_NODE_FN (ip6_input_node) (vlib_main_t * vm, vlib_node_runtime_t * node, + vlib_frame_t * frame) { vnet_main_t *vnm = vnet_get_main (); ip6_main_t *im = &ip6_main; @@ -218,15 +218,16 @@ ip6_input (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame) return frame->n_vectors; } +#ifndef CLIB_MARCH_VARIANT char *ip6_error_strings[] = { #define _(sym,string) string, foreach_ip6_error #undef _ }; +#endif /* CLIB_MARCH_VARIANT */ /* *INDENT-OFF* */ VLIB_REGISTER_NODE (ip6_input_node) = { - .function = ip6_input, .name = "ip6-input", .vector_size = sizeof (u32), @@ -246,8 +247,6 @@ VLIB_REGISTER_NODE (ip6_input_node) = { }; /* *INDENT-ON* */ -VLIB_NODE_FUNCTION_MULTIARCH (ip6_input_node, ip6_input); - static clib_error_t * ip6_init (vlib_main_t * vm) { diff --git a/src/vnet/ip/ip6_punt_drop.c b/src/vnet/ip/ip6_punt_drop.c index 3c839ffdd74..d1145fbf82e 100644 --- a/src/vnet/ip/ip6_punt_drop.c +++ b/src/vnet/ip/ip6_punt_drop.c @@ -32,7 +32,11 @@ VNET_FEATURE_ARC_INIT (ip6_drop) = }; /* *INDENT-ON* */ +extern ip_punt_policer_t ip6_punt_policer_cfg; + +#ifndef CLIB_MARCH_VARIANT ip_punt_policer_t ip6_punt_policer_cfg; +#endif /* CLIB_MARCH_VARIANT */ static char *ip6_punt_policer_error_strings[] = { #define _(sym,string) string, @@ -40,9 +44,9 @@ static char *ip6_punt_policer_error_strings[] = { #undef _ }; -static uword -ip6_punt_policer (vlib_main_t * vm, - vlib_node_runtime_t * node, vlib_frame_t * frame) +VLIB_NODE_FN (ip6_punt_policer_node) (vlib_main_t * vm, + vlib_node_runtime_t * node, + vlib_frame_t * frame) { return (ip_punt_policer (vm, node, frame, vnet_feat_arc_ip6_punt.feature_arc_index, @@ -52,8 +56,7 @@ ip6_punt_policer (vlib_main_t * vm, /* *INDENT-OFF* */ -VLIB_REGISTER_NODE (ip6_punt_policer_node, static) = { - .function = ip6_punt_policer, +VLIB_REGISTER_NODE (ip6_punt_policer_node) = { .name = "ip6-punt-policer", .vector_size = sizeof (u32), .n_next_nodes = IP_PUNT_POLICER_N_NEXT, @@ -67,9 +70,6 @@ VLIB_REGISTER_NODE (ip6_punt_policer_node, static) = { }, }; -VLIB_NODE_FUNCTION_MULTIARCH (ip6_punt_policer_node, - ip6_punt_policer); - VNET_FEATURE_INIT (ip6_punt_policer_node, static) = { .arc_name = "ip6-punt", .node_name = "ip6-punt-policer", @@ -77,8 +77,8 @@ VNET_FEATURE_INIT (ip6_punt_policer_node, static) = { }; /* *INDENT-ON* */ -static uword -ip6_drop (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame) +VLIB_NODE_FN (ip6_drop_node) (vlib_main_t * vm, vlib_node_runtime_t * node, + vlib_frame_t * frame) { if (node->flags & VLIB_NODE_FLAG_TRACE) ip6_forward_next_trace (vm, node, frame, VLIB_TX); @@ -88,9 +88,9 @@ ip6_drop (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame) } -static uword -ip6_not_enabled (vlib_main_t * vm, - vlib_node_runtime_t * node, vlib_frame_t * frame) +VLIB_NODE_FN (ip6_not_enabled_node) (vlib_main_t * vm, + vlib_node_runtime_t * node, + vlib_frame_t * frame) { if (node->flags & VLIB_NODE_FLAG_TRACE) ip6_forward_next_trace (vm, node, frame, VLIB_TX); @@ -100,8 +100,8 @@ ip6_not_enabled (vlib_main_t * vm, } -static uword -ip6_punt (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame) +VLIB_NODE_FN (ip6_punt_node) (vlib_main_t * vm, vlib_node_runtime_t * node, + vlib_frame_t * frame) { if (node->flags & VLIB_NODE_FLAG_TRACE) ip6_forward_next_trace (vm, node, frame, VLIB_TX); @@ -111,9 +111,8 @@ ip6_punt (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame) } /* *INDENT-OFF* */ -VLIB_REGISTER_NODE (ip6_drop_node, static) = +VLIB_REGISTER_NODE (ip6_drop_node) = { - .function = ip6_drop, .name = "ip6-drop", .vector_size = sizeof (u32), .format_trace = format_ip6_forward_next_trace, @@ -123,11 +122,8 @@ VLIB_REGISTER_NODE (ip6_drop_node, static) = }, }; -VLIB_NODE_FUNCTION_MULTIARCH (ip6_drop_node, ip6_drop); - -VLIB_REGISTER_NODE (ip6_not_enabled_node, static) = +VLIB_REGISTER_NODE (ip6_not_enabled_node) = { - .function = ip6_not_enabled, .name = "ip6-not-enabled", .vector_size = sizeof (u32), .format_trace = format_ip6_forward_next_trace, @@ -137,11 +133,8 @@ VLIB_REGISTER_NODE (ip6_not_enabled_node, static) = }, }; -VLIB_NODE_FUNCTION_MULTIARCH (ip6_not_enabled_node, ip6_not_enabled); - -VLIB_REGISTER_NODE (ip6_punt_node, static) = +VLIB_REGISTER_NODE (ip6_punt_node) = { - .function = ip6_punt, .name = "ip6-punt", .vector_size = sizeof (u32), .format_trace = format_ip6_forward_next_trace, @@ -151,8 +144,6 @@ VLIB_REGISTER_NODE (ip6_punt_node, static) = }, }; -VLIB_NODE_FUNCTION_MULTIARCH (ip6_punt_node, ip6_punt); - VNET_FEATURE_INIT (ip6_punt_end_of_arc, static) = { .arc_name = "ip6-punt", .node_name = "error-punt", @@ -166,6 +157,7 @@ VNET_FEATURE_INIT (ip6_drop_end_of_arc, static) = { }; /* *INDENT-ON */ +#ifndef CLIB_MARCH_VARIANT void ip6_punt_policer_add_del (u8 is_add, u32 policer_index) { @@ -174,6 +166,7 @@ ip6_punt_policer_add_del (u8 is_add, u32 policer_index) vnet_feature_enable_disable ("ip6-punt", "ip6-punt-policer", 0, is_add, 0, 0); } +#endif /* CLIB_MARCH_VARIANT */ static clib_error_t * ip6_punt_police_cmd (vlib_main_t * vm, @@ -234,13 +227,16 @@ VLIB_CLI_COMMAND (ip6_punt_policer_command, static) = .short_help = "ip6 punt policer [add|del] <index>", }; +extern ip_punt_redirect_t ip6_punt_redirect_cfg; +#ifndef CLIB_MARCH_VARIANT ip_punt_redirect_t ip6_punt_redirect_cfg = { .any_rx_sw_if_index = { .tx_sw_if_index = ~0, .adj_index = ADJ_INDEX_INVALID, }, }; +#endif /* CLIB_MARCH_VARIANT */ /* *INDENT-ON* */ #define foreach_ip6_punt_redirect_error \ @@ -260,9 +256,9 @@ static char *ip6_punt_redirect_error_strings[] = { #undef _ }; -static uword -ip6_punt_redirect (vlib_main_t * vm, - vlib_node_runtime_t * node, vlib_frame_t * frame) +VLIB_NODE_FN (ip6_punt_redirect_node) (vlib_main_t * vm, + vlib_node_runtime_t * node, + vlib_frame_t * frame) { return (ip_punt_redirect (vm, node, frame, vnet_feat_arc_ip6_punt.feature_arc_index, @@ -270,8 +266,7 @@ ip6_punt_redirect (vlib_main_t * vm, } /* *INDENT-OFF* */ -VLIB_REGISTER_NODE (ip6_punt_redirect_node, static) = { - .function = ip6_punt_redirect, +VLIB_REGISTER_NODE (ip6_punt_redirect_node) = { .name = "ip6-punt-redirect", .vector_size = sizeof (u32), .n_next_nodes = IP_PUNT_REDIRECT_N_NEXT, @@ -287,9 +282,6 @@ VLIB_REGISTER_NODE (ip6_punt_redirect_node, static) = { }, }; -VLIB_NODE_FUNCTION_MULTIARCH (ip6_punt_redirect_node, - ip6_punt_redirect); - VNET_FEATURE_INIT (ip6_punt_redirect_node, static) = { .arc_name = "ip6-punt", .node_name = "ip6-punt-redirect", @@ -297,6 +289,7 @@ VNET_FEATURE_INIT (ip6_punt_redirect_node, static) = { }; /* *INDENT-ON* */ +#ifndef CLIB_MARCH_VARIANT void ip6_punt_redirect_add (u32 rx_sw_if_index, u32 tx_sw_if_index, ip46_address_t * nh) @@ -319,6 +312,7 @@ ip6_punt_redirect_del (u32 rx_sw_if_index) ip_punt_redirect_del (&ip6_punt_redirect_cfg, rx_sw_if_index); } +#endif /* CLIB_MARCH_VARIANT */ static clib_error_t * ip6_punt_redirect_cmd (vlib_main_t * vm, @@ -399,6 +393,7 @@ VLIB_CLI_COMMAND (ip6_punt_redirect_command, static) = }; /* *INDENT-ON* */ +#ifndef CLIB_MARCH_VARIANT ip_punt_redirect_detail_t * ip6_punt_redirect_entries (u32 sw_if_index) { @@ -438,6 +433,7 @@ ip6_punt_redirect_entries (u32 sw_if_index) return prs; } +#endif /* CLIB_MARCH_VARIANT */ static clib_error_t * ip6_punt_redirect_show_cmd (vlib_main_t * vm, diff --git a/src/vnet/ip/ip6_reassembly.c b/src/vnet/ip/ip6_reassembly.c index 0c86145fe40..9906250cb0f 100644 --- a/src/vnet/ip/ip6_reassembly.c +++ b/src/vnet/ip/ip6_reassembly.c @@ -151,7 +151,11 @@ typedef struct } ip6_reass_main_t; +extern ip6_reass_main_t ip6_reass_main; + +#ifndef CLIB_MARCH_VARIANT ip6_reass_main_t ip6_reass_main; +#endif /* CLIB_MARCH_VARIANT */ typedef enum { @@ -1046,16 +1050,14 @@ static char *ip6_reassembly_error_strings[] = { #undef _ }; -static uword -ip6_reassembly (vlib_main_t * vm, vlib_node_runtime_t * node, - vlib_frame_t * frame) +VLIB_NODE_FN (ip6_reass_node) (vlib_main_t * vm, vlib_node_runtime_t * node, + vlib_frame_t * frame) { return ip6_reassembly_inline (vm, node, frame, false /* is_feature */ ); } /* *INDENT-OFF* */ -VLIB_REGISTER_NODE (ip6_reass_node, static) = { - .function = ip6_reassembly, +VLIB_REGISTER_NODE (ip6_reass_node) = { .name = "ip6-reassembly", .vector_size = sizeof (u32), .format_trace = format_ip6_reass_trace, @@ -1072,18 +1074,15 @@ VLIB_REGISTER_NODE (ip6_reass_node, static) = { }; /* *INDENT-ON* */ -VLIB_NODE_FUNCTION_MULTIARCH (ip6_reass_node, ip6_reassembly); - -static uword -ip6_reassembly_feature (vlib_main_t * vm, - vlib_node_runtime_t * node, vlib_frame_t * frame) +VLIB_NODE_FN (ip6_reass_node_feature) (vlib_main_t * vm, + vlib_node_runtime_t * node, + vlib_frame_t * frame) { return ip6_reassembly_inline (vm, node, frame, true /* is_feature */ ); } /* *INDENT-OFF* */ -VLIB_REGISTER_NODE (ip6_reass_node_feature, static) = { - .function = ip6_reassembly_feature, +VLIB_REGISTER_NODE (ip6_reass_node_feature) = { .name = "ip6-reassembly-feature", .vector_size = sizeof (u32), .format_trace = format_ip6_reass_trace, @@ -1100,8 +1099,6 @@ VLIB_REGISTER_NODE (ip6_reass_node_feature, static) = { }; /* *INDENT-ON* */ -VLIB_NODE_FUNCTION_MULTIARCH (ip6_reass_node_feature, ip6_reassembly_feature); - /* *INDENT-OFF* */ VNET_FEATURE_INIT (ip6_reassembly_feature, static) = { .arc_name = "ip6-unicast", @@ -1111,6 +1108,7 @@ VNET_FEATURE_INIT (ip6_reassembly_feature, static) = { }; /* *INDENT-ON* */ +#ifndef CLIB_MARCH_VARIANT static u32 ip6_reass_get_nbuckets () { @@ -1127,12 +1125,14 @@ ip6_reass_get_nbuckets () return nbuckets; } +#endif /* CLIB_MARCH_VARIANT */ typedef enum { IP6_EVENT_CONFIG_CHANGED = 1, } ip6_reass_event_t; +#ifndef CLIB_MARCH_VARIANT typedef struct { int failure; @@ -1256,6 +1256,7 @@ ip6_reass_init_function (vlib_main_t * vm) } VLIB_INIT_FUNCTION (ip6_reass_init_function); +#endif /* CLIB_MARCH_VARIANT */ static uword ip6_reass_walk_expired (vlib_main_t * vm, @@ -1379,8 +1380,6 @@ ip6_reass_walk_expired (vlib_main_t * vm, return 0; } -static vlib_node_registration_t ip6_reass_expire_node; - /* *INDENT-OFF* */ VLIB_REGISTER_NODE (ip6_reass_expire_node, static) = { .function = ip6_reass_walk_expired, @@ -1493,12 +1492,14 @@ VLIB_CLI_COMMAND (show_ip6_reassembly_cmd, static) = { }; /* *INDENT-ON* */ +#ifndef CLIB_MARCH_VARIANT vnet_api_error_t ip6_reass_enable_disable (u32 sw_if_index, u8 enable_disable) { return vnet_feature_enable_disable ("ip6-unicast", "ip6-reassembly-feature", sw_if_index, enable_disable, 0, 0); } +#endif /* CLIB_MARCH_VARIANT */ #define foreach_ip6_reassembly_handoff_error \ _(CONGESTION_DROP, "congestion drop") diff --git a/src/vnet/ip/ip_in_out_acl.c b/src/vnet/ip/ip_in_out_acl.c index 699f69eda78..8f550e29b9e 100644 --- a/src/vnet/ip/ip_in_out_acl.c +++ b/src/vnet/ip/ip_in_out_acl.c @@ -50,10 +50,10 @@ format_ip_outacl_trace (u8 * s, va_list * args) return format_ip_in_out_acl_trace (s, 1 /* is_output */ , args); } -vlib_node_registration_t ip4_inacl_node; -vlib_node_registration_t ip4_outacl_node; -vlib_node_registration_t ip6_inacl_node; -vlib_node_registration_t ip6_outacl_node; +extern vlib_node_registration_t ip4_inacl_node; +extern vlib_node_registration_t ip4_outacl_node; +extern vlib_node_registration_t ip6_inacl_node; +extern vlib_node_registration_t ip6_outacl_node; #define foreach_ip_inacl_error \ _(MISS, "input ACL misses") \ @@ -486,16 +486,15 @@ ip_in_out_acl_inline (vlib_main_t * vm, return frame->n_vectors; } -static uword -ip4_inacl (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame) +VLIB_NODE_FN (ip4_inacl_node) (vlib_main_t * vm, vlib_node_runtime_t * node, + vlib_frame_t * frame) { return ip_in_out_acl_inline (vm, node, frame, 1 /* is_ip4 */ , 0 /* is_output */ ); } -static uword -ip4_outacl (vlib_main_t * vm, vlib_node_runtime_t * node, - vlib_frame_t * frame) +VLIB_NODE_FN (ip4_outacl_node) (vlib_main_t * vm, vlib_node_runtime_t * node, + vlib_frame_t * frame) { return ip_in_out_acl_inline (vm, node, frame, 1 /* is_ip4 */ , 1 /* is_output */ ); @@ -504,7 +503,6 @@ ip4_outacl (vlib_main_t * vm, vlib_node_runtime_t * node, /* *INDENT-OFF* */ VLIB_REGISTER_NODE (ip4_inacl_node) = { - .function = ip4_inacl, .name = "ip4-inacl", .vector_size = sizeof (u32), .format_trace = format_ip_inacl_trace, @@ -518,7 +516,6 @@ VLIB_REGISTER_NODE (ip4_inacl_node) = { }; VLIB_REGISTER_NODE (ip4_outacl_node) = { - .function = ip4_outacl, .name = "ip4-outacl", .vector_size = sizeof (u32), .format_trace = format_ip_outacl_trace, @@ -532,19 +529,15 @@ VLIB_REGISTER_NODE (ip4_outacl_node) = { }; /* *INDENT-ON* */ -VLIB_NODE_FUNCTION_MULTIARCH (ip4_inacl_node, ip4_inacl); -VLIB_NODE_FUNCTION_MULTIARCH (ip4_outacl_node, ip4_outacl); - -static uword -ip6_inacl (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame) +VLIB_NODE_FN (ip6_inacl_node) (vlib_main_t * vm, vlib_node_runtime_t * node, + vlib_frame_t * frame) { return ip_in_out_acl_inline (vm, node, frame, 0 /* is_ip4 */ , 0 /* is_output */ ); } -static uword -ip6_outacl (vlib_main_t * vm, vlib_node_runtime_t * node, - vlib_frame_t * frame) +VLIB_NODE_FN (ip6_outacl_node) (vlib_main_t * vm, vlib_node_runtime_t * node, + vlib_frame_t * frame) { return ip_in_out_acl_inline (vm, node, frame, 0 /* is_ip4 */ , 1 /* is_output */ ); @@ -552,7 +545,6 @@ ip6_outacl (vlib_main_t * vm, vlib_node_runtime_t * node, /* *INDENT-OFF* */ VLIB_REGISTER_NODE (ip6_inacl_node) = { - .function = ip6_inacl, .name = "ip6-inacl", .vector_size = sizeof (u32), .format_trace = format_ip_inacl_trace, @@ -566,7 +558,6 @@ VLIB_REGISTER_NODE (ip6_inacl_node) = { }; VLIB_REGISTER_NODE (ip6_outacl_node) = { - .function = ip6_outacl, .name = "ip6-outacl", .vector_size = sizeof (u32), .format_trace = format_ip_outacl_trace, @@ -580,9 +571,7 @@ VLIB_REGISTER_NODE (ip6_outacl_node) = { }; /* *INDENT-ON* */ -VLIB_NODE_FUNCTION_MULTIARCH (ip6_inacl_node, ip6_inacl); -VLIB_NODE_FUNCTION_MULTIARCH (ip6_outacl_node, ip6_outacl); - +#ifndef CLIB_MARCH_VARIANT static clib_error_t * ip_in_out_acl_init (vlib_main_t * vm) { @@ -590,6 +579,7 @@ ip_in_out_acl_init (vlib_main_t * vm) } VLIB_INIT_FUNCTION (ip_in_out_acl_init); +#endif /* CLIB_MARCH_VARIANT */ /* diff --git a/src/vnet/ip/punt.c b/src/vnet/ip/punt.c index e1c13f62aff..831ece25415 100644 --- a/src/vnet/ip/punt.c +++ b/src/vnet/ip/punt.c @@ -60,12 +60,15 @@ enum punt_socket_rx_next_e #define punt_next_punt(is_ip4) (is_ip4 ? PUNT_NEXT_PUNT4 : PUNT_NEXT_PUNT6) -vlib_node_registration_t udp4_punt_node; -vlib_node_registration_t udp6_punt_node; -vlib_node_registration_t udp4_punt_socket_node; -vlib_node_registration_t udp6_punt_socket_node; +extern vlib_node_registration_t udp4_punt_node; +extern vlib_node_registration_t udp6_punt_node; +extern vlib_node_registration_t udp4_punt_socket_node; +extern vlib_node_registration_t udp6_punt_socket_node; static vlib_node_registration_t punt_socket_rx_node; +extern punt_main_t punt_main; + +#ifndef CLIB_MARCH_VARIANT punt_main_t punt_main; char * @@ -74,6 +77,7 @@ vnet_punt_get_server_pathname (void) punt_main_t *pm = &punt_main; return pm->sun_path; } +#endif /* CLIB_MARCH_VARIANT */ /** @brief IPv4/IPv6 UDP punt node main loop. @@ -159,9 +163,9 @@ static char *punt_error_strings[] = { <em>Next Index:</em> - Dispatches the packet to the "error-punt" node */ -static uword -udp4_punt (vlib_main_t * vm, - vlib_node_runtime_t * node, vlib_frame_t * from_frame) +VLIB_NODE_FN (udp4_punt_node) (vlib_main_t * vm, + vlib_node_runtime_t * node, + vlib_frame_t * from_frame) { return udp46_punt_inline (vm, node, from_frame, 1 /* is_ip4 */ ); } @@ -187,16 +191,15 @@ udp4_punt (vlib_main_t * vm, <em>Next Index:</em> - Dispatches the packet to the "error-punt" node */ -static uword -udp6_punt (vlib_main_t * vm, - vlib_node_runtime_t * node, vlib_frame_t * from_frame) +VLIB_NODE_FN (udp6_punt_node) (vlib_main_t * vm, + vlib_node_runtime_t * node, + vlib_frame_t * from_frame) { return udp46_punt_inline (vm, node, from_frame, 0 /* is_ip4 */ ); } /* *INDENT-OFF* */ VLIB_REGISTER_NODE (udp4_punt_node) = { - .function = udp4_punt, .name = "ip4-udp-punt", /* Takes a vector of packets. */ .vector_size = sizeof (u32), @@ -212,10 +215,7 @@ VLIB_REGISTER_NODE (udp4_punt_node) = { }, }; -VLIB_NODE_FUNCTION_MULTIARCH (udp4_punt_node, udp4_punt); - VLIB_REGISTER_NODE (udp6_punt_node) = { - .function = udp6_punt, .name = "ip6-udp-punt", /* Takes a vector of packets. */ .vector_size = sizeof (u32), @@ -231,8 +231,6 @@ VLIB_REGISTER_NODE (udp6_punt_node) = { }, }; -VLIB_NODE_FUNCTION_MULTIARCH (udp6_punt_node, udp6_punt);; - /* *INDENT-ON* */ static punt_client_t * @@ -259,6 +257,7 @@ punt_socket_get (bool is_ip4, u16 port) return NULL; } +#ifndef CLIB_MARCH_VARIANT static int punt_socket_register (bool is_ip4, u8 protocol, u16 port, char *client_pathname) @@ -288,6 +287,7 @@ punt_socket_unregister (bool is_ip4, u8 protocol, u16 port) { return; } +#endif /* CLIB_MARCH_VARIANT */ typedef struct { @@ -295,7 +295,7 @@ typedef struct u8 is_midchain; } udp_punt_trace_t; -u8 * +static u8 * format_udp_punt_trace (u8 * s, va_list * args) { CLIB_UNUSED (vlib_main_t * vm) = va_arg (*args, vlib_main_t *); @@ -637,6 +637,7 @@ punt_socket_read_ready (clib_file_t * uf) return 0; } +#ifndef CLIB_MARCH_VARIANT clib_error_t * vnet_punt_socket_add (vlib_main_t * vm, u32 header_version, bool is_ip4, u8 protocol, u16 port, @@ -772,6 +773,7 @@ vnet_punt_add_del (vlib_main_t * vm, u8 ipv, u8 protocol, u16 port, return 0; } } +#endif /* CLIB_MARCH_VARIANT */ static clib_error_t * punt_cli (vlib_main_t * vm, @@ -841,6 +843,7 @@ VLIB_CLI_COMMAND (punt_command, static) = { }; /* *INDENT-ON* */ +#ifndef CLIB_MARCH_VARIANT static clib_error_t * punt_socket_register_cmd (vlib_main_t * vm, unformat_input_t * input, vlib_cli_command_t * cmd) @@ -1075,6 +1078,7 @@ punt_init (vlib_main_t * vm) } VLIB_INIT_FUNCTION (punt_init); +#endif /* CLIB_MARCH_VARIANT */ static clib_error_t * punt_config (vlib_main_t * vm, unformat_input_t * input) |