FD.io VPP  v20.01-48-g3e0dafb74
Vector Packet Processing
svm_fifo.h File Reference
+ Include dependency graph for svm_fifo.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  ooo_segment_t
 Out-of-order segment. More...
 
struct  svm_fifo_trace_elem_t
 
struct  svm_fifo_chunk_
 
struct  svm_fifo_seg_
 

Macros

#define SVM_FIFO_TRACE   (0)
 
#define OOO_SEGMENT_INVALID_INDEX   ((u32)~0)
 
#define SVM_FIFO_INVALID_SESSION_INDEX   ((u32)~0)
 
#define SVM_FIFO_INVALID_INDEX   ((u32)~0)
 
#define SVM_FIFO_MAX_EVT_SUBSCRIBERS   7
 
#define svm_fifo_trace_add(_f, _s, _l, _t)
 

Typedefs

typedef enum svm_fifo_deq_ntf_ svm_fifo_deq_ntf_t
 
typedef struct svm_fifo_chunk_ svm_fifo_chunk_t
 
typedef enum svm_fifo_flag_ svm_fifo_flag_t
 
typedef struct _svm_fifo svm_fifo_t
 
typedef struct svm_fifo_seg_ svm_fifo_seg_t
 

Enumerations

enum  svm_fifo_deq_ntf_ { SVM_FIFO_NO_DEQ_NOTIF = 0, SVM_FIFO_WANT_DEQ_NOTIF = 1, SVM_FIFO_WANT_DEQ_NOTIF_IF_FULL = 2, SVM_FIFO_WANT_DEQ_NOTIF_IF_EMPTY = 4 }
 
enum  svm_fifo_flag_ {
  SVM_FIFO_F_MULTI_CHUNK = 1 << 0, SVM_FIFO_F_GROW = 1 << 1, SVM_FIFO_F_SHRINK = 1 << 2, SVM_FIFO_F_COLLECT_CHUNKS = 1 << 3,
  SVM_FIFO_F_LL_TRACKED = 1 << 4, SVM_FIFO_F_SINGLE_THREAD_OWNED = 1 << 5
}
 
enum  svm_fifo_err_t { SVM_FIFO_EFULL = -2, SVM_FIFO_EEMPTY = -3 }
 

Functions

u8svm_fifo_dump_trace (u8 *s, svm_fifo_t *f)
 
u8svm_fifo_replay (u8 *s, svm_fifo_t *f, u8 no_read, u8 verbose)
 
static void f_load_head_tail_cons (svm_fifo_t *f, u32 *head, u32 *tail)
 Load head and tail optimized for consumer. More...
 
static void f_load_head_tail_prod (svm_fifo_t *f, u32 *head, u32 *tail)
 Load head and tail optimized for producer. More...
 
static void f_load_head_tail_all_acq (svm_fifo_t *f, u32 *head, u32 *tail)
 Load head and tail independent of producer/consumer role. More...
 
static u32 f_distance_to (svm_fifo_t *f, u32 a, u32 b)
 Distance to a from b, i.e., a - b in the fifo. More...
 
static u32 f_distance_from (svm_fifo_t *f, u32 a, u32 b)
 Distance from a to b, i.e., b - a in the fifo. More...
 
static u32 f_cursize (svm_fifo_t *f, u32 head, u32 tail)
 Fifo current size, i.e., number of bytes enqueued. More...
 
static u32 f_free_count (svm_fifo_t *f, u32 head, u32 tail)
 Fifo free bytes, i.e., number of free bytes. More...
 
void svm_fifo_try_shrink (svm_fifo_t *f, u32 head, u32 tail)
 Try to shrink fifo size. More...
 
svm_fifo_tsvm_fifo_create (u32 size)
 Create fifo of requested size. More...
 
void svm_fifo_init (svm_fifo_t *f, u32 size)
 Initialize fifo. More...
 
void svm_fifo_init_chunks (svm_fifo_t *f)
 Initialize fifo chunks and rbtree. More...
 
svm_fifo_chunk_tsvm_fifo_chunk_alloc (u32 size)
 Allocate a fifo chunk on heap. More...
 
void svm_fifo_add_chunk (svm_fifo_t *f, svm_fifo_chunk_t *c)
 Grow fifo size by adding chunk to chunk list. More...
 
int svm_fifo_reduce_size (svm_fifo_t *f, u32 len, u8 try_shrink)
 Request to reduce fifo size by amount of bytes. More...
 
