aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/cnat
diff options
context:
space:
mode:
authorNathan Skrzypczak <nathan.skrzypczak@gmail.com>2020-11-02 17:29:52 +0100
committerMatthew Smith <mgsmith@netgate.com>2020-11-05 16:47:38 +0000
commit38049e48a7a8da115f555bbb476b0fdbfb9cbb76 (patch)
tree1d7db4dde8e977a36eaf28cc5a57fcbf7b92573a /src/plugins/cnat
parente019cacbe2399fadd41b3f22b6837431dd631e2a (diff)
cnat: reduce compile time
Compile time reduced from ~30s to 2s for cnat_node_vip.c & cnat_node_snat.c This doesn't impact performance for now as ts update rwlock is the main bottleneck. Type: improvement Change-Id: Ic92df300ae0dfddc5235c350bd021e73e7c850d9 Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com>
Diffstat (limited to 'src/plugins/cnat')
-rw-r--r--src/plugins/cnat/cnat_node_snat.c22
-rw-r--r--src/plugins/cnat/cnat_node_vip.c18
2 files changed, 20 insertions, 20 deletions
diff --git a/src/plugins/cnat/cnat_node_snat.c b/src/plugins/cnat/cnat_node_snat.c
index d92200fec05..8166df6a757 100644
--- a/src/plugins/cnat/cnat_node_snat.c
+++ b/src/plugins/cnat/cnat_node_snat.c
@@ -55,17 +55,17 @@ format_cnat_snat_trace (u8 * s, va_list * args)
/* CNat sub for source NAT as a feature arc on ip[46]-unicast
This node's sub shouldn't apply to the same flows as
cnat_vip_inline */
-always_inline uword
-cnat_snat_inline (vlib_main_t * vm,
- vlib_node_runtime_t * node,
- vlib_buffer_t * b,
- cnat_node_ctx_t * ctx, int rv, cnat_session_t * session)
+static uword
+cnat_snat_node_fn (vlib_main_t * vm,
+ vlib_node_runtime_t * node,
+ vlib_buffer_t * b,
+ cnat_node_ctx_t * ctx, int rv, cnat_session_t * session)
{
cnat_main_t *cm = &cnat_main;
int created_session = 0;
- ip4_header_t *ip4;
+ ip4_header_t *ip4 = NULL;
ip_protocol_t iproto;
- ip6_header_t *ip6;
+ ip6_header_t *ip6 = NULL;
udp_header_t *udp0;
u32 arc_next0;
u16 next0;
@@ -182,9 +182,9 @@ VLIB_NODE_FN (cnat_snat_ip4_node) (vlib_main_t * vm,
vlib_frame_t * frame)
{
if (PREDICT_FALSE ((node->flags & VLIB_NODE_FLAG_TRACE)))
- return cnat_node_inline (vm, node, frame, cnat_snat_inline, AF_IP4,
+ return cnat_node_inline (vm, node, frame, cnat_snat_node_fn, AF_IP4,
1 /* do_trace */ );
- return cnat_node_inline (vm, node, frame, cnat_snat_inline, AF_IP4,
+ return cnat_node_inline (vm, node, frame, cnat_snat_node_fn, AF_IP4,
0 /* do_trace */ );
}
@@ -193,9 +193,9 @@ VLIB_NODE_FN (cnat_snat_ip6_node) (vlib_main_t * vm,
vlib_frame_t * frame)
{
if (PREDICT_FALSE ((node->flags & VLIB_NODE_FLAG_TRACE)))
- return cnat_node_inline (vm, node, frame, cnat_snat_inline, AF_IP6,
+ return cnat_node_inline (vm, node, frame, cnat_snat_node_fn, AF_IP6,
1 /* do_trace */ );
- return cnat_node_inline (vm, node, frame, cnat_snat_inline, AF_IP6,
+ return cnat_node_inline (vm, node, frame, cnat_snat_node_fn, AF_IP6,
0 /* do_trace */ );
}
diff --git a/src/plugins/cnat/cnat_node_vip.c b/src/plugins/cnat/cnat_node_vip.c
index bbce5f3bd15..8dd53ad6fb4 100644
--- a/src/plugins/cnat/cnat_node_vip.c
+++ b/src/plugins/cnat/cnat_node_vip.c
@@ -65,11 +65,11 @@ format_cnat_translation_trace (u8 * s, va_list * args)
}
/* CNat sub for NAT behind a fib entry (VIP or interposed real IP) */
-always_inline uword
-cnat_vip_inline (vlib_main_t * vm,
- vlib_node_runtime_t * node,
- vlib_buffer_t * b,
- cnat_node_ctx_t * ctx, int rv, cnat_session_t * session)
+static uword
+cnat_vip_node_fn (vlib_main_t * vm,
+ vlib_node_runtime_t * node,
+ vlib_buffer_t * b,
+ cnat_node_ctx_t * ctx, int rv, cnat_session_t * session)
{
vlib_combined_counter_main_t *cntm = &cnat_translation_counters;
const cnat_translation_t *ct = NULL;
@@ -251,9 +251,9 @@ VLIB_NODE_FN (cnat_vip_ip4_node) (vlib_main_t * vm,
vlib_frame_t * frame)
{
if (PREDICT_FALSE ((node->flags & VLIB_NODE_FLAG_TRACE)))
- return cnat_node_inline (vm, node, frame, cnat_vip_inline, AF_IP4,
+ return cnat_node_inline (vm, node, frame, cnat_vip_node_fn, AF_IP4,
1 /* do_trace */ );
- return cnat_node_inline (vm, node, frame, cnat_vip_inline, AF_IP4,
+ return cnat_node_inline (vm, node, frame, cnat_vip_node_fn, AF_IP4,
0 /* do_trace */ );
}
@@ -262,9 +262,9 @@ VLIB_NODE_FN (cnat_vip_ip6_node) (vlib_main_t * vm,
vlib_frame_t * frame)
{
if (PREDICT_FALSE ((node->flags & VLIB_NODE_FLAG_TRACE)))
- return cnat_node_inline (vm, node, frame, cnat_vip_inline, AF_IP6,
+ return cnat_node_inline (vm, node, frame, cnat_vip_node_fn, AF_IP6,
1 /* do_trace */ );
- return cnat_node_inline (vm, node, frame, cnat_vip_inline, AF_IP6,
+ return cnat_node_inline (vm, node, frame, cnat_vip_node_fn, AF_IP6,
0 /* do_trace */ );
}