aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/nat/in2out_ed.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/in2out_ed.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/in2out_ed.c')
-rw-r--r--src/plugins/nat/in2out_ed.c85
1 files changed, 27 insertions, 58 deletions
diff --git a/src/plugins/nat/in2out_ed.c b/src/plugins/nat/in2out_ed.c
index 2cde378e801..8479d276261 100644
--- a/src/plugins/nat/in2out_ed.c
+++ b/src/plugins/nat/in2out_ed.c
@@ -81,12 +81,6 @@ typedef struct
u32 is_slow_path;
} nat_in2out_ed_trace_t;
-vlib_node_registration_t nat44_ed_in2out_node;
-vlib_node_registration_t nat44_ed_in2out_slowpath_node;
-vlib_node_registration_t nat44_ed_in2out_output_node;
-vlib_node_registration_t nat44_ed_in2out_output_slowpath_node;
-vlib_node_registration_t nat44_ed_in2out_reass_node;
-
static u8 *
format_nat_in2out_ed_trace (u8 * s, va_list * args)
{
@@ -154,6 +148,7 @@ icmp_get_ed_key (ip4_header_t * ip0, nat_ed_ses_key_t * p_key0)
return 0;
}
+#ifndef CLIB_MARCH_VARIANT
int
nat44_i2o_ed_is_idle_session_cb (clib_bihash_kv_16_8_t * kv, void *arg)
{
@@ -243,6 +238,7 @@ nat44_i2o_ed_is_idle_session_cb (clib_bihash_kv_16_8_t * kv, void *arg)
return 0;
}
+#endif
static inline u32
icmp_in2out_ed_slow_path (snat_main_t * sm, vlib_buffer_t * b0,
@@ -587,6 +583,7 @@ nat44_ed_not_translate_output_feature (snat_main_t * sm, ip4_header_t * ip,
return 0;
}
+#ifndef CLIB_MARCH_VARIANT
u32
icmp_match_in2out_ed (snat_main_t * sm, vlib_node_runtime_t * node,
u32 thread_index, vlib_buffer_t * b, ip4_header_t * ip,
@@ -696,6 +693,7 @@ out:
*(snat_session_t **) d = s;
return next;
}
+#endif
static snat_session_t *
nat44_ed_in2out_unknown_proto (snat_main_t * sm,
@@ -912,8 +910,8 @@ nat44_ed_in2out_node_fn_inline (vlib_main_t * vm,
u32 tcp_packets = 0, udp_packets = 0, icmp_packets = 0, other_packets =
0, fragments = 0;
- stats_node_index = is_slow_path ? nat44_ed_in2out_slowpath_node.index :
- nat44_ed_in2out_node.index;
+ stats_node_index = is_slow_path ? sm->ed_in2out_slowpath_node_index :
+ sm->ed_in2out_node_index;
from = vlib_frame_vector_args (frame);
n_left_from = frame->n_vectors;
@@ -1650,17 +1648,15 @@ nat44_ed_in2out_node_fn_inline (vlib_main_t * vm,
return frame->n_vectors;
}
-static uword
-nat44_ed_in2out_fast_path_fn (vlib_main_t * vm,
- vlib_node_runtime_t * node,
- vlib_frame_t * frame)
+VLIB_NODE_FN (nat44_ed_in2out_node) (vlib_main_t * vm,
+ vlib_node_runtime_t * node,
+ vlib_frame_t * frame)
{
return nat44_ed_in2out_node_fn_inline (vm, node, frame, 0, 0);
}
/* *INDENT-OFF* */
VLIB_REGISTER_NODE (nat44_ed_in2out_node) = {
- .function = nat44_ed_in2out_fast_path_fn,
.name = "nat44-ed-in2out",
.vector_size = sizeof (u32),
.format_trace = format_nat_in2out_ed_trace,
@@ -1679,20 +1675,15 @@ VLIB_REGISTER_NODE (nat44_ed_in2out_node) = {
};
/* *INDENT-ON* */
-VLIB_NODE_FUNCTION_MULTIARCH (nat44_ed_in2out_node,
- nat44_ed_in2out_fast_path_fn);
-
-static uword
-nat44_ed_in2out_output_fast_path_fn (vlib_main_t * vm,
- vlib_node_runtime_t * node,
- vlib_frame_t * frame)
+VLIB_NODE_FN (nat44_ed_in2out_output_node) (vlib_main_t * vm,
+ vlib_node_runtime_t * node,
+ vlib_frame_t * frame)
{
return nat44_ed_in2out_node_fn_inline (vm, node, frame, 0, 1);
}
/* *INDENT-OFF* */
VLIB_REGISTER_NODE (nat44_ed_in2out_output_node) = {
- .function = nat44_ed_in2out_output_fast_path_fn,
.name = "nat44-ed-in2out-output",
.vector_size = sizeof (u32),
.format_trace = format_nat_in2out_ed_trace,
@@ -1711,20 +1702,15 @@ VLIB_REGISTER_NODE (nat44_ed_in2out_output_node) = {
};
/* *INDENT-ON* */
-VLIB_NODE_FUNCTION_MULTIARCH (nat44_ed_in2out_output_node,
- nat44_ed_in2out_output_fast_path_fn);
-
-static uword
-nat44_ed_in2out_slow_path_fn (vlib_main_t * vm,
- vlib_node_runtime_t * node,
- vlib_frame_t * frame)
+VLIB_NODE_FN (nat44_ed_in2out_slowpath_node) (vlib_main_t * vm,
+ vlib_node_runtime_t * node,
+ vlib_frame_t * frame)
{
return nat44_ed_in2out_node_fn_inline (vm, node, frame, 1, 0);
}
/* *INDENT-OFF* */
VLIB_REGISTER_NODE (nat44_ed_in2out_slowpath_node) = {
- .function = nat44_ed_in2out_slow_path_fn,
.name = "nat44-ed-in2out-slowpath",
.vector_size = sizeof (u32),
.format_trace = format_nat_in2out_ed_trace,
@@ -1743,20 +1729,16 @@ VLIB_REGISTER_NODE (nat44_ed_in2out_slowpath_node) = {
};
/* *INDENT-ON* */
-VLIB_NODE_FUNCTION_MULTIARCH (nat44_ed_in2out_slowpath_node,
- nat44_ed_in2out_slow_path_fn);
-
-static uword
-nat44_ed_in2out_output_slow_path_fn (vlib_main_t * vm,
- vlib_node_runtime_t * node,
- vlib_frame_t * frame)
+VLIB_NODE_FN (nat44_ed_in2out_output_slowpath_node) (vlib_main_t * vm,
+ vlib_node_runtime_t *
+ node,
+ vlib_frame_t * frame)
{
return nat44_ed_in2out_node_fn_inline (vm, node, frame, 1, 1);
}
/* *INDENT-OFF* */
VLIB_REGISTER_NODE (nat44_ed_in2out_output_slowpath_node) = {
- .function = nat44_ed_in2out_output_slow_path_fn,
.name = "nat44-ed-in2out-output-slowpath",
.vector_size = sizeof (u32),
.format_trace = format_nat_in2out_ed_trace,
@@ -1775,9 +1757,6 @@ VLIB_REGISTER_NODE (nat44_ed_in2out_output_slowpath_node) = {
};
/* *INDENT-ON* */
-VLIB_NODE_FUNCTION_MULTIARCH (nat44_ed_in2out_output_slowpath_node,
- nat44_ed_in2out_output_slow_path_fn);
-
static inline uword
nat44_ed_in2out_reass_node_fn_inline (vlib_main_t * vm,
vlib_node_runtime_t * node,
@@ -2102,10 +2081,10 @@ nat44_ed_in2out_reass_node_fn_inline (vlib_main_t * vm,
vlib_put_next_frame (vm, node, next_index, n_left_to_next);
}
- vlib_node_increment_counter (vm, nat44_ed_in2out_reass_node.index,
+ vlib_node_increment_counter (vm, sm->ed_in2out_reass_node_index,
NAT_IN2OUT_ED_ERROR_PROCESSED_FRAGMENTS,
pkts_processed);
- vlib_node_increment_counter (vm, nat44_ed_in2out_reass_node.index,
+ vlib_node_increment_counter (vm, sm->ed_in2out_reass_node_index,
NAT_IN2OUT_ED_ERROR_CACHED_FRAGMENTS,
cached_fragments);
@@ -2118,17 +2097,15 @@ nat44_ed_in2out_reass_node_fn_inline (vlib_main_t * vm,
return frame->n_vectors;
}
-static uword
-nat44_ed_in2out_reass_node_fn (vlib_main_t * vm,
- vlib_node_runtime_t * node,
- vlib_frame_t * frame)
+VLIB_NODE_FN (nat44_ed_in2out_reass_node) (vlib_main_t * vm,
+ vlib_node_runtime_t * node,
+ vlib_frame_t * frame)
{
return nat44_ed_in2out_reass_node_fn_inline (vm, node, frame, 0);
}
/* *INDENT-OFF* */
VLIB_REGISTER_NODE (nat44_ed_in2out_reass_node) = {
- .function = nat44_ed_in2out_reass_node_fn,
.name = "nat44-ed-in2out-reass",
.vector_size = sizeof (u32),
.format_trace = format_nat44_reass_trace,
@@ -2146,20 +2123,15 @@ VLIB_REGISTER_NODE (nat44_ed_in2out_reass_node) = {
};
/* *INDENT-ON* */
-VLIB_NODE_FUNCTION_MULTIARCH (nat44_ed_in2out_reass_node,
- nat44_ed_in2out_reass_node_fn);
-
-static uword
-nat44_ed_in2out_reass_output_node_fn (vlib_main_t * vm,
- vlib_node_runtime_t * node,
- vlib_frame_t * frame)
+VLIB_NODE_FN (nat44_ed_in2out_reass_output_node) (vlib_main_t * vm,
+ vlib_node_runtime_t * node,
+ vlib_frame_t * frame)
{
return nat44_ed_in2out_reass_node_fn_inline (vm, node, frame, 1);
}
/* *INDENT-OFF* */
VLIB_REGISTER_NODE (nat44_ed_in2out_reass_output_node) = {
- .function = nat44_ed_in2out_reass_output_node_fn,
.name = "nat44-ed-in2out-reass-output",
.vector_size = sizeof (u32),
.format_trace = format_nat44_reass_trace,
@@ -2177,9 +2149,6 @@ VLIB_REGISTER_NODE (nat44_ed_in2out_reass_output_node) = {
};
/* *INDENT-ON* */
-VLIB_NODE_FUNCTION_MULTIARCH (nat44_ed_in2out_reass_output_node,
- nat44_ed_in2out_reass_output_node_fn);
-
/*
* fd.io coding-style-patch-verification: ON
*