svm_fifo_chunk_tsvm_fifo_collect_chunks (svm_fifo_t *f)
 Removes chunks that are after fifo end byte. More...
 
void svm_fifo_free (svm_fifo_t *f)
 Free fifo and associated state. More...
 
void svm_fifo_free_chunk_lookup (svm_fifo_t *f)
 Cleanup fifo chunk lookup rb tree. More...
 
void svm_fifo_free_ooo_data (svm_fifo_t *f)
 Cleanup fifo ooo data. More...
 
void svm_fifo_init_pointers (svm_fifo_t *f, u32 head, u32 tail)
 Init fifo head and tail. More...
 
void svm_fifo_clone (svm_fifo_t *df, svm_fifo_t *sf)
 Clone fifo. More...
 
int svm_fifo_enqueue (svm_fifo_t *f, u32 len, const u8 *src)
 Enqueue data to fifo. More...
 
int svm_fifo_enqueue_with_offset (svm_fifo_t *f, u32 offset, u32 len, u8 *src)
 Enqueue data to fifo with offset. More...
 
void svm_fifo_enqueue_nocopy (svm_fifo_t *f, u32 len)
 Advance tail pointer. More...
 
void svm_fifo_overwrite_head (svm_fifo_t *f, u8 *src, u32 len)
 Overwrite fifo head with new data. More...
 
int svm_fifo_dequeue (svm_fifo_t *f, u32 len, u8 *dst)
 Dequeue data from fifo. More...
 
int svm_fifo_peek (svm_fifo_t *f, u32 offset, u32 len, u8 *dst)
 Peek data from fifo. More...
 
int svm_fifo_dequeue_drop (svm_fifo_t *f, u32 len)
 Dequeue and drop bytes from fifo. More...
 
void svm_fifo_dequeue_drop_all (svm_fifo_t *f)
 Dequeue and drop all bytes from fifo. More...
 
int svm_fifo_segments (svm_fifo_t *f, svm_fifo_seg_t *fs)
 
void svm_fifo_segments_free (svm_fifo_t *f, svm_fifo_seg_t *fs)
 
void svm_fifo_add_subscriber (svm_fifo_t *f, u8 sub)
 Add io events subscriber to list. More...
 
void svm_fifo_del_subscriber (svm_fifo_t *f, u8 subscriber)
 Remove io events subscriber form list. More...
 
u32 svm_fifo_n_ooo_segments (svm_fifo_t *f)
 Number of out-of-order segments for fifo. More...
 
ooo_segment_tsvm_fifo_first_ooo_segment (svm_fifo_t *f)
 First out-of-order segment for fifo. More...
 
u8 svm_fifo_is_sane (svm_fifo_t *f)
 Check if fifo is sane. More...
 
u8 svm_fifo_set_single_thread_owned (svm_fifo_t *f)
 Declare this fifo is used by only a single thread. More...
 
static u32 svm_fifo_max_dequeue_cons (svm_fifo_t *f)
 Fifo max bytes to dequeue optimized for consumer. More...
 
static u32 svm_fifo_max_dequeue_prod (svm_fifo_t *f)
 Fifo max bytes to dequeue optimized for producer. More...
 
static u32 svm_fifo_max_dequeue (svm_fifo_t *f)
 Fifo max bytes to dequeue. More...
 
static int svm_fifo_is_full_prod (svm_fifo_t *f)
 Check if fifo is full optimized for producer. More...
 
static int svm_fifo_is_full (svm_fifo_t *f)
 
static int svm_fifo_is_empty_cons (svm_fifo_t *f)
 Check if fifo is empty optimized for consumer. More...
 
static int svm_fifo_is_empty_prod (svm_fifo_t *f)
 Check if fifo is empty optimized for producer. More...
 
static int svm_fifo_is_empty (svm_fifo_t *f)
 Check if fifo is empty. More...
 
static u8 svm_fifo_is_wrapped (svm_fifo_t *f)
 Check if fifo is wrapped. More...
 
static u32 svm_fifo_max_enqueue_prod (svm_fifo_t *f)
 Maximum number of bytes that can be enqueued into fifo. More...
 
static u32 svm_fifo_max_enqueue (svm_fifo_t *f)
 
static u32 svm_fifo_max_read_chunk (svm_fifo_t *f)
 Max contiguous chunk of data that can be read. More...
 
static u32 svm_fifo_max_write_chunk (svm_fifo_t *f)
 Max contiguous chunk of data that can be written. More...
 
