summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZhiyong Yang <zhiyong.yang@intel.com>2019-05-21 01:46:35 -0400
committerDamjan Marion <dmarion@me.com>2019-05-21 14:13:48 +0000
commitd3ebc83af33be72409032e7969dc2dcfc07a9783 (patch)
tree896bc90ee352b55c2dc3b524994be046598563d9
parent46cd9fc970e6a17457be497db71c681d3eaa3087 (diff)
geneve_input: leverage vlib_get_buffers
vlib_get_buffers helps save 1.4 clocks/pkt from 34.6 to 33.2 clocks/pkt on Skylake. Change-Id: I741d10d20373f12d30ec8b04ad8c7444ffb42246 Signed-off-by: Zhiyong Yang <zhiyong.yang@intel.com>
-rw-r--r--src/vnet/geneve/decap.c23
1 files changed, 11 insertions, 12 deletions
diff --git a/src/vnet/geneve/decap.c b/src/vnet/geneve/decap.c
index ac1369d6fd9..e85e25f43ee 100644
--- a/src/vnet/geneve/decap.c
+++ b/src/vnet/geneve/decap.c
@@ -81,6 +81,7 @@ geneve_input (vlib_main_t * vm,
u32 pkts_decapsulated = 0;
u32 thread_index = vm->thread_index;
u32 stats_sw_if_index, stats_n_packets, stats_n_bytes;
+ vlib_buffer_t *bufs[VLIB_FRAME_SIZE], **b = bufs;
if (is_ip4)
last_key4.as_u64 = ~0;
@@ -89,6 +90,7 @@ geneve_input (vlib_main_t * vm,
from = vlib_frame_vector_args (from_frame);
n_left_from = from_frame->n_vectors;
+ vlib_get_buffers (vm, from, bufs, n_left_from);
next_index = node->cached_next_index;
stats_sw_if_index = node->runtime_data[0];
@@ -117,16 +119,11 @@ geneve_input (vlib_main_t * vm,
/* Prefetch next iteration. */
{
- vlib_buffer_t *p2, *p3;
-
- p2 = vlib_get_buffer (vm, from[2]);
- p3 = vlib_get_buffer (vm, from[3]);
-
- vlib_prefetch_buffer_header (p2, LOAD);
- vlib_prefetch_buffer_header (p3, LOAD);
+ vlib_prefetch_buffer_header (b[2], LOAD);
+ vlib_prefetch_buffer_header (b[3], LOAD);
- CLIB_PREFETCH (p2->data, 2 * CLIB_CACHE_LINE_BYTES, LOAD);
- CLIB_PREFETCH (p3->data, 2 * CLIB_CACHE_LINE_BYTES, LOAD);
+ CLIB_PREFETCH (b[2]->data, 2 * CLIB_CACHE_LINE_BYTES, LOAD);
+ CLIB_PREFETCH (b[3]->data, 2 * CLIB_CACHE_LINE_BYTES, LOAD);
}
bi0 = from[0];
@@ -138,8 +135,9 @@ geneve_input (vlib_main_t * vm,
n_left_to_next -= 2;
n_left_from -= 2;
- b0 = vlib_get_buffer (vm, bi0);
- b1 = vlib_get_buffer (vm, bi1);
+ b0 = b[0];
+ b1 = b[1];
+ b += 2;
/* udp leaves current_data pointing at the geneve header */
geneve0 = vlib_buffer_get_current (b0);
@@ -563,7 +561,8 @@ geneve_input (vlib_main_t * vm,
n_left_from -= 1;
n_left_to_next -= 1;
- b0 = vlib_get_buffer (vm, bi0);
+ b0 = b[0];
+ b += 1;
/* udp leaves current_data pointing at the geneve header */
geneve0 = vlib_buffer_get_current (b0);