*/
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
* @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;
*/
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)
{
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)
{
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)
{
static inline void
svm_fifo_set_size (svm_fifo_t * f, u32 size)
{
+ if (size > (1 << f->fs_hdr->max_log2_chunk_size))
+ return;
+ fsh_virtual_mem_update (f->fs_hdr, f->slice_index, (int) f->size - size);
f->size = size;
}