static u8svm_fifo_head (svm_fifo_t *f)
 
static u8svm_fifo_tail (svm_fifo_t *f)
 
static u8 svm_fifo_n_subscribers (svm_fifo_t *f)
 
static u8 svm_fifo_has_ooo_data (svm_fifo_t *f)
 Check if fifo has out-of-order data. More...
 
static ooo_segment_tsvm_fifo_newest_ooo_segment (svm_fifo_t *f)
 
static void svm_fifo_newest_ooo_segment_reset (svm_fifo_t *f)
 
static u32 ooo_segment_offset_prod (svm_fifo_t *f, ooo_segment_t *s)
 
static u32 ooo_segment_length (svm_fifo_t *f, ooo_segment_t *s)
 
static int svm_fifo_has_event (svm_fifo_t *f)
 Check if fifo has io event. More...
 
static u8 svm_fifo_set_event (svm_fifo_t *f)
 Set fifo event flag. More...
 
static void svm_fifo_unset_event (svm_fifo_t *f)
 Unset fifo event flag. More...
 
static void svm_fifo_add_want_deq_ntf (svm_fifo_t *f, u8 ntf_type)
 Set specific want notification flag. More...
 
static void svm_fifo_del_want_deq_ntf (svm_fifo_t *f, u8 ntf_type)
 Clear specific want notification flag. More...
 
static void svm_fifo_clear_deq_ntf (svm_fifo_t *f)
 Clear the want notification flag and set has notification. More...
 
static void svm_fifo_reset_has_deq_ntf (svm_fifo_t *f)
 Clear has notification flag. More...
 
static u8 svm_fifo_needs_deq_ntf (svm_fifo_t *f, u32 n_last_deq)
 Check if fifo needs dequeue notification. More...
 

Variables

format_function_t format_svm_fifo
 

Macro Definition Documentation

◆ OOO_SEGMENT_INVALID_INDEX

#define OOO_SEGMENT_INVALID_INDEX   ((u32)~0)

Definition at line 38 of file svm_fifo.h.

◆ SVM_FIFO_INVALID_INDEX

#define SVM_FIFO_INVALID_INDEX   ((u32)~0)

Definition at line 40 of file svm_fifo.h.

◆ SVM_FIFO_INVALID_SESSION_INDEX

#define SVM_FIFO_INVALID_SESSION_INDEX   ((u32)~0)

Definition at line 39 of file svm_fifo.h.

◆ SVM_FIFO_MAX_EVT_SUBSCRIBERS

#define SVM_FIFO_MAX_EVT_SUBSCRIBERS   7

Definition at line 41 of file svm_fifo.h.

◆ SVM_FIFO_TRACE

#define SVM_FIFO_TRACE   (0)

Definition at line 37 of file svm_fifo.h.

◆ svm_fifo_trace_add

#define svm_fifo_trace_add (   _f,
  _s,
  _l,
  _t 
)

Definition at line 146 of file svm_fifo.h.

Typedef Documentation

◆ svm_fifo_chunk_t

◆ svm_fifo_deq_ntf_t

◆ svm_fifo_flag_t

◆ svm_fifo_seg_t

typedef struct svm_fifo_seg_ svm_fifo_seg_t

◆ svm_fifo_t

typedef struct _svm_fifo svm_fifo_t

Enumeration Type Documentation

◆ svm_fifo_deq_ntf_

Enumerator
SVM_FIFO_NO_DEQ_NOTIF 

No notification requested.

SVM_FIFO_WANT_DEQ_NOTIF 

Notify on dequeue.

SVM_FIFO_WANT_DEQ_NOTIF_IF_FULL 

Notify on transition from full.

SVM_FIFO_WANT_DEQ_NOTIF_IF_EMPTY 

Notify on transition to empty.

Definition at line 43 of file svm_fifo.h.

◆ svm_fifo_err_t

Enumerator
SVM_FIFO_EFULL 
SVM_FIFO_EEMPTY 

Definition at line 124 of file svm_fifo.h.

◆ svm_fifo_flag_

Enumerator
SVM_FIFO_F_MULTI_CHUNK 
SVM_FIFO_F_GROW 
SVM_FIFO_F_SHRINK 
SVM_FIFO_F_COLLECT_CHUNKS 
SVM_FIFO_F_LL_TRACKED 
SVM_FIFO_F_SINGLE_THREAD_OWNED 

