15 #ifndef __included_ssvm_fifo_h__ 16 #define __included_ssvm_fifo_h__ 39 #define OOO_SEGMENT_INVALID_INDEX ((u32)~0) 41 typedef struct _svm_fifo
47 volatile u32 has_event;
50 u32 master_session_index;
51 u32 client_session_index;
52 u8 master_thread_index;
53 u8 client_thread_index;
65 struct _svm_fifo *next;
66 struct _svm_fifo *prev;
97 return __sync_lock_test_and_set (&f->has_event, 1) == 0;
107 __sync_lock_release (&f->has_event);
114 u8 * copy_from_here);
116 u32 required_bytes,
u8 * copy_from_here);
139 if (a == f->tail && f->tail == f->head)
142 return ((f->nitems + a - f->tail) % f->nitems);
int svm_fifo_dequeue_drop(svm_fifo_t *f, u32 max_bytes)
#define CLIB_CACHE_LINE_ALIGN_MARK(mark)
format_function_t format_ooo_segment
static u8 svm_fifo_has_ooo_data(svm_fifo_t *f)
format_function_t format_svm_fifo
Fixed length block allocator.
u32 prev
Previous linked-list element pool index.
static u32 svm_fifo_max_enqueue(svm_fifo_t *f)
int svm_fifo_enqueue_nowait(svm_fifo_t *f, u32 max_bytes, u8 *copy_from_here)
svm_fifo_t * svm_fifo_create(u32 data_size_in_bytes)
create an svm fifo, in the current heap.
struct _svm_fifo svm_fifo_t
static u32 ooo_segment_end_offset(svm_fifo_t *f, ooo_segment_t *s)
static u32 svm_fifo_max_dequeue(svm_fifo_t *f)
static u32 ooo_segment_length(svm_fifo_t *f, ooo_segment_t *s)
int svm_fifo_dequeue_nowait(svm_fifo_t *f, u32 max_bytes, u8 *copy_here)
#define pool_elt_at_index(p, i)
Returns pointer to element at given index.
static u32 ooo_segment_offset(svm_fifo_t *f, ooo_segment_t *s)
static void svm_fifo_unset_event(svm_fifo_t *f)
Unsets fifo event flag.
static ooo_segment_t * svm_fifo_newest_ooo_segment(svm_fifo_t *f)
static u8 svm_fifo_set_event(svm_fifo_t *f)
Sets fifo event flag.
format_function_t format_ooo_list
static ooo_segment_t * ooo_segment_get_prev(svm_fifo_t *f, ooo_segment_t *s)
#define OOO_SEGMENT_INVALID_INDEX
void svm_fifo_init_pointers(svm_fifo_t *f, u32 pointer)
Set fifo pointers to requested offset.
void svm_fifo_free(svm_fifo_t *f)
u32 length
Length of segment.
u32 next
Next linked-list element pool index.
template key/value backing page structure
int svm_fifo_peek(svm_fifo_t *f, u32 offset, u32 max_bytes, u8 *copy_here)
u32 svm_fifo_number_ooo_segments(svm_fifo_t *f)
u32 start
Start of segment, normalized.
ooo_segment_t * svm_fifo_first_ooo_segment(svm_fifo_t *f)
static u32 ooo_segment_distance_to_tail(svm_fifo_t *f, u32 a)
int svm_fifo_enqueue_with_offset(svm_fifo_t *f, u32 offset, u32 required_bytes, u8 *copy_from_here)
CLIB vectors are ubiquitous dynamically resized arrays with by user defined "headers".