aboutsummaryrefslogtreecommitdiffstats
path: root/src/svm/fifo_segment.h
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2020-12-10 18:52:40 -0800
committerFlorin Coras <florin.coras@gmail.com>2020-12-29 21:04:39 +0000
commit14f066e95100cfdcd5f0531e35ba84b7b859a00a (patch)
tree53118cd229784f7a38bc5a4d06f2f3591d43c996 /src/svm/fifo_segment.h
parentb462418890240b2e38dbf522f9dd0196b79e0fa8 (diff)
svm vcl: allow random offsets for fifo segments in apps
Type: improvement Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I1658a9c19d8eae4c9a42c0a111d4ad343b8eb8a4
Diffstat (limited to 'src/svm/fifo_segment.h')
-rw-r--r--src/svm/fifo_segment.h17
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