Definition at line 66 of file svm_fifo.h.

Function Documentation

◆ f_cursize()

static u32 f_cursize ( svm_fifo_t f,
u32  head,
u32  tail 
)
inlinestatic

Fifo current size, i.e., number of bytes enqueued.

Internal function.

Definition at line 221 of file svm_fifo.h.

+ Here is the caller graph for this function:

◆ f_distance_from()

static u32 f_distance_from ( svm_fifo_t f,
u32  a,
u32  b 
)
inlinestatic

Distance from a to b, i.e., b - a in the fifo.

Internal function.

Definition at line 210 of file svm_fifo.h.

+ Here is the caller graph for this function:

◆ f_distance_to()

static u32 f_distance_to ( svm_fifo_t f,
u32  a,
u32  b 
)
inlinestatic

Distance to a from b, i.e., a - b in the fifo.

Internal function.

Definition at line 199 of file svm_fifo.h.

+ Here is the caller graph for this function:

◆ f_free_count()

static u32 f_free_count ( svm_fifo_t f,
u32  head,
u32  tail 
)
inlinestatic

Fifo free bytes, i.e., number of free bytes.

Internal function

Definition at line 232 of file svm_fifo.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ f_load_head_tail_all_acq()

static void f_load_head_tail_all_acq ( svm_fifo_t f,
u32 head,
u32 tail 
)
inlinestatic

Load head and tail independent of producer/consumer role.

Internal function.

Definition at line 185 of file svm_fifo.h.

+ Here is the caller graph for this function:

◆ f_load_head_tail_cons()

static void f_load_head_tail_cons ( svm_fifo_t f,
u32 head,
u32 tail 
)
inlinestatic

Load head and tail optimized for consumer.

Internal function.

Definition at line 158 of file svm_fifo.h.

+ Here is the caller graph for this function:

◆ f_load_head_tail_prod()

static void f_load_head_tail_prod ( svm_fifo_t f,
u32 head,
u32 tail 
)
inlinestatic

Load head and tail optimized for producer.

Internal function

Definition at line 171 of file svm_fifo.h.

+ Here is the caller graph for this function:

◆ ooo_segment_length()

static u32 ooo_segment_length ( svm_fifo_t f,
ooo_segment_t s 
)
inlinestatic

Definition at line 723 of file svm_fifo.h.

+ Here is the caller graph for this function:

◆ ooo_segment_offset_prod()

static u32 ooo_segment_offset_prod ( svm_fifo_t f,
ooo_segment_t s 
)
inlinestatic

Definition at line 713 of file svm_fifo.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ svm_fifo_add_chunk()

void svm_fifo_add_chunk ( svm_fifo_t f,
svm_fifo_chunk_t c 
)

Grow fifo size by adding chunk to chunk list.

If fifos are allocated on a segment, this should be called with the segment's heap pushed.

Parameters
ffifo to be extended
cchunk or linked list of chunks to be added

Definition at line 579 of file svm_fifo.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ svm_fifo_add_subscriber()

void svm_fifo_add_subscriber ( svm_fifo_t f,
u8  sub 
)

Add io events subscriber to list.

Parameters
ffifo
subsubscriber opaque index (typically app worker index)

Definition at line 1175 of file svm_fifo.c.

+ Here is the caller graph for this function:

◆ svm_fifo_add_want_deq_ntf()

static void svm_fifo_add_want_deq_ntf ( svm_fifo_t f,
u8  ntf_type 
)
inlinestatic

Set specific want notification flag.

For list of flags see svm_fifo_deq_ntf_t

Parameters
ffifo
ntf_typetype of notification requested

Definition at line 776 of file svm_fifo.h.

+ Here is the caller graph for this function:

◆ svm_fifo_chunk_alloc()

svm_fifo_chunk_t* svm_fifo_chunk_alloc ( u32  size)

Allocate a fifo chunk on heap.

If the chunk is allocated on a fifo segment, this should be called with the segment's heap pushed.

Parameters
sizechunk size in bytes. Will be rounded to the next highest power-of-two
Returns
new chunk or 0 if alloc failed

Allocate a fifo chunk on heap.

Definition at line 471 of file svm_fifo.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ svm_fifo_clear_deq_ntf()

static void svm_fifo_clear_deq_ntf ( svm_fifo_t f)
inlinestatic

Clear the want notification flag and set has notification.

