aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/ipsec
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
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')
-rw-r--r--src/vnet/ipsec/esp_encrypt.c8
-rw-r--r--src/vnet/ipsec/ipsec.h2
-rw-r--r--src/vnet/ipsec/ipsec_if.c2
-rw-r--r--src/vnet/ipsec/ipsec_if_in.c2
4 files changed, 7 insertions, 7 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) +
diff --git a/src/vnet/ipsec/ipsec.h b/src/vnet/ipsec/ipsec.h
index e457e33944e..d1aedb1af9d 100644
--- a/src/vnet/ipsec/ipsec.h
+++ b/src/vnet/ipsec/ipsec.h
@@ -355,7 +355,7 @@ int ipsec_set_interface_sa (vnet_main_t * vnm, u32 hw_if_index, u32 sa_id,
always_inline void
ipsec_alloc_empty_buffers (vlib_main_t * vm, ipsec_main_t * im)
{
- u32 thread_index = vlib_get_thread_index ();
+ u32 thread_index = vm->thread_index;
uword l = vec_len (im->empty_buffers[thread_index]);
uword n_alloc = 0;
diff --git a/src/vnet/ipsec/ipsec_if.c b/src/vnet/ipsec/ipsec_if.c
index e950a5e0455..82c2394e5cc 100644
--- a/src/vnet/ipsec/ipsec_if.c
+++ b/src/vnet/ipsec/ipsec_if.c
@@ -78,7 +78,7 @@ ipsec_if_tx_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
vnet_interface_main_t *vim = &vnm->interface_main;
u32 *from, *to_next = 0, next_index;
u32 n_left_from, sw_if_index0, last_sw_if_index = ~0;
- u32 thread_index = vlib_get_thread_index ();
+ u32 thread_index = vm->thread_index;
u32 n_bytes = 0, n_packets = 0;
from = vlib_frame_vector_args (from_frame);
diff --git a/src/vnet/ipsec/ipsec_if_in.c b/src/vnet/ipsec/ipsec_if_in.c
index 655668abc1d..bc10f7f5f6c 100644
--- a/src/vnet/ipsec/ipsec_if_in.c
+++ b/src/vnet/ipsec/ipsec_if_in.c
@@ -69,7 +69,7 @@ ipsec_if_input_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node,
ipsec_proto_main_t *em = &ipsec_proto_main;
u32 *from, *to_next = 0, next_index;
u32 n_left_from, last_sw_if_index = ~0;
- u32 thread_index = vlib_get_thread_index ();
+ u32 thread_index = vm->thread_index;
u64 n_bytes = 0, n_packets = 0;
u8 icv_len;
ipsec_tunnel_if_t *last_t = NULL;