summaryrefslogtreecommitdiffstats
path: root/src/svm/fifo_segment.h
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2020-12-11 13:58:12 -0800
committerFlorin Coras <fcoras@cisco.com>2020-12-29 12:11:07 -0800
commitb462418890240b2e38dbf522f9dd0196b79e0fa8 (patch)
tree3ae26a22edb23da8d40f2c2b54eb96b056bca565 /src/svm/fifo_segment.h
parent04943b4c42db300d0d895644f32da79a6d411c51 (diff)
svm: allow mq attachments at random offsets
Type: feature Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: Ic373cd2c11272da539eb4b0db27227f36f2f9688
Diffstat (limited to 'src/svm/fifo_segment.h')
-rw-r--r--src/svm/fifo_segment.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/svm/fifo_segment.h b/src/svm/fifo_segment.h
index 006ffc40f63..195869a25dd 100644
--- a/src/svm/fifo_segment.h
+++ b/src/svm/fifo_segment.h
@@ -17,6 +17,7 @@
#include <svm/ssvm.h>
#include <svm/fifo_types.h>
+#include <svm/message_queue.h>
#include <svm/svm_fifo.h>
typedef enum
@@ -70,6 +71,7 @@ typedef struct
uword max_byte_index;
u8 n_slices; /**< number of fifo segment slices */
fifo_slice_private_t *slices; /**< private slice information */
+ svm_msg_q_t *mqs; /**< private vec of attached mqs */
} fifo_segment_t;
typedef struct
@@ -130,6 +132,37 @@ void fifo_segment_attach_fifo (fifo_segment_t * fs, svm_fifo_t * f,
u32 slice_index);
/**
+ * Allocate message queue on segment
+ *
+ * @param fs fifo segment for mq
+ * @param mq_index index in private mqs vector to use to attach
+ * @param cfg configuration for mq
+ * @return attached message queue
+ */
+svm_msg_q_t *fifo_segment_msg_q_alloc (fifo_segment_t *fs, u32 mq_index,
+ svm_msg_q_cfg_t *cfg);
+
+/**
+ * Attach message queue at fifo segment offset
+ *
+ * @param fs fifo segment for mq
+ * @param offset offset for shared mq on the segment
+ * @param mq_index index in private mqs vector to use to attach
+ * @return attached message queue
+ */
+svm_msg_q_t *fifo_segment_msg_q_attach (fifo_segment_t *fs, uword offset,
+ u32 mq_index);
+
+/**
+ * Message queue offset on segment
+ *
+ * @param fs fifo segment for mq
+ * @param mq_index index of mq in private mqs vector
+ * @return offset of the shared mq the private mq is attached to
+ */
+uword fifo_segment_msg_q_offset (fifo_segment_t *fs, u32 mq_index);
+
+/**
* Try to preallocate fifo headers
*
* Tries to preallocate fifo headers and adds them to freelist.