Should be used after enqueuing an event. This clears the SVM_FIFO_WANT_NOTIF flag but it does not clear SVM_FIFO_WANT_NOTIF_IF_FULL. If the latter was set, has_ntf is set to avoid enqueueing events for for all dequeue operations until it is manually cleared.

Parameters
ffifo

Definition at line 807 of file svm_fifo.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ svm_fifo_clone()

void svm_fifo_clone ( svm_fifo_t df,
svm_fifo_t sf 
)

Clone fifo.

Clones single/default chunk fifo. It does not work for fifos with multiple chunks.

Clone fifo.

Assumptions:

  • no prod and cons are accessing either dest or src fifo
  • fifo is not multi chunk

Definition at line 1130 of file svm_fifo.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ svm_fifo_collect_chunks()

svm_fifo_chunk_t* svm_fifo_collect_chunks ( svm_fifo_t f)

Removes chunks that are after fifo end byte.

Needs to be called with segment heap pushed.

Parameters
ffifo

Definition at line 715 of file svm_fifo.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ svm_fifo_create()

svm_fifo_t* svm_fifo_create ( u32  data_size_in_bytes)

Create fifo of requested size.

Allocates fifo on current heap.

Parameters
sizedata size in bytes for fifo to be allocated. Will be rounded to the next highest power-of-two value.
Returns
pointer to new fifo

Create fifo of requested size.

Fails vs blow up the process

Definition at line 436 of file svm_fifo.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ svm_fifo_del_subscriber()

void svm_fifo_del_subscriber ( svm_fifo_t f,
u8  subscriber 
)

Remove io events subscriber form list.

Parameters
ffifo
subsubscriber index to be removed

Definition at line 1183 of file svm_fifo.c.

+ Here is the caller graph for this function:

◆ svm_fifo_del_want_deq_ntf()

static void svm_fifo_del_want_deq_ntf ( svm_fifo_t f,
u8  ntf_type 
)
inlinestatic

Clear specific want notification flag.

For list of flags see svm_fifo_ntf_t

Parameters
ffifo
ntf_typetype of notification to be cleared

Definition at line 790 of file svm_fifo.h.

+ Here is the caller graph for this function:

◆ svm_fifo_dequeue()

int svm_fifo_dequeue ( svm_fifo_t f,
u32  len,
u8 dst 
)

Dequeue data from fifo.

Data is dequeued to consumer provided buffer and head is atomically updated.

Parameters
ffifo
lenlength of data to dequeue
dstbuffer to where to dequeue the data
Returns
number of bytes dequeued or error

Definition at line 981 of file svm_fifo.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ svm_fifo_dequeue_drop()

int svm_fifo_dequeue_drop ( svm_fifo_t f,
u32  len 
)

Dequeue and drop bytes from fifo.

Advances fifo head by requested amount of bytes.

Parameters
ffifo
lennumber of bytes to drop
Returns
number of bytes dropped

Definition at line 1029 of file svm_fifo.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ svm_fifo_dequeue_drop_all()

void svm_fifo_dequeue_drop_all ( svm_fifo_t f)

Dequeue and drop all bytes from fifo.

Advances head to tail position.

Parameters
ffifo

Definition at line 1061 of file svm_fifo.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ svm_fifo_dump_trace()

u8* svm_fifo_dump_trace ( u8 s,
svm_fifo_t f 
)

Definition at line 1268 of file svm_fifo.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ svm_fifo_enqueue()

int svm_fifo_enqueue ( svm_fifo_t f,
u32  len,
const u8 src 
)

Enqueue data to fifo.

Data is enqueued and tail pointer is updated atomically. If the new data enqueued partly overlaps or "touches" an out-of-order segment, said segment is "consumed" and the number of bytes returned is appropriately updated.

Parameters
ffifo
lenlength of data to copy
srcbuffer from where to copy the data
Returns
number of contiguous bytes that can be consumed or error

Definition at line 888 of file svm_fifo.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ svm_fifo_enqueue_nocopy()

void svm_fifo_enqueue_nocopy ( svm_fifo_t f,
u32  len 
)

Advance tail pointer.

Useful for moving tail pointer after external enqueue.

Parameters
ffifo
lennumber of bytes to add to tail

Advance tail pointer.

Definition at line 964 of file svm_fifo.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ svm_fifo_enqueue_with_offset()

int svm_fifo_enqueue_with_offset ( svm_fifo_t f,
u32  offset,
u32  len,
u8 src 
)

