From cdfe8abc613a0aa936963d31bc60cec86a5c641d Mon Sep 17 00:00:00 2001 From: Florin Coras Date: Wed, 22 Dec 2021 12:54:17 -0800 Subject: session svm: track fs and seg manager index in fs Simplifies allocation of fifos as fifo segment and segment manager indices can be set at alloc time. Type: improvement Signed-off-by: Florin Coras Change-Id: Ibd357b3ff0279d8deefcdcb17010b4068007ccb7 --- src/svm/fifo_segment.c | 5 +++++ src/svm/fifo_segment.h | 2 ++ 2 files changed, 7 insertions(+) (limited to 'src/svm') diff --git a/src/svm/fifo_segment.c b/src/svm/fifo_segment.c index 8795b46c86a..77177a14a69 100644 --- a/src/svm/fifo_segment.c +++ b/src/svm/fifo_segment.c @@ -387,6 +387,8 @@ fifo_segment_attach (fifo_segment_main_t * sm, fifo_segment_create_args_t * a) pool_get_zero (sm->segments, fs); + fs->fs_index = fs - sm->segments; + fs->sm_index = ~0; fs->ssvm.ssvm_size = a->segment_size; fs->ssvm.my_pid = getpid (); fs->ssvm.name = format (0, "%s%c", a->segment_name, 0); @@ -868,6 +870,9 @@ fifo_segment_alloc_fifo_w_slice (fifo_segment_t * fs, u32 slice_index, svm_fifo_init (f, data_bytes); + f->segment_manager = fs->sm_index; + f->segment_index = fs->fs_index; + fss = fsh_slice_get (fsh, slice_index); pfss = fs_slice_private_get (fs, slice_index); diff --git a/src/svm/fifo_segment.h b/src/svm/fifo_segment.h index 440f1bb6a02..ec184207269 100644 --- a/src/svm/fifo_segment.h +++ b/src/svm/fifo_segment.h @@ -74,6 +74,8 @@ typedef struct fifo_slice_private_t *slices; /**< private slice information */ svm_msg_q_t *mqs; /**< private vec of attached mqs */ uword max_byte_index; /**< max byte index for segment */ + u32 sm_index; /**< owner segment manager index */ + u32 fs_index; /**< fs index in sm pool */ u8 n_slices; /**< number of fifo segment slices */ u8 flags; /**< private fifo segment flags */ u8 high_watermark; /**< memory pressure watermark high */ -- cgit 1.2.3-korg