aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjackiechen1985 <xiaobo.chen@tieto.com>2019-04-30 17:01:29 +0800
committerNeale Ranns <nranns@cisco.com>2019-05-23 07:24:35 +0000
commit23551d6c40142c215eb39bfd79265d136d13fa33 (patch)
tree93018638e54af0b397ea9706fee004325aebb374
parenta9f194af9a7943922d8986584885b03d4538e12e (diff)
Optimize code
Replace enqueue code with marcro vlib_validate_buffer_enqueue_x1 Change-Id: I4b454b1d73fa5adbaf5f40cf45dc8975878ac93b Signed-off-by: jackiechen1985 <xiaobo.chen@tieto.com>
-rw-r--r--src/vnet/ip/icmp4.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/src/vnet/ip/icmp4.c b/src/vnet/ip/icmp4.c
index 500aa6d9c16..4ca108c63da 100644
--- a/src/vnet/ip/icmp4.c
+++ b/src/vnet/ip/icmp4.c
@@ -188,15 +188,10 @@ ip4_icmp_input (vlib_main_t * vm,
next0 = im->ip4_input_next_index_by_type[type0];
p0->error = node->errors[ICMP4_ERROR_UNKNOWN_TYPE];
- if (PREDICT_FALSE (next0 != next))
- {
- vlib_put_next_frame (vm, node, next, n_left_to_next + 1);
- next = next0;
- vlib_get_next_frame (vm, node, next, to_next, n_left_to_next);
- to_next[0] = bi0;
- to_next += 1;
- n_left_to_next -= 1;
- }
+
+ /* Verify speculative enqueue, maybe switch current next frame */
+ vlib_validate_buffer_enqueue_x1 (vm, node, next, to_next,
+ n_left_to_next, bi0, next0);
}
vlib_put_next_frame (vm, node, next, n_left_to_next);