summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatus Fabian <matfabia@cisco.com>2016-07-04 05:36:52 -0700
committerDamjan Marion <dmarion.lists@gmail.com>2016-07-06 09:23:14 +0000
commit141977f60d85c7a9ff1c422843b0c6dbf77fa498 (patch)
treed231856e394ee5c54b29033c7104af57379d271c
parented9b757a106c2a7193a90734e43fce9feac21e30 (diff)
VPP-177: IPsec empty buffers allocation fix
Change-Id: I6d224fe19f1e0dd7ad5659e0734bc96ba37337ff Signed-off-by: Matus Fabian <matfabia@cisco.com>
-rw-r--r--vnet/vnet/ipsec/esp_decrypt.c3
-rw-r--r--vnet/vnet/ipsec/esp_encrypt.c3
2 files changed, 4 insertions, 2 deletions
diff --git a/vnet/vnet/ipsec/esp_decrypt.c b/vnet/vnet/ipsec/esp_decrypt.c
index 7af88b23dd7..8d94f20e507 100644
--- a/vnet/vnet/ipsec/esp_decrypt.c
+++ b/vnet/vnet/ipsec/esp_decrypt.c
@@ -237,10 +237,11 @@ esp_decrypt_node_fn (vlib_main_t * vm,
from = vlib_frame_vector_args (from_frame);
n_left_from = from_frame->n_vectors;
u32 cpu_index = os_get_cpu_number();
- u32 * empty_buffers = im->empty_buffers[cpu_index];
ipsec_alloc_empty_buffers(vm, im);
+ u32 * empty_buffers = im->empty_buffers[cpu_index];
+
if (PREDICT_FALSE(vec_len (empty_buffers) < n_left_from)){
vlib_node_increment_counter (vm, esp_decrypt_node.index,
ESP_DECRYPT_ERROR_NO_BUFFER, n_left_from);
diff --git a/vnet/vnet/ipsec/esp_encrypt.c b/vnet/vnet/ipsec/esp_encrypt.c
index c81a87812ea..ff0688c2d17 100644
--- a/vnet/vnet/ipsec/esp_encrypt.c
+++ b/vnet/vnet/ipsec/esp_encrypt.c
@@ -144,10 +144,11 @@ esp_encrypt_node_fn (vlib_main_t * vm,
ipsec_main_t *im = &ipsec_main;
u32 * recycle = 0;
u32 cpu_index = os_get_cpu_number();
- u32 * empty_buffers = im->empty_buffers[cpu_index];
ipsec_alloc_empty_buffers(vm, im);
+ u32 * empty_buffers = im->empty_buffers[cpu_index];
+
if (PREDICT_FALSE(vec_len (empty_buffers) < n_left_from)){
vlib_node_increment_counter (vm, esp_encrypt_node.index,
ESP_ENCRYPT_ERROR_NO_BUFFER, n_left_from);