summaryrefslogtreecommitdiffstats
path: root/src/vnet/ipsec/esp_encrypt.c
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2018-07-11 12:47:43 +0200
committerFlorin Coras <florin.coras@gmail.com>2018-07-11 15:13:41 +0000
commit067cd6229a47ea3ba8b59a2a04090e80afb5bd2c (patch)
tree13d81219dbe0483dda02922ed5a6b6cb4c7632db /src/vnet/ipsec/esp_encrypt.c
parentb6b04f0c2a64d6edd536add6900e9d458c2fe8d1 (diff)
avoid using thread local storage for thread index
It is cheaper to get thread index from vlib_main_t if available... Change-Id: I4582e160d06d9d7fccdc54271912f0635da79b50 Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/vnet/ipsec/esp_encrypt.c')
-rw-r--r--src/vnet/ipsec/esp_encrypt.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/vnet/ipsec/esp_encrypt.c b/src/vnet/ipsec/esp_encrypt.c
index 5f633011491..4291e946b36 100644
--- a/src/vnet/ipsec/esp_encrypt.c
+++ b/src/vnet/ipsec/esp_encrypt.c
@@ -88,11 +88,11 @@ format_esp_encrypt_trace (u8 * s, va_list * args)
}
always_inline void
-esp_encrypt_cbc (ipsec_crypto_alg_t alg,
+esp_encrypt_cbc (vlib_main_t * vm, ipsec_crypto_alg_t alg,
u8 * in, u8 * out, size_t in_len, u8 * key, u8 * iv)
{
ipsec_proto_main_t *em = &ipsec_proto_main;
- u32 thread_index = vlib_get_thread_index ();
+ u32 thread_index = vm->thread_index;
#if OPENSSL_VERSION_NUMBER >= 0x10100000L
EVP_CIPHER_CTX *ctx = em->per_thread_data[thread_index].encrypt_ctx;
#else
@@ -130,7 +130,7 @@ esp_encrypt_node_fn (vlib_main_t * vm,
ipsec_main_t *im = &ipsec_main;
ipsec_proto_main_t *em = &ipsec_proto_main;
u32 *recycle = 0;
- u32 thread_index = vlib_get_thread_index ();
+ u32 thread_index = vm->thread_index;
ipsec_alloc_empty_buffers (vm, im);
@@ -361,7 +361,7 @@ esp_encrypt_node_fn (vlib_main_t * vm,
em->ipsec_proto_main_crypto_algs[sa0->
crypto_alg].iv_size);
- esp_encrypt_cbc (sa0->crypto_alg,
+ esp_encrypt_cbc (vm, sa0->crypto_alg,
(u8 *) vlib_buffer_get_current (i_b0),
(u8 *) vlib_buffer_get_current (o_b0) +
ip_udp_hdr_size + sizeof (esp_header_t) +