diff options
Diffstat (limited to 'src/svm/fifo_segment.h')
-rw-r--r-- | src/svm/fifo_segment.h | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/svm/fifo_segment.h b/src/svm/fifo_segment.h index 195869a25dd..8266690d4ed 100644 --- a/src/svm/fifo_segment.h +++ b/src/svm/fifo_segment.h @@ -104,6 +104,18 @@ fifo_segment_t *fifo_segment_get_segment (fifo_segment_main_t * sm, u32 fifo_segment_index (fifo_segment_main_t * sm, fifo_segment_t * fs); void fifo_segment_info (fifo_segment_t * seg, char **address, size_t * size); +always_inline void * +fifo_segment_ptr (fifo_segment_t *fs, uword offset) +{ + return (void *) ((u8 *) fs->h + offset); +} + +always_inline uword +fifo_segment_offset (fifo_segment_t *fs, void *p) +{ + return (uword) ((u8 *) p - (u8 *) fs->h); +} + /** * Allocate fifo in fifo segment * @@ -116,8 +128,8 @@ svm_fifo_t *fifo_segment_alloc_fifo_w_slice (fifo_segment_t * fs, u32 slice_index, u32 data_bytes, fifo_segment_ftype_t ftype); -svm_fifo_t *fifo_segment_alloc_fifo_w_shared (fifo_segment_t *fs, - svm_fifo_shared_t *sf); +svm_fifo_t *fifo_segment_alloc_fifo_w_offset (fifo_segment_t *fs, + uword offset); /** * Free fifo allocated in fifo segment @@ -130,6 +142,7 @@ void fifo_segment_free_fifo (fifo_segment_t * fs, svm_fifo_t * f); void fifo_segment_detach_fifo (fifo_segment_t * fs, svm_fifo_t * f); void fifo_segment_attach_fifo (fifo_segment_t * fs, svm_fifo_t * f, u32 slice_index); +uword fifo_segment_fifo_offset (svm_fifo_t *f); /** * Allocate message queue on segment |