summaryrefslogtreecommitdiffstats
path: root/src/vnet/ipsec/ipsec_output.c
diff options
context:
space:
mode:
authorZhiyong Yang <zhiyong.yang@intel.com>2019-04-22 00:18:38 -0400
committerDamjan Marion <dmarion@me.com>2019-04-23 07:13:19 +0000
commitf92211672646dccdaf50ec7cea9197e15dca03ed (patch)
tree99211e9dc4db86cf26fe91edbedd9cf83644b307 /src/vnet/ipsec/ipsec_output.c
parent7f4fd22f2f56b2b4620139d377e8db0976a2ae3b (diff)
ipsec4-output: add pkt header and data prefetching
The graph node running IPsec encap in tunnel mode can be saved from 65.8 to 57.3 clocks/pkt on Haswell platform. The graph node can be saved 10 clockes/pkt on DVN as well in the same case. Change-Id: I4804879c4d489465ee56a8f8317596b7e79b9331 Signed-off-by: Zhiyong Yang <zhiyong.yang@intel.com>
Diffstat (limited to 'src/vnet/ipsec/ipsec_output.c')
-rw-r--r--src/vnet/ipsec/ipsec_output.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/vnet/ipsec/ipsec_output.c b/src/vnet/ipsec/ipsec_output.c
index 83ab629453d..47eeb46d659 100644
--- a/src/vnet/ipsec/ipsec_output.c
+++ b/src/vnet/ipsec/ipsec_output.c
@@ -194,8 +194,8 @@ ipsec_output_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
while (n_left_from > 0)
{
- u32 bi0, pi0;
- vlib_buffer_t *b0;
+ u32 bi0, pi0, bi1;
+ vlib_buffer_t *b0, *b1;
ipsec_policy_t *p0;
ip4_header_t *ip0;
ip6_header_t *ip6_0 = 0;
@@ -205,11 +205,18 @@ ipsec_output_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
u64 bytes0;
bi0 = from[0];
+ bi1 = from[1];
b0 = vlib_get_buffer (vm, bi0);
+ b1 = vlib_get_buffer (vm, bi1);
sw_if_index0 = vnet_buffer (b0)->sw_if_index[VLIB_TX];
iph_offset = vnet_buffer (b0)->ip.save_rewrite_length;
ip0 = (ip4_header_t *) ((u8 *) vlib_buffer_get_current (b0)
+ iph_offset);
+ if (n_left_from > 1)
+ {
+ CLIB_PREFETCH (b1, CLIB_CACHE_LINE_BYTES * 2, STORE);
+ vlib_prefetch_buffer_data (b1, LOAD);
+ }
/* lookup for SPD only if sw_if_index is changed */
if (PREDICT_FALSE (last_sw_if_index != sw_if_index0))