diff options
author | Matthew Smith <mgsmith@netgate.com> | 2016-05-01 14:52:08 -0500 |
---|---|---|
committer | Matthew Smith <mgsmith@netgate.com> | 2016-05-04 11:41:52 -0500 |
commit | 29d8510d22d05ebc73d423cc1904a4fef7123889 (patch) | |
tree | 1b057d5fed90196d9f3c6aa3073f934ef6f931fc /vnet/vnet/ipsec/ipsec.h | |
parent | 0aaf92ffbb8dd19f903c0784ea4ea6584ad6d0ee (diff) |
VPP-42: VPP crashes in IPsec code when running multithreaded
Change-Id: Ib231642cfead5f5e8e45508361a11c87aad83b51
Signed-off-by: Matthew Smith <mgsmith@netgate.com>
Diffstat (limited to 'vnet/vnet/ipsec/ipsec.h')
-rw-r--r-- | vnet/vnet/ipsec/ipsec.h | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/vnet/vnet/ipsec/ipsec.h b/vnet/vnet/ipsec/ipsec.h index 386c0adecd6..8cd2b41c92f 100644 --- a/vnet/vnet/ipsec/ipsec.h +++ b/vnet/vnet/ipsec/ipsec.h @@ -175,7 +175,7 @@ typedef struct { ipsec_tunnel_if_t * tunnel_interfaces; u32 * free_tunnel_if_indices; - u32 * empty_buffers; + u32 ** empty_buffers; uword * tunnel_index_by_key; @@ -242,20 +242,22 @@ ipsec_alloc_empty_buffers(vlib_main_t * vm, ipsec_main_t *im) #else u32 free_list_index = VLIB_BUFFER_DEFAULT_FREE_LIST_INDEX; #endif - uword l = vec_len (im->empty_buffers); + u32 cpu_index = os_get_cpu_number(); + uword l = vec_len (im->empty_buffers[cpu_index]); uword n_alloc = 0; if (PREDICT_FALSE(l < VLIB_FRAME_SIZE)) { - if (!im->empty_buffers) { - vec_alloc (im->empty_buffers, 2 * VLIB_FRAME_SIZE ); + if (!im->empty_buffers[cpu_index]) { + vec_alloc (im->empty_buffers[cpu_index], 2 * VLIB_FRAME_SIZE ); } - n_alloc = vlib_buffer_alloc_from_free_list (vm, im->empty_buffers + l, + n_alloc = vlib_buffer_alloc_from_free_list (vm, + im->empty_buffers[cpu_index] + l, 2 * VLIB_FRAME_SIZE - l, free_list_index); - _vec_len (im->empty_buffers) = l + n_alloc; + _vec_len (im->empty_buffers[cpu_index]) = l + n_alloc; } } |