diff options
author | Florin Coras <fcoras@cisco.com> | 2018-12-02 13:36:00 -0800 |
---|---|---|
committer | Dave Barach <openvpp@barachs.net> | 2018-12-03 15:49:27 +0000 |
commit | adc74d7b3da5a48cd346ce14694415e7c5c307bb (patch) | |
tree | 52168b4b95aa1c76e0814c2290beb4a4883ceced /src/svm/svm_fifo_segment.c | |
parent | b4a7a7dcf81f85ca3a22c791fb57d7eddc111661 (diff) |
svm: use explicit svm fifo segment main for slaves
Change-Id: Id39d64bf1b49345a3dc31c63360569212aba6865
Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/svm/svm_fifo_segment.c')
-rw-r--r-- | src/svm/svm_fifo_segment.c | 32 |
1 files changed, 14 insertions, 18 deletions
diff --git a/src/svm/svm_fifo_segment.c b/src/svm/svm_fifo_segment.c index 6cb402f1a6b..c72de406633 100644 --- a/src/svm/svm_fifo_segment.c +++ b/src/svm/svm_fifo_segment.c @@ -15,8 +15,6 @@ #include <svm/svm_fifo_segment.h> -svm_fifo_segment_main_t svm_fifo_segment_main; - static void allocate_new_fifo_chunk (svm_fifo_segment_header_t * fsh, u32 data_size_in_bytes, int chunk_size) @@ -203,9 +201,9 @@ svm_fifo_segment_init (svm_fifo_segment_private_t * s) * Create an svm fifo segment and initialize as master */ int -svm_fifo_segment_create (svm_fifo_segment_create_args_t * a) +svm_fifo_segment_create (svm_fifo_segment_main_t * sm, + svm_fifo_segment_create_args_t * a) { - svm_fifo_segment_main_t *sm = &svm_fifo_segment_main; svm_fifo_segment_private_t *s; int rv; @@ -237,9 +235,9 @@ svm_fifo_segment_create (svm_fifo_segment_create_args_t * a) * Create an svm fifo segment in process-private memory */ int -svm_fifo_segment_create_process_private (svm_fifo_segment_create_args_t * a) +svm_fifo_segment_create_process_private (svm_fifo_segment_main_t * sm, + svm_fifo_segment_create_args_t * a) { - svm_fifo_segment_main_t *sm = &svm_fifo_segment_main; svm_fifo_segment_private_t *s; ssvm_shared_header_t *sh; u32 rnd_size = 0; @@ -291,9 +289,9 @@ svm_fifo_segment_create_process_private (svm_fifo_segment_create_args_t * a) * Attach as slave to an svm fifo segment */ int -svm_fifo_segment_attach (svm_fifo_segment_create_args_t * a) +svm_fifo_segment_attach (svm_fifo_segment_main_t * sm, + svm_fifo_segment_create_args_t * a) { - svm_fifo_segment_main_t *sm = &svm_fifo_segment_main; svm_fifo_segment_private_t *s; int rv; @@ -324,10 +322,9 @@ svm_fifo_segment_attach (svm_fifo_segment_create_args_t * a) } void -svm_fifo_segment_delete (svm_fifo_segment_private_t * s) +svm_fifo_segment_delete (svm_fifo_segment_main_t * sm, + svm_fifo_segment_private_t * s) { - svm_fifo_segment_main_t *sm = &svm_fifo_segment_main; - ssvm_delete (&s->ssvm); clib_memset (s, 0xfe, sizeof (*s)); pool_put (sm->segments, s); @@ -495,27 +492,26 @@ svm_fifo_segment_free_fifo (svm_fifo_segment_private_t * s, svm_fifo_t * f, } void -svm_fifo_segment_main_init (u64 baseva, u32 timeout_in_seconds) +svm_fifo_segment_main_init (svm_fifo_segment_main_t * sm, u64 baseva, + u32 timeout_in_seconds) { - svm_fifo_segment_main_t *sm = &svm_fifo_segment_main; - sm->next_baseva = baseva; sm->timeout_in_seconds = timeout_in_seconds; } u32 -svm_fifo_segment_index (svm_fifo_segment_private_t * s) +svm_fifo_segment_index (svm_fifo_segment_main_t * sm, + svm_fifo_segment_private_t * s) { - return s - svm_fifo_segment_main.segments; + return s - sm->segments; } /** * Retrieve svm segments pool. Used only for debug purposes. */ svm_fifo_segment_private_t * -svm_fifo_segment_segments_pool (void) +svm_fifo_segment_segments_pool (svm_fifo_segment_main_t * sm) { - svm_fifo_segment_main_t *sm = &svm_fifo_segment_main; return sm->segments; } |