diff options
Diffstat (limited to 'src/svm')
-rw-r--r-- | src/svm/fifo_segment.c | 14 | ||||
-rw-r--r-- | src/svm/fifo_types.h | 30 | ||||
-rw-r--r-- | src/svm/svm_fifo.c | 4 |
3 files changed, 33 insertions, 15 deletions
diff --git a/src/svm/fifo_segment.c b/src/svm/fifo_segment.c index d5f62913082..86f4ff2d0d2 100644 --- a/src/svm/fifo_segment.c +++ b/src/svm/fifo_segment.c @@ -969,6 +969,7 @@ fifo_segment_free_fifo (fifo_segment_t * fs, svm_fifo_t * f) if (CLIB_DEBUG) { sf->master_session_index = ~0; + f->vpp_session_index = ~0; f->master_thread_index = ~0; } @@ -1002,12 +1003,12 @@ fifo_segment_detach_fifo (fifo_segment_t *fs, svm_fifo_t **f) pfss_fifo_del_active_list (pfss, of); /* Collect chunks that were provided in return for those detached */ - fsh_slice_collect_chunks (fs->h, fss, of->chunks_at_attach); - of->chunks_at_attach = 0; + fsh_slice_collect_chunks (fs->h, fss, svm_fifo_chunks_at_attach (of)); + svm_fifo_chunks_at_attach (of) = 0; /* Collect hdr that was provided in return for the detached */ - fss_fifo_free_list_push (fs->h, fss, of->hdr_at_attach); - of->hdr_at_attach = 0; + fss_fifo_free_list_push (fs->h, fss, svm_fifo_hdr_at_attach (of)); + svm_fifo_hdr_at_attach (of) = 0; clib_mem_bulk_free (pfss->fifos, *f); *f = 0; @@ -1034,10 +1035,11 @@ fifo_segment_attach_fifo (fifo_segment_t *fs, svm_fifo_t **f, u32 slice_index) /* Allocate shared hdr and chunks to be collected at detach in return * for those that are being attached now */ of = *f; - of->hdr_at_attach = fsh_try_alloc_fifo_hdr (fs->h, fss); + svm_fifo_hdr_at_attach (of) = fsh_try_alloc_fifo_hdr (fs->h, fss); c = fs_chunk_ptr (fs->h, nf->shr->start_chunk); - of->chunks_at_attach = pc = fsh_try_alloc_chunk (fs->h, fss, c->length); + svm_fifo_chunks_at_attach (of) = pc = + fsh_try_alloc_chunk (fs->h, fss, c->length); while ((c = fs_chunk_ptr (fs->h, c->next))) { diff --git a/src/svm/fifo_types.h b/src/svm/fifo_types.h index 742351b1764..e4b72eaf1ab 100644 --- a/src/svm/fifo_types.h +++ b/src/svm/fifo_types.h @@ -101,23 +101,39 @@ typedef struct _svm_fifo u32 ooos_newest; /**< Last segment to have been updated */ u8 flags; /**< fifo flags */ - u8 master_thread_index; /**< session layer thread index */ - u8 client_thread_index; /**< app worker index */ i8 refcnt; /**< reference count */ - u32 segment_manager; /**< session layer segment manager index */ - u32 segment_index; /**< segment index in segment manager */ + u8 client_thread_index; /**< app worker index */ + u32 app_session_index; /**< app session index */ + union + { + struct + { + u32 vpp_session_index; /**< session layer session index */ + u32 master_thread_index; /**< session layer thread index */ + }; + u64 vpp_sh; + }; + u32 segment_manager; /**< session layer segment manager index */ + u32 segment_index; /**< segment index in segment manager */ struct _svm_fifo *next; /**< prev in active chain */ struct _svm_fifo *prev; /**< prev in active chain */ - svm_fifo_chunk_t *chunks_at_attach; /**< chunks to be accounted at detach */ - svm_fifo_shared_t *hdr_at_attach; /**< hdr to be freed at detach */ - #if SVM_FIFO_TRACE svm_fifo_trace_elem_t *trace; #endif } svm_fifo_t; +/* To minimize size of svm_fifo_t reuse ooo pointers for tracking chunks and + * hdr at attach/detach. Fifo being migrated should not receive new data */ +#define svm_fifo_chunks_at_attach(f) f->ooo_deq +#define svm_fifo_hdr_at_attach(f) \ + ((union { \ + svm_fifo_shared_t *hdr; \ + svm_fifo_chunk_t *ooo_enq; \ + } *) &f->ooo_enq) \ + ->hdr + typedef struct fifo_segment_slice_ { CLIB_CACHE_LINE_ALIGN_MARK (cacheline); diff --git a/src/svm/svm_fifo.c b/src/svm/svm_fifo.c index 49b3d1728f3..6107ea1a5c8 100644 --- a/src/svm/svm_fifo.c +++ b/src/svm/svm_fifo.c @@ -1650,8 +1650,8 @@ format_svm_fifo (u8 * s, va_list * args) if (verbose > 1) s = format (s, "%Uvpp session %d thread %d app session %d thread %d\n", - format_white_space, indent, f->shr->master_session_index, - f->master_thread_index, f->shr->client_session_index, + format_white_space, indent, f->vpp_session_index, + f->master_thread_index, f->app_session_index, f->client_thread_index); if (verbose) |