misc: minimize dependencies on udp.h
[vpp.git] / src / vnet / ipsec / esp_encrypt.c
index c0773e2..9a1c0f1 100644 (file)
@@ -18,7 +18,6 @@
 #include <vnet/vnet.h>
 #include <vnet/api_errno.h>
 #include <vnet/ip/ip.h>
-#include <vnet/udp/udp.h>
 
 #include <vnet/crypto/crypto.h>
 
@@ -624,6 +623,9 @@ esp_encrypt_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
          CLIB_PREFETCH (p, CLIB_CACHE_LINE_BYTES, LOAD);
          p -= CLIB_CACHE_LINE_BYTES;
          CLIB_PREFETCH (p, CLIB_CACHE_LINE_BYTES, LOAD);
+         /* speculate that the trailer goes in the first buffer */
+         CLIB_PREFETCH (vlib_buffer_get_tail (b[1]),
+                        CLIB_CACHE_LINE_BYTES, LOAD);
        }
 
       if (is_tun)
@@ -646,6 +648,10 @@ esp_encrypt_inline (vlib_main_t * vm, vlib_node_runtime_t * node,
          current_sa_packets = current_sa_bytes = 0;
 
          sa0 = pool_elt_at_index (im->sad, sa_index0);
+
+         /* fetch the second cacheline ASAP */
+         CLIB_PREFETCH (sa0->cacheline1, CLIB_CACHE_LINE_BYTES, LOAD);
+
          current_sa_index = sa_index0;
          spi = clib_net_to_host_u32 (sa0->spi);
          esp_align = sa0->esp_block_align;