Code Review
/
vpp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Use thread local storage for thread index
[vpp.git]
/
src
/
vnet
/
ipsec
/
esp_encrypt.c
diff --git
a/src/vnet/ipsec/esp_encrypt.c
b/src/vnet/ipsec/esp_encrypt.c
index
7b7f9b9
..
b2bc4e0
100644
(file)
--- a/
src/vnet/ipsec/esp_encrypt.c
+++ b/
src/vnet/ipsec/esp_encrypt.c
@@
-88,8
+88,8
@@
esp_encrypt_aes_cbc (ipsec_crypto_alg_t alg,
u8 * in, u8 * out, size_t in_len, u8 * key, u8 * iv)
{
esp_main_t *em = &esp_main;
u8 * in, u8 * out, size_t in_len, u8 * key, u8 * iv)
{
esp_main_t *em = &esp_main;
- u32
cpu_index = os_get_cpu_number
();
- EVP_CIPHER_CTX *ctx = &(em->per_thread_data[
cpu
_index].encrypt_ctx);
+ u32
thread_index = vlib_get_thread_index
();
+ EVP_CIPHER_CTX *ctx = &(em->per_thread_data[
thread
_index].encrypt_ctx);
const EVP_CIPHER *cipher = NULL;
int out_len;
const EVP_CIPHER *cipher = NULL;
int out_len;
@@
-98,10
+98,11
@@
esp_encrypt_aes_cbc (ipsec_crypto_alg_t alg,
if (PREDICT_FALSE (em->esp_crypto_algs[alg].type == IPSEC_CRYPTO_ALG_NONE))
return;
if (PREDICT_FALSE (em->esp_crypto_algs[alg].type == IPSEC_CRYPTO_ALG_NONE))
return;
- if (PREDICT_FALSE (alg != em->per_thread_data[cpu_index].last_encrypt_alg))
+ if (PREDICT_FALSE
+ (alg != em->per_thread_data[thread_index].last_encrypt_alg))
{
cipher = em->esp_crypto_algs[alg].type;
{
cipher = em->esp_crypto_algs[alg].type;
- em->per_thread_data[
cpu
_index].last_encrypt_alg = alg;
+ em->per_thread_data[
thread
_index].last_encrypt_alg = alg;
}
EVP_EncryptInit_ex (ctx, cipher, NULL, key, iv);
}
EVP_EncryptInit_ex (ctx, cipher, NULL, key, iv);
@@
-119,11
+120,11
@@
esp_encrypt_node_fn (vlib_main_t * vm,
n_left_from = from_frame->n_vectors;
ipsec_main_t *im = &ipsec_main;
u32 *recycle = 0;
n_left_from = from_frame->n_vectors;
ipsec_main_t *im = &ipsec_main;
u32 *recycle = 0;
- u32
cpu_index = os_get_cpu_number
();
+ u32
thread_index = vlib_get_thread_index
();
ipsec_alloc_empty_buffers (vm, im);
ipsec_alloc_empty_buffers (vm, im);
- u32 *empty_buffers = im->empty_buffers[
cpu
_index];
+ u32 *empty_buffers = im->empty_buffers[
thread
_index];
if (PREDICT_FALSE (vec_len (empty_buffers) < n_left_from))
{
if (PREDICT_FALSE (vec_len (empty_buffers) < n_left_from))
{
@@
-182,6
+183,8
@@
esp_encrypt_node_fn (vlib_main_t * vm,
goto trace;
}
goto trace;
}
+ sa0->total_data_size += i_b0->current_length;
+
/* grab free buffer */
last_empty_buffer = vec_len (empty_buffers) - 1;
o_bi0 = empty_buffers[last_empty_buffer];
/* grab free buffer */
last_empty_buffer = vec_len (empty_buffers) - 1;
o_bi0 = empty_buffers[last_empty_buffer];