summaryrefslogtreecommitdiffstats
path: root/src/plugins/nat/nat64_out2in.c
diff options
context:
space:
mode:
authorFilip Varga <fivarga@cisco.com>2019-02-13 01:42:59 -0800
committerDamjan Marion <dmarion@me.com>2019-02-18 16:46:50 +0000
commite69e423743630b52e13db58c3f0229df8a46c07f (patch)
tree5471b64b7fe38031f47791c987f9791fc8207fa7 /src/plugins/nat/nat64_out2in.c
parent7dcb80a202f1ce075434a17ace3334a7a311e84e (diff)
NAT: VPP-1552 code migration from old multiarch scheme
Change-Id: I88f3df8aaa521e7707ef3335acdbf1ab41e7ee28 Signed-off-by: Filip Varga <fivarga@cisco.com>
Diffstat (limited to 'src/plugins/nat/nat64_out2in.c')
-rw-r--r--src/plugins/nat/nat64_out2in.c48
1 files changed, 18 insertions, 30 deletions
diff --git a/src/plugins/nat/nat64_out2in.c b/src/plugins/nat/nat64_out2in.c
index 6c9e216d96e..b62bbee6f49 100644
--- a/src/plugins/nat/nat64_out2in.c
+++ b/src/plugins/nat/nat64_out2in.c
@@ -67,9 +67,6 @@ format_nat64_out2in_reass_trace (u8 * s, va_list * args)
return s;
}
-vlib_node_registration_t nat64_out2in_node;
-vlib_node_registration_t nat64_out2in_reass_node;
-vlib_node_registration_t nat64_out2in_handoff_node;
#define foreach_nat64_out2in_error \
_(UNSUPPORTED_PROTOCOL, "unsupported protocol") \
@@ -433,12 +430,13 @@ nat64_out2in_unk_proto_set_cb (ip4_header_t * ip4, ip6_header_t * ip6,
return 0;
}
-static uword
-nat64_out2in_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
- vlib_frame_t * frame)
+VLIB_NODE_FN (nat64_out2in_node) (vlib_main_t * vm,
+ vlib_node_runtime_t * node,
+ vlib_frame_t * frame)
{
u32 n_left_from, *from, *to_next;
nat64_out2in_next_t next_index;
+ nat64_main_t *nm = &nat64_main;
u32 pkts_processed = 0;
u32 thread_index = vm->thread_index;
u32 tcp_packets = 0, udp_packets = 0, icmp_packets = 0, other_packets =
@@ -557,19 +555,19 @@ nat64_out2in_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
}
vlib_put_next_frame (vm, node, next_index, n_left_to_next);
}
- vlib_node_increment_counter (vm, nat64_out2in_node.index,
+ vlib_node_increment_counter (vm, nm->out2in_node_index,
NAT64_OUT2IN_ERROR_OUT2IN_PACKETS,
pkts_processed);
- vlib_node_increment_counter (vm, nat64_out2in_node.index,
+ vlib_node_increment_counter (vm, nm->out2in_node_index,
NAT64_OUT2IN_ERROR_TCP_PACKETS, tcp_packets);
- vlib_node_increment_counter (vm, nat64_out2in_node.index,
+ vlib_node_increment_counter (vm, nm->out2in_node_index,
NAT64_OUT2IN_ERROR_UDP_PACKETS, tcp_packets);
- vlib_node_increment_counter (vm, nat64_out2in_node.index,
+ vlib_node_increment_counter (vm, nm->out2in_node_index,
NAT64_OUT2IN_ERROR_ICMP_PACKETS, icmp_packets);
- vlib_node_increment_counter (vm, nat64_out2in_node.index,
+ vlib_node_increment_counter (vm, nm->out2in_node_index,
NAT64_OUT2IN_ERROR_OTHER_PACKETS,
other_packets);
- vlib_node_increment_counter (vm, nat64_out2in_node.index,
+ vlib_node_increment_counter (vm, nm->out2in_node_index,
NAT64_OUT2IN_ERROR_FRAGMENTS, fragments);
return frame->n_vectors;
@@ -577,7 +575,6 @@ nat64_out2in_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
/* *INDENT-OFF* */
VLIB_REGISTER_NODE (nat64_out2in_node) = {
- .function = nat64_out2in_node_fn,
.name = "nat64-out2in",
.vector_size = sizeof (u32),
.format_trace = format_nat64_out2in_trace,
@@ -595,8 +592,6 @@ VLIB_REGISTER_NODE (nat64_out2in_node) = {
};
/* *INDENT-ON* */
-VLIB_NODE_FUNCTION_MULTIARCH (nat64_out2in_node, nat64_out2in_node_fn);
-
typedef struct nat64_out2in_frag_set_ctx_t_
{
vlib_main_t *vm;
@@ -695,9 +690,9 @@ nat64_out2in_frag_set_cb (ip4_header_t * ip4, ip6_header_t * ip6, void *arg)
return 0;
}
-static uword
-nat64_out2in_reass_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
- vlib_frame_t * frame)
+VLIB_NODE_FN (nat64_out2in_reass_node) (vlib_main_t * vm,
+ vlib_node_runtime_t * node,
+ vlib_frame_t * frame)
{
u32 n_left_from, *from, *to_next;
nat64_out2in_next_t next_index;
@@ -916,10 +911,10 @@ nat64_out2in_reass_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
vlib_put_next_frame (vm, node, next_index, n_left_to_next);
}
- vlib_node_increment_counter (vm, nat64_out2in_reass_node.index,
+ vlib_node_increment_counter (vm, nm->out2in_reass_node_index,
NAT64_OUT2IN_ERROR_PROCESSED_FRAGMENTS,
pkts_processed);
- vlib_node_increment_counter (vm, nat64_out2in_reass_node.index,
+ vlib_node_increment_counter (vm, nm->out2in_reass_node_index,
NAT64_OUT2IN_ERROR_CACHED_FRAGMENTS,
cached_fragments);
@@ -934,7 +929,6 @@ nat64_out2in_reass_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
/* *INDENT-OFF* */
VLIB_REGISTER_NODE (nat64_out2in_reass_node) = {
- .function = nat64_out2in_reass_node_fn,
.name = "nat64-out2in-reass",
.vector_size = sizeof (u32),
.format_trace = format_nat64_out2in_reass_trace,
@@ -952,9 +946,6 @@ VLIB_REGISTER_NODE (nat64_out2in_reass_node) = {
};
/* *INDENT-ON* */
-VLIB_NODE_FUNCTION_MULTIARCH (nat64_out2in_reass_node,
- nat64_out2in_reass_node_fn);
-
#define foreach_nat64_out2in_handoff_error \
_(CONGESTION_DROP, "congestion drop") \
_(SAME_WORKER, "same worker") \
@@ -993,9 +984,9 @@ format_nat64_out2in_handoff_trace (u8 * s, va_list * args)
return s;
}
-static inline uword
-nat64_out2in_handoff_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
- vlib_frame_t * frame)
+VLIB_NODE_FN (nat64_out2in_handoff_node) (vlib_main_t * vm,
+ vlib_node_runtime_t * node,
+ vlib_frame_t * frame)
{
nat64_main_t *nm = &nat64_main;
vlib_buffer_t *bufs[VLIB_FRAME_SIZE], **b;
@@ -1060,7 +1051,6 @@ nat64_out2in_handoff_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
/* *INDENT-OFF* */
VLIB_REGISTER_NODE (nat64_out2in_handoff_node) = {
- .function = nat64_out2in_handoff_node_fn,
.name = "nat64-out2in-handoff",
.vector_size = sizeof (u32),
.format_trace = format_nat64_out2in_handoff_trace,
@@ -1076,8 +1066,6 @@ VLIB_REGISTER_NODE (nat64_out2in_handoff_node) = {
};
/* *INDENT-ON* */
-VLIB_NODE_FUNCTION_MULTIARCH (nat64_out2in_handoff_node,
- nat64_out2in_handoff_node_fn);
/*
* fd.io coding-style-patch-verification: ON
*