From adc74d7b3da5a48cd346ce14694415e7c5c307bb Mon Sep 17 00:00:00 2001 From: Florin Coras Date: Sun, 2 Dec 2018 13:36:00 -0800 Subject: svm: use explicit svm fifo segment main for slaves Change-Id: Id39d64bf1b49345a3dc31c63360569212aba6865 Signed-off-by: Florin Coras --- src/vcl/vcl_bapi.c | 7 ++++--- src/vcl/vcl_private.h | 2 ++ src/vcl/vppcom.c | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) (limited to 'src/vcl') diff --git a/src/vcl/vcl_bapi.c b/src/vcl/vcl_bapi.c index c6e7fdf369d..cd3aaaa3d4e 100644 --- a/src/vcl/vcl_bapi.c +++ b/src/vcl/vcl_bapi.c @@ -75,7 +75,7 @@ vcl_segment_attach (u64 segment_handle, char *name, ssvm_segment_type_t type, if (type == SSVM_SEGMENT_MEMFD) a->memfd_fd = fd; - if ((rv = svm_fifo_segment_attach (a))) + if ((rv = svm_fifo_segment_attach (&vcm->segment_main, a))) { clib_warning ("svm_fifo_segment_attach ('%s') failed", name); return rv; @@ -88,14 +88,15 @@ vcl_segment_attach (u64 segment_handle, char *name, ssvm_segment_type_t type, static void vcl_segment_detach (u64 segment_handle) { + svm_fifo_segment_main_t *sm = &vcm->segment_main; svm_fifo_segment_private_t *segment; u32 segment_index; segment_index = vcl_segment_table_lookup (segment_handle); if (segment_index == (u32) ~ 0) return; - segment = svm_fifo_segment_get_segment (segment_index); - svm_fifo_segment_delete (segment); + segment = svm_fifo_segment_get_segment (sm, segment_index); + svm_fifo_segment_delete (sm, segment); vcl_segment_table_del (segment_handle); } diff --git a/src/vcl/vcl_private.h b/src/vcl/vcl_private.h index 6ca0471e965..6a289d640e0 100644 --- a/src/vcl/vcl_private.h +++ b/src/vcl/vcl_private.h @@ -326,6 +326,8 @@ typedef struct vppcom_main_t_ /** Mapped segments table */ uword *segment_table; + svm_fifo_segment_main_t segment_main; + #ifdef VCL_ELOG /* VPP Event-logger */ elog_main_t elog_main; diff --git a/src/vcl/vppcom.c b/src/vcl/vppcom.c index 34b663b9831..db767e9e713 100644 --- a/src/vcl/vppcom.c +++ b/src/vcl/vppcom.c @@ -767,7 +767,7 @@ vppcom_app_create (char *app_name) vcm->main_pid = getpid (); vcm->app_name = format (0, "%s", app_name); vppcom_init_error_string_table (); - svm_fifo_segment_main_init (vcl_cfg->segment_baseva, + svm_fifo_segment_main_init (&vcm->segment_main, vcl_cfg->segment_baseva, 20 /* timeout in secs */ ); pool_alloc (vcm->workers, vcl_cfg->max_workers); clib_spinlock_init (&vcm->workers_lock); -- cgit 1.2.3-korg