summaryrefslogtreecommitdiffstats
path: root/src/svm/svm_fifo.h
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2020-02-05 21:13:18 +0000
committerDave Barach <openvpp@barachs.net>2020-02-26 00:51:15 +0000
commit9e61d9a1aafbaecbc7b316fd94122b80c3f99905 (patch)
tree93b153faa3494a283b0d50314143bf3fec9630de /src/svm/svm_fifo.h
parentf7ab7b2d9bc0f42c1e766d22d49dd0dc4f28abb6 (diff)
svm: remove chunk add function
Type: refactor Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I606eabbe0f3f387529e77d2483f5d63db7bde88a
Diffstat (limited to 'src/svm/svm_fifo.h')
-rw-r--r--src/svm/svm_fifo.h51
1 files changed, 45 insertions, 6 deletions
diff --git a/src/svm/svm_fifo.h b/src/svm/svm_fifo.h
index 8d5e4803360..ea10a7c6580 100644
--- a/src/svm/svm_fifo.h
+++ b/src/svm/svm_fifo.h
@@ -200,16 +200,19 @@ void svm_fifo_init (svm_fifo_t * f, u32 size);
*/
svm_fifo_chunk_t *svm_fifo_chunk_alloc (u32 size);
/**
- * Grow fifo size by adding chunk to chunk list
+ * Ensure the whole fifo size is writeable
*
- * If fifos are allocated on a segment, this should be called with
- * the segment's heap pushed.
+ * Allocates enough chunks to cover the whole fifo size.
*
- * @param f fifo to be extended
- * @param c chunk or linked list of chunks to be added
+ * @param f fifo
*/
-void svm_fifo_add_chunk (svm_fifo_t * f, svm_fifo_chunk_t * c);
int svm_fifo_fill_chunk_list (svm_fifo_t * f);
+/**
+ * Initialize rbtrees used for ooo lookups
+ *
+ * @param f fifo
+ * @param ooo_type type of ooo operation (0 enqueue, 1 dequeue)
+ */
void svm_fifo_init_ooo_lookup (svm_fifo_t * f, u8 ooo_type);
/**
* Free fifo and associated state
@@ -380,6 +383,12 @@ ooo_segment_t *svm_fifo_first_ooo_segment (svm_fifo_t * f);
* @return 1 if sane, 0 otherwise
*/
u8 svm_fifo_is_sane (svm_fifo_t * f);
+/**
+ * Number of chunks linked into the fifo
+ *
+ * @param f fifo
+ * @return number of chunks in fifo linked list
+ */
u32 svm_fifo_n_chunks (svm_fifo_t * f);
format_function_t format_svm_fifo;
@@ -545,12 +554,24 @@ u32 svm_fifo_max_read_chunk (svm_fifo_t * f);
*/
u32 svm_fifo_max_write_chunk (svm_fifo_t * f);
+/**
+ * Fifo head chunk getter
+ *
+ * @param f fifo
+ * @return head chunk pointer
+ */
static inline svm_fifo_chunk_t *
svm_fifo_head_chunk (svm_fifo_t * f)
{
return f->head_chunk;
}
+/**
+ * Fifo head pointer getter
+ *
+ * @param f fifo
+ * @return head pointer
+ */
static inline u8 *
svm_fifo_head (svm_fifo_t * f)
{
@@ -560,12 +581,24 @@ svm_fifo_head (svm_fifo_t * f)
return (f->head_chunk->data + (f->head - f->head_chunk->start_byte));
}
+/**
+ * Fifo tail chunk getter
+ *
+ * @param f fifo
+ * @return tail chunk pointer
+ */
static inline svm_fifo_chunk_t *
svm_fifo_tail_chunk (svm_fifo_t * f)
{
return f->tail_chunk;
}
+/**
+ * Fifo tail pointer getter
+ *
+ * @param f fifo
+ * @return tail pointer
+ */
static inline u8 *
svm_fifo_tail (svm_fifo_t * f)
{
@@ -573,6 +606,12 @@ svm_fifo_tail (svm_fifo_t * f)
return (f->tail_chunk->data + (f->tail - f->tail_chunk->start_byte));
}
+/**
+ * Fifo number of subscribers getter
+ *
+ * @param f fifo
+ * @return number of subscribers
+ */
static inline u8
svm_fifo_n_subscribers (svm_fifo_t * f)
{