summaryrefslogtreecommitdiffstats
path: root/vnet
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2016-11-11 21:35:18 +0100
committerNeale Ranns <nranns@cisco.com>2016-11-15 10:23:49 +0000
commit409ef615f8389d61df5dbfe7a052d517f194ed33 (patch)
tree775bd468c5a3c38ad2de5922cf5c23f39525710a /vnet
parent01b071222d99bea31e2846e95963c475262dd114 (diff)
buffer: clone free_list to each vlib_main on creation
Currently only packet-generator is creating free_lists during runtime. This avoids crash when buffer is freed on different worker thread. Change-Id: If2ae066a12cf7c4b3267d56d8566806f31cf7ffc Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'vnet')
-rw-r--r--vnet/vnet/pg/stream.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/vnet/vnet/pg/stream.c b/vnet/vnet/pg/stream.c
index 4dd71d91ab2..d0cbab0b68d 100644
--- a/vnet/vnet/pg/stream.c
+++ b/vnet/vnet/pg/stream.c
@@ -434,11 +434,8 @@ pg_stream_add (pg_main_t * pg, pg_stream_t * s_init)
vec_foreach (bi, s->buffer_indices)
{
- vlib_main_t *vmt;
- vmt =
- vlib_num_workers ()? vlib_get_worker_vlib_main (s->worker_index) : vm;
bi->free_list_index =
- vlib_buffer_create_free_list (vmt, s->buffer_bytes,
+ vlib_buffer_create_free_list (vm, s->buffer_bytes,
"pg stream %d buffer #%d",
s - pg->streams,
1 + (bi - s->buffer_indices));
@@ -478,9 +475,7 @@ pg_stream_del (pg_main_t * pg, uword index)
vec_foreach (bi, s->buffer_indices)
{
- vlib_buffer_delete_free_list (vlib_num_workers ()?
- vlib_get_worker_vlib_main (s->worker_index)
- : vm, bi->free_list_index);
+ vlib_buffer_delete_free_list (vm, bi->free_list_index);
clib_fifo_free (bi->buffer_fifo);
}