aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/nat/nat44_classify.c
diff options
context:
space:
mode:
authorFilip Varga <fivarga@cisco.com>2020-01-17 19:24:13 +0100
committerOle Trøan <otroan@employees.org>2020-01-21 10:25:07 +0000
commit2b4e7401499cdc7d51dec027745e0228d3f07b64 (patch)
treefa4ae0bfaaf94dba6becee2978e9bae32a12e5f0 /src/plugins/nat/nat44_classify.c
parentcd681adab40f49d1305144b6bbbd5118e63a2805 (diff)
nat: removed obsolete fragmentation code
Type: fix Ticket: VPP-1817 Signed-off-by: Filip Varga <fivarga@cisco.com> Change-Id: Id4d694ce636b0a213e65ce27c32a8150df9af0f8
Diffstat (limited to 'src/plugins/nat/nat44_classify.c')
-rw-r--r--src/plugins/nat/nat44_classify.c100
1 files changed, 16 insertions, 84 deletions
diff --git a/src/plugins/nat/nat44_classify.c b/src/plugins/nat/nat44_classify.c
index f339770d8f5..f1c80aab98b 100644
--- a/src/plugins/nat/nat44_classify.c
+++ b/src/plugins/nat/nat44_classify.c
@@ -85,7 +85,6 @@ nat44_classify_node_fn_inline (vlib_main_t * vm,
snat_main_t *sm = &snat_main;
snat_static_mapping_t *m;
u32 *fragments_to_drop = 0;
- u32 *fragments_to_loopback = 0;
u32 next_in2out = 0, next_out2in = 0, frag_cached = 0;
from = vlib_frame_vector_args (frame);
@@ -107,7 +106,6 @@ nat44_classify_node_fn_inline (vlib_main_t * vm,
snat_address_t *ap;
snat_session_key_t m_key0;
clib_bihash_kv_8_8_t kv0, value0;
- u8 cached0 = 0;
/* speculatively enqueue b0 to the current next frame */
bi0 = from[0];
@@ -166,48 +164,17 @@ nat44_classify_node_fn_inline (vlib_main_t * vm,
{
nat44_classify_trace_t *t =
vlib_add_trace (vm, node, b0, sizeof (*t));
- t->cached = cached0;
- if (!cached0)
- t->next_in2out = next0 == NAT44_CLASSIFY_NEXT_IN2OUT ? 1 : 0;
+ t->cached = 0;
+ t->next_in2out = next0 == NAT44_CLASSIFY_NEXT_IN2OUT ? 1 : 0;
}
- if (cached0)
- {
- n_left_to_next++;
- to_next--;
- frag_cached++;
- }
- else
- {
- next_in2out += next0 == NAT44_CLASSIFY_NEXT_IN2OUT;
- next_out2in += next0 == NAT44_CLASSIFY_NEXT_OUT2IN;
+ next_in2out += next0 == NAT44_CLASSIFY_NEXT_IN2OUT;
+ next_out2in += next0 == NAT44_CLASSIFY_NEXT_OUT2IN;
- /* verify speculative enqueue, maybe switch current next frame */
- vlib_validate_buffer_enqueue_x1 (vm, node, next_index,
- to_next, n_left_to_next,
- bi0, next0);
- }
-
- if (n_left_from == 0 && vec_len (fragments_to_loopback))
- {
- from = vlib_frame_vector_args (frame);
- u32 len = vec_len (fragments_to_loopback);
- if (len <= VLIB_FRAME_SIZE)
- {
- clib_memcpy_fast (from, fragments_to_loopback,
- sizeof (u32) * len);
- n_left_from = len;
- vec_reset_length (fragments_to_loopback);
- }
- else
- {
- clib_memcpy_fast (from, fragments_to_loopback +
- (len - VLIB_FRAME_SIZE),
- sizeof (u32) * VLIB_FRAME_SIZE);
- n_left_from = VLIB_FRAME_SIZE;
- _vec_len (fragments_to_loopback) = len - VLIB_FRAME_SIZE;
- }
- }
+ /* verify speculative enqueue, maybe switch current next frame */
+ vlib_validate_buffer_enqueue_x1 (vm, node, next_index,
+ to_next, n_left_to_next,
+ bi0, next0);
}
vlib_put_next_frame (vm, node, next_index, n_left_to_next);
@@ -240,7 +207,6 @@ nat44_ed_classify_node_fn_inline (vlib_main_t * vm,
u32 thread_index = vm->thread_index;
snat_main_per_thread_data_t *tsm = &sm->per_thread_data[thread_index];
u32 *fragments_to_drop = 0;
- u32 *fragments_to_loopback = 0;
u32 next_in2out = 0, next_out2in = 0, frag_cached = 0;
u8 in_loopback = 0;
@@ -265,7 +231,6 @@ nat44_ed_classify_node_fn_inline (vlib_main_t * vm,
snat_session_key_t m_key0;
clib_bihash_kv_8_8_t kv0, value0;
clib_bihash_kv_16_8_t ed_kv0, ed_value0;
- u8 cached0 = 0;
/* speculatively enqueue b0 to the current next frame */
bi0 = from[0];
@@ -351,50 +316,17 @@ nat44_ed_classify_node_fn_inline (vlib_main_t * vm,
{
nat44_classify_trace_t *t =
vlib_add_trace (vm, node, b0, sizeof (*t));
- t->cached = cached0;
- if (!cached0)
- t->next_in2out =
- next0 == NAT_NEXT_IN2OUT_ED_FAST_PATH ? 1 : 0;
+ t->cached = 0;
+ t->next_in2out = next0 == NAT_NEXT_IN2OUT_ED_FAST_PATH ? 1 : 0;
}
- if (cached0)
- {
- n_left_to_next++;
- to_next--;
- frag_cached++;
- }
- else
- {
- next_in2out += next0 == NAT_NEXT_IN2OUT_ED_FAST_PATH;
- next_out2in += next0 == NAT_NEXT_OUT2IN_ED_FAST_PATH;
+ next_in2out += next0 == NAT_NEXT_IN2OUT_ED_FAST_PATH;
+ next_out2in += next0 == NAT_NEXT_OUT2IN_ED_FAST_PATH;
- /* verify speculative enqueue, maybe switch current next frame */
- vlib_validate_buffer_enqueue_x1 (vm, node, next_index,
- to_next, n_left_to_next,
- bi0, next0);
- }
-
- if (n_left_from == 0 && vec_len (fragments_to_loopback))
- {
- in_loopback = 1;
- from = vlib_frame_vector_args (frame);
- u32 len = vec_len (fragments_to_loopback);
- if (len <= VLIB_FRAME_SIZE)
- {
- clib_memcpy_fast (from, fragments_to_loopback,
- sizeof (u32) * len);
- n_left_from = len;
- vec_reset_length (fragments_to_loopback);
- }
- else
- {
- clib_memcpy_fast (from, fragments_to_loopback +
- (len - VLIB_FRAME_SIZE),
- sizeof (u32) * VLIB_FRAME_SIZE);
- n_left_from = VLIB_FRAME_SIZE;
- _vec_len (fragments_to_loopback) = len - VLIB_FRAME_SIZE;
- }
- }
+ /* verify speculative enqueue, maybe switch current next frame */
+ vlib_validate_buffer_enqueue_x1 (vm, node, next_index,
+ to_next, n_left_to_next,
+ bi0, next0);
}
vlib_put_next_frame (vm, node, next_index, n_left_to_next);