Enqueue data to fifo with offset.

Data is enqueued without updating tail pointer. Instead, an out-of-order list of segments is generated and maintained. Fifo takes care of coalescing contiguous or overlapping segments.

Parameters
ffifo
offsetoffset at which to copy the data
lenlen of data to copy
srcbuffer from where to copy the data
Returns
0 if enqueue was successful, error otherwise

Enqueue data to fifo with offset.

Two choices: either copies the entire segment, or copies nothing Returns 0 of the entire segment was copied Returns -1 if none of the segment was copied due to lack of space

Definition at line 931 of file svm_fifo.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ svm_fifo_first_ooo_segment()

ooo_segment_t* svm_fifo_first_ooo_segment ( svm_fifo_t f)

First out-of-order segment for fifo.

Parameters
ffifo
Returns
first out-of-order segment for fifo

Definition at line 1147 of file svm_fifo.c.

+ Here is the caller graph for this function:

◆ svm_fifo_free()

void svm_fifo_free ( svm_fifo_t f)

Free fifo and associated state.

Parameters
ffifo

Definition at line 853 of file svm_fifo.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ svm_fifo_free_chunk_lookup()

void svm_fifo_free_chunk_lookup ( svm_fifo_t f)

Cleanup fifo chunk lookup rb tree.

The rb tree is allocated in segment heap so this should be called with it pushed.

Parameters
ffifo to cleanup

Definition at line 847 of file svm_fifo.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ svm_fifo_free_ooo_data()

void svm_fifo_free_ooo_data ( svm_fifo_t f)

Cleanup fifo ooo data.

The ooo data is allocated in producer process memory. The fifo segment heap should not be pushed.

Parameters
ffifo to cleanup

Definition at line 132 of file svm_fifo.c.

+ Here is the caller graph for this function:

◆ svm_fifo_has_event()

static int svm_fifo_has_event ( svm_fifo_t f)
inlinestatic

Check if fifo has io event.

Parameters
ffifo
Returns
1 if fifo has event, 0 otherwise

Definition at line 735 of file svm_fifo.h.

+ Here is the caller graph for this function:

◆ svm_fifo_has_ooo_data()

static u8 svm_fifo_has_ooo_data ( svm_fifo_t f)
inlinestatic

Check if fifo has out-of-order data.

Parameters
ffifo
Returns
1 if fifo has ooo data, 0 otherwise

Definition at line 693 of file svm_fifo.h.

+ Here is the caller graph for this function:

◆ svm_fifo_head()

static u8* svm_fifo_head ( svm_fifo_t f)
inlinestatic

Definition at line 667 of file svm_fifo.h.

+ Here is the caller graph for this function:

◆ svm_fifo_init()

void svm_fifo_init ( svm_fifo_t f,
u32  size 
)

Initialize fifo.

Parameters
ffifo
sizesize for fifo

Definition at line 392 of file svm_fifo.c.

+ Here is the caller graph for this function:

◆ svm_fifo_init_chunks()

void svm_fifo_init_chunks ( svm_fifo_t f)

Initialize fifo chunks and rbtree.

Parameters
ffifo

Definition at line 408 of file svm_fifo.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ svm_fifo_init_pointers()

void svm_fifo_init_pointers ( svm_fifo_t f,
u32  head,
u32  tail 
)

Init fifo head and tail.

Parameters
ffifo
headhead value that will be matched to a chunk
tailtail value that will be matched to a chunk

Init fifo head and tail.

Definition at line 1156 of file svm_fifo.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ svm_fifo_is_empty()

static int svm_fifo_is_empty ( svm_fifo_t f)
inlinestatic

Check if fifo is empty.

Note: use producer or consumer specific functions for perfomance. svm_fifo_is_empty_cons (svm_fifo_t * f) svm_fifo_is_empty_prod (svm_fifo_t * f)

Definition at line 591 of file svm_fifo.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ svm_fifo_is_empty_cons()

static int svm_fifo_is_empty_cons ( svm_fifo_t f)
inlinestatic

Check if fifo is empty optimized for consumer.

Parameters
ffifo
Returns
1 if fifo is empty 0 otherwise

Definition at line 566 of file svm_fifo.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ svm_fifo_is_empty_prod()

static int svm_fifo_is_empty_prod ( svm_fifo_t f)
inlinestatic

Check if fifo is empty optimized for producer.

Parameters
ffifo
Returns
1 if fifo is empty 0 otherwise

Definition at line 578 of file svm_fifo.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ svm_fifo_is_full()

static int svm_fifo_is_full ( svm_fifo_t f)
inlinestatic

Definition at line 554 of file svm_fifo.h.

+ Here is the call graph for this function:

◆ svm_fifo_is_full_prod()

static int svm_fifo_is_full_prod ( svm_fifo_t f)
inlinestatic

Check if fifo is full optimized for producer.

Parameters
ffifo
Returns
1 if fifo is full 0 otherwise

Definition at line 542 of file svm_fifo.h.

+ Here is the call graph for this function:

◆ svm_fifo_is_sane()

u8 svm_fifo_is_sane ( svm_fifo_t f)

Check if fifo is sane.

Debug only.

Parameters
ffifo
Returns
1 if sane, 0 otherwise

Definition at line 1198 of file svm_fifo.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ svm_fifo_is_wrapped()

static u8 svm_fifo_is_wrapped ( svm_fifo_t f)
inlinestatic

Check if fifo is wrapped.

Parameters
ffifo
Returns
1 if 'normalized' head is ahead of tail

Definition at line 603 of file svm_fifo.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ svm_fifo_max_dequeue()

static u32 svm_fifo_max_dequeue ( svm_fifo_t f)
inlinestatic

Fifo max bytes to dequeue.

Note: use producer or consumer specific functions for performance: svm_fifo_max_dequeue_cons (svm_fifo_t *f) svm_fifo_max_dequeue_prod (svm_fifo_t *f)

Definition at line 528 of file svm_fifo.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ svm_fifo_max_dequeue_cons()

static u32 svm_fifo_max_dequeue_cons ( svm_fifo_t f)
inlinestatic

Fifo max bytes to dequeue optimized for consumer.

Parameters
ffifo
Returns
max number of bytes that can be dequeued

Definition at line 499 of file svm_fifo.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ svm_fifo_max_dequeue_prod()

static u32 svm_fifo_max_dequeue_prod ( svm_fifo_t f)
inlinestatic

Fifo max bytes to dequeue optimized for producer.

Parameters
ffifo
Returns
max number of bytes that can be dequeued

Definition at line 513 of file svm_fifo.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ svm_fifo_max_enqueue()

static u32 svm_fifo_max_enqueue ( svm_fifo_t f)
inlinestatic

Definition at line 635 of file svm_fifo.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ svm_fifo_max_enqueue_prod()

static u32 svm_fifo_max_enqueue_prod ( svm_fifo_t f)
inlinestatic

Maximum number of bytes that can be enqueued into fifo.

Optimized for producer

Parameters
ffifo
Returns
max number of bytes that can be enqueued into fifo

Definition at line 619 of file svm_fifo.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ svm_fifo_max_read_chunk()

static u32 svm_fifo_max_read_chunk ( svm_fifo_t f)
inlinestatic

Max contiguous chunk of data that can be read.

Definition at line 648 of file svm_fifo.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ svm_fifo_max_write_chunk()

static u32 svm_fifo_max_write_chunk ( svm_fifo_t f)
inlinestatic

Max contiguous chunk of data that can be written.

Definition at line 659 of file svm_fifo.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ svm_fifo_n_ooo_segments()

u32 svm_fifo_n_ooo_segments ( svm_fifo_t f)

Number of out-of-order segments for fifo.

Parameters
ffifo
Returns
number of out of order segments

Definition at line 1141 of file svm_fifo.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ svm_fifo_n_subscribers()

static u8 svm_fifo_n_subscribers ( svm_fifo_t f)
inlinestatic

Definition at line 681 of file svm_fifo.h.

+ Here is the caller graph for this function:

◆ svm_fifo_needs_deq_ntf()

static u8 svm_fifo_needs_deq_ntf ( svm_fifo_t f,
u32  n_last_deq 
)
inlinestatic

Check if fifo needs dequeue notification.

Determines based on notification request flags and state of the fifo if an event should be generated.

Parameters
ffifo
n_last_deqnumber of bytes last dequeued
Returns
1 if event should be generated, 0 otherwise

Definition at line 840 of file svm_fifo.h.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ svm_fifo_newest_ooo_segment()

static ooo_segment_t* svm_fifo_newest_ooo_segment ( svm_fifo_t f)
inlinestatic

Definition at line 699 of file svm_fifo.h.

+ Here is the caller graph for this function:

◆ svm_fifo_newest_ooo_segment_reset()

static void svm_fifo_newest_ooo_segment_reset ( svm_fifo_t f)
inlinestatic

Definition at line 707 of file svm_fifo.h.

+ Here is the caller graph for this function:

◆ svm_fifo_overwrite_head()

void svm_fifo_overwrite_head ( svm_fifo_t f,
u8 src,
u32  len 
)

Overwrite fifo head with new data.

This should be typically used by dgram transport protocols that need to update the dgram header after dequeueing a chunk of data. It assumes that the dgram header is at most spread over two chunks.

Parameters
ffifo
srcsrc of new data
lenlength of new data

Definition at line 866 of file svm_fifo.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ svm_fifo_peek()

int svm_fifo_peek ( svm_fifo_t f,
u32  offset,
u32  len,
u8 dst 
)

Peek data from fifo.

Data is copied from requested offset into provided dst buffer. Head is not updated.

Parameters
ffifo
offsetoffset from which to copy the data
lenlength of data to copy
dstbuffer to where to dequeue the data
Returns
number of bytes peeked

Definition at line 1007 of file svm_fifo.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ svm_fifo_reduce_size()

int svm_fifo_reduce_size ( svm_fifo_t f,
u32  len,
u8  try_shrink 
)

Request to reduce fifo size by amount of bytes.

Because the producer might be enqueuing data when this is called, the actual size update is only applied when producer tries to enqueue new data, unless

Parameters
try_shrinkis set.
ffifo
lennumber of bytes to remove from fifo. The actual number of bytes to be removed will be less or equal to this value.
try_shrinkflg to indicate if it's safe to try to shrink fifo size. It should be set only if this is called by the producer of if the producer is not using the fifo
Returns
actual length fifo size will be reduced by

Definition at line 807 of file svm_fifo.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ svm_fifo_replay()

u8* svm_fifo_replay ( u8 s,
svm_fifo_t f,
u8  no_read,
u8  verbose 
)

Definition at line 1292 of file svm_fifo.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ svm_fifo_reset_has_deq_ntf()

static void svm_fifo_reset_has_deq_ntf ( svm_fifo_t f)
inlinestatic

Clear has notification flag.

The fifo generates only one event per SVM_FIFO_WANT_NOTIF_IF_FULL request and sets has_ntf. To received new events the flag must be cleared using this function.

Parameters
ffifo

Definition at line 824 of file svm_fifo.h.

+ Here is the caller graph for this function:

◆ svm_fifo_segments()

int svm_fifo_segments ( svm_fifo_t f,
svm_fifo_seg_t fs 
)

Definition at line 1077 of file svm_fifo.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ svm_fifo_segments_free()

void svm_fifo_segments_free ( svm_fifo_t f,
svm_fifo_seg_t fs 
)

Definition at line 1109 of file svm_fifo.c.

+ Here is the caller graph for this function:

◆ svm_fifo_set_event()

static u8 svm_fifo_set_event ( svm_fifo_t f)
inlinestatic

Set fifo event flag.

Forces release semantics.

Parameters
ffifo
Returns
1 if flag was not set, 0 otherwise

Definition at line 749 of file svm_fifo.h.

+ Here is the caller graph for this function:

◆ svm_fifo_set_single_thread_owned()

u8 svm_fifo_set_single_thread_owned ( svm_fifo_t f)

Declare this fifo is used by only a single thread.

In this special case, fifo-growth can be done in an efficient way without delay.

Parameters
ffifo
Returns
1 if the fifo is already owned by another thread, 0 otherwise

Definition at line 1237 of file svm_fifo.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ svm_fifo_tail()

static u8* svm_fifo_tail ( svm_fifo_t f)
inlinestatic

Definition at line 674 of file svm_fifo.h.

+ Here is the caller graph for this function:

◆ svm_fifo_try_shrink()

void svm_fifo_try_shrink ( svm_fifo_t f,
u32  head,
u32  tail 
)

Try to shrink fifo size.

Internal function.

Definition at line 734 of file svm_fifo.c.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ svm_fifo_unset_event()

static void svm_fifo_unset_event ( svm_fifo_t f)
inlinestatic

Unset fifo event flag.

Forces acquire semantics

Parameters
ffifo

Definition at line 762 of file svm_fifo.h.

+ Here is the caller graph for this function:

Variable Documentation

◆ format_svm_fifo

format_function_t format_svm_fifo

Definition at line 490 of file svm_fifo.h.