FD.io VPP  v21.06-1-gbb7418cf9
Vector Packet Processing
svm_fifo.c File Reference
+ Include dependency graph for svm_fifo.c:

Go to the source code of this file.

Macros

#define F_INVALID_CPTR   (fs_sptr_t) ~0ULL
 

Functions

 CLIB_MARCH_FN (svm_fifo_copy_to_chunk, void, svm_fifo_t *f, svm_fifo_chunk_t *c, u32 tail_idx, const u8 *src, u32 len, fs_sptr_t *last)
 
 CLIB_MARCH_FN (svm_fifo_copy_from_chunk, void, svm_fifo_t *f, svm_fifo_chunk_t *c, u32 head_idx, u8 *dst, u32 len, fs_sptr_t *last)
 
static void svm_fifo_copy_to_chunk (svm_fifo_t *f, svm_fifo_chunk_t *c, u32 tail_idx, const u8 *src, u32 len, fs_sptr_t *last)
 
static void svm_fifo_copy_from_chunk (svm_fifo_t *f, svm_fifo_chunk_t *c, u32 head_idx, u8 *dst, u32 len, fs_sptr_t *last)
 
static u32 ooo_segment_end_pos (ooo_segment_t *s)
 
void svm_fifo_free_ooo_data (svm_fifo_t *f)
 Cleanup fifo ooo data. More...
 
static ooo_segment_tooo_segment_prev (svm_fifo_t *f, ooo_segment_t *s)
 
static ooo_segment_tooo_segment_next (svm_fifo_t *f, ooo_segment_t *s)
 
static ooo_segment_tooo_segment_alloc (svm_fifo_t *f, u32 start, u32 length)
 
static void ooo_segment_free (svm_fifo_t *f, u32 index)
 
static void ooo_segment_add (svm_fifo_t *f, u32 offset, u32 head, u32 tail, u32 length)
 Add segment to fifo's out-of-order segment list. More...
 
static int ooo_segment_try_collect (svm_fifo_t *f, u32 n_bytes_enqueued, u32 *tail)
 Removes segments that can now be enqueued because the fifo's tail has advanced. More...
 
static __clib_unused ooo_segment_tooo_segment_last (svm_fifo_t *f)
 
void svm_fifo_init (svm_fifo_t *f, u32 size)
 Initialize fifo. More...
 
void svm_fifo_init_ooo_lookup (svm_fifo_t *f, u8 ooo_type)
 Initialize rbtrees used for ooo lookups. More...
 
svm_fifo_tsvm_fifo_alloc (u32 data_size_in_bytes)
 Creates a fifo in the current heap. More...
 
svm_fifo_chunk_tsvm_fifo_chunk_alloc (u32 size)
 Creates a fifo chunk in the current heap. More...
 
static svm_fifo_chunk_tsvm_fifo_find_chunk (svm_fifo_t *f, u32 pos)
 Find chunk for given byte position. More...
 
static svm_fifo_chunk_tsvm_fifo_find_next_chunk (svm_fifo_t *f, svm_fifo_chunk_t *start, u32 pos)
 
u32 svm_fifo_max_read_chunk (svm_fifo_t *f)
 Max contiguous chunk of data that can be read. More...
 
u32 svm_fifo_max_write_chunk (svm_fifo_t *f)
 Max contiguous chunk of data that can be written. More...
 
static rb_node_tf_find_node_rbtree (rb_tree_t *rt, u32 pos)
 
static svm_fifo_chunk_tf_find_chunk_rbtree (rb_tree_t *rt, u32 pos)
 
static void f_update_ooo_enq (svm_fifo_t *f, u32 start_pos, u32 end_pos)
 
static void f_update_ooo_deq (svm_fifo_t *f, u32 start_pos, u32 end_pos)
 
static svm_fifo_chunk_tf_lookup_clear_enq_chunks (svm_fifo_t *f, svm_fifo_chunk_t *start, u32 end_pos)
 
static svm_fifo_chunk_tf_lookup_clear_deq_chunks (svm_fifo_t *f, svm_fifo_chunk_t *start, u32 end_pos)
 
void svm_fifo_free_chunk_lookup (svm_fifo_t *f)
 Cleanup fifo chunk lookup rb tree. More...
 
void svm_fifo_free (svm_fifo_t *f)
 Free fifo and associated state. More...
 
void svm_fifo_overwrite_head (svm_fifo_t *f, u8 *src, u32 len)
 Overwrite fifo head with new data. More...
 
static int f_try_chunk_alloc (svm_fifo_t *f, u32 head, u32 tail, u32 len)
 
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 a future segment. More...
 
void svm_fifo_enqueue_nocopy (svm_fifo_t *f, u32 len)
 Advance tail. More...
 
int svm_fifo_enqueue_segments (svm_fifo_t *f, const svm_fifo_seg_t segs[], u32 n_segs, u8 allow_partial)
 Enqueue array of svm_fifo_seg_t in order. More...
 
static svm_fifo_chunk_tf_unlink_chunks (svm_fifo_t *f, u32 end_pos, u8 maybe_ooo)
 
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)
 Drop all data from fifo. More...
 
int svm_fifo_fill_chunk_list (svm_fifo_t *f)
 Ensure the whole fifo size is writeable. More...
 
int svm_fifo_provision_chunks (svm_fifo_t *f, svm_fifo_seg_t *fs, u32 n_segs, u32 len)
 Provision and return chunks for number of bytes requested. More...
 
int svm_fifo_segments (svm_fifo_t *f, u32 offset, svm_fifo_seg_t *fs, u32 n_segs, u32 max_bytes)
 Get pointers to fifo chunks data in svm_fifo_seg_t array. More...
 
void svm_fifo_clone (svm_fifo_t *df, svm_fifo_t *sf)
 Clones fifo. 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...
 
void svm_fifo_init_pointers (svm_fifo_t *f, u32 head, u32 tail)
 Set fifo pointers to requested offset. More...
 
void svm_fifo_add_subscriber (svm_fifo_t *f, u8 subscriber)
 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...
 
u8 svm_fifo_is_sane (svm_fifo_t *f)
 Check if fifo is sane. More...
 
u32 svm_fifo_n_chunks (svm_fifo_t *f)
 Number of chunks linked into the fifo. More...
 
u8format_ooo_segment (u8 *s, va_list *args)
 
u8svm_fifo_dump_trace (u8 *s, svm_fifo_t *f)
 
u8svm_fifo_replay (u8 *s, svm_fifo_t *f, u8 no_read, u8 verbose)
 
u8format_ooo_list (u8 *s, va_list *args)
 
u8format_svm_fifo (u8 *s, va_list *args)
 

Macro Definition Documentation

◆ F_INVALID_CPTR

#define F_INVALID_CPTR   (fs_sptr_t) ~0ULL

Definition at line 24 of file svm_fifo.c.

Function Documentation

◆ CLIB_MARCH_FN() [1/2]

CLIB_MARCH_FN ( svm_fifo_copy_to_chunk  ,
void  ,
svm_fifo_t f,
svm_fifo_chunk_t c,
u32  tail_idx,
const u8 src,
u32  len,
fs_sptr_t last 
)

Definition at line 26 of file svm_fifo.c.

+ Here is the call graph for this function:

◆ CLIB_MARCH_FN() [2/2]

CLIB_MARCH_FN ( svm_fifo_copy_from_chunk  ,
void  ,
svm_fifo_t f,
svm_fifo_chunk_t c,
u32  head_idx,
u8 dst,
u32  len,
fs_sptr_t last 
)

Definition at line 57 of file svm_fifo.c.

+ Here is the call graph for this function:

◆ f_find_chunk_rbtree()

static svm_fifo_chunk_t* f_find_chunk_rbtree ( rb_tree_t rt,
u32  pos 
)
static

Definition at line 586 of file svm_fifo.c.

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

◆ f_find_node_rbtree()

static rb_node_t* f_find_node_rbtree ( rb_tree_t rt,
u32  pos 
)
static

Definition at line 548 of file svm_fifo.c.

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

◆ f_lookup_clear_deq_chunks()

static svm_fifo_chunk_t* f_lookup_clear_deq_chunks ( svm_fifo_t f,
svm_fifo_chunk_t start,
u32  end_pos 
)
static

Definition at line 737 of file svm_fifo.c.

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

◆ f_lookup_clear_enq_chunks()

static svm_fifo_chunk_t* f_lookup_clear_enq_chunks ( svm_fifo_t f,
svm_fifo_chunk_t start,
u32  end_pos 
)
static

Definition at line 703 of file svm_fifo.c.

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

◆ f_try_chunk_alloc()

static int f_try_chunk_alloc ( svm_fifo_t f,
u32  head,
u32  tail,
u32  len 
)
static

Definition at line 809 of file svm_fifo.c.

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

◆ f_unlink_chunks()

static svm_fifo_chunk_t* f_unlink_chunks ( svm_fifo_t f,
u32  end_pos,
u8  maybe_ooo 
)
inlinestatic

Definition at line 1054 of file svm_fifo.c.

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

◆ f_update_ooo_deq()

static void f_update_ooo_deq ( svm_fifo_t f,
u32  start_pos,
u32  end_pos 
)
static

Definition at line 654 of file svm_fifo.c.

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

◆ f_update_ooo_enq()

static void f_update_ooo_enq ( svm_fifo_t f,
u32  start_pos,
u32  end_pos 
)
static

Definition at line 605 of file svm_fifo.c.

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

◆ format_ooo_list()

u8* format_ooo_list ( u8 s,
va_list *  args 
)

Definition at line 1614 of file svm_fifo.c.

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

◆ format_ooo_segment()

u8* format_ooo_segment ( u8 s,
va_list *  args 
)

Definition at line 1521 of file svm_fifo.c.

+ Here is the caller graph for this function:

◆ format_svm_fifo()

u8* format_svm_fifo ( u8 s,
va_list *  args 
)

Definition at line 1633 of file svm_fifo.c.

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

◆ ooo_segment_add()

static void ooo_segment_add ( svm_fifo_t f,
u32  offset,
u32  head,
u32  tail,
u32  length 
)
static

Add segment to fifo's out-of-order segment list.

Takes care of merging adjacent segments and removing overlapping ones.

Definition at line 180 of file svm_fifo.c.

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

◆ ooo_segment_alloc()

static ooo_segment_t* ooo_segment_alloc ( svm_fifo_t f,
u32  start,
u32  length 
)
inlinestatic

Definition at line 137 of file svm_fifo.c.

+ Here is the caller graph for this function:

◆ ooo_segment_end_pos()

static u32 ooo_segment_end_pos ( ooo_segment_t s)
inlinestatic

Definition at line 109 of file svm_fifo.c.

+ Here is the caller graph for this function:

◆ ooo_segment_free()

static void ooo_segment_free ( svm_fifo_t f,
u32  index 
)
inlinestatic

Definition at line 151 of file svm_fifo.c.

+ Here is the caller graph for this function:

◆ ooo_segment_last()

static __clib_unused ooo_segment_t* ooo_segment_last ( svm_fifo_t f)
static

Definition at line 358 of file svm_fifo.c.

+ Here is the call graph for this function:

◆ ooo_segment_next()

static ooo_segment_t* ooo_segment_next ( svm_fifo_t f,
ooo_segment_t s 
)
inlinestatic

Definition at line 129 of file svm_fifo.c.

+ Here is the caller graph for this function:

◆ ooo_segment_prev()

static ooo_segment_t* ooo_segment_prev ( svm_fifo_t f,
ooo_segment_t s 
)
inlinestatic

Definition at line 121 of file svm_fifo.c.

+ Here is the caller graph for this function:

◆ ooo_segment_try_collect()

static int ooo_segment_try_collect ( svm_fifo_t f,
u32  n_bytes_enqueued,
u32 tail 
)
static

Removes segments that can now be enqueued because the fifo's tail has advanced.

Returns the number of bytes added to tail.

Definition at line 310 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 1387 of file svm_fifo.c.

+ Here is the caller graph for this function:

◆ svm_fifo_alloc()

svm_fifo_t* svm_fifo_alloc ( u32  data_size_in_bytes)

Creates a fifo in the current heap.

Create fifo of requested size.

Fails vs blow up the process

Definition at line 426 of file svm_fifo.c.

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

◆ svm_fifo_chunk_alloc()

svm_fifo_chunk_t* svm_fifo_chunk_alloc ( u32  size)

Creates a fifo chunk in the current heap.

Allocate a fifo chunk on heap.

Definition at line 462 of file svm_fifo.c.

+ 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 
)

Clones fifo.

Clone fifo.

Assumptions:

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

Definition at line 1338 of file svm_fifo.c.

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

◆ svm_fifo_copy_from_chunk()

static void svm_fifo_copy_from_chunk ( svm_fifo_t f,
svm_fifo_chunk_t c,
u32  head_idx,
u8 dst,
u32  len,
fs_sptr_t last 
)
inlinestatic

Definition at line 101 of file svm_fifo.c.

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

◆ svm_fifo_copy_to_chunk()

static void svm_fifo_copy_to_chunk ( svm_fifo_t f,
svm_fifo_chunk_t c,
u32  tail_idx,
const u8 src,
u32  len,
fs_sptr_t last 
)
inlinestatic

Definition at line 93 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 1395 of file svm_fifo.c.

+ 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. This should not be used in combination with ooo lookups. If ooo peeking of data is needed in combination with dequeuing use svm_fifo_dequeue_drop.

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

Definition at line 1105 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 1168 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)

Drop all data from fifo.

Dequeue and drop all bytes from fifo.

Definition at line 1207 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 1531 of file svm_fifo.c.

+ 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 847 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.

Advance tail pointer.

Definition at line 946 of file svm_fifo.c.

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

◆ svm_fifo_enqueue_segments()

int svm_fifo_enqueue_segments ( svm_fifo_t f,
const svm_fifo_seg_t  segs[],
u32  n_segs,
u8  allow_partial 
)

Enqueue array of svm_fifo_seg_t in order.

Parameters
ffifo
segsarray of segments to enqueue
n_segsnumber of segments
allow_partialif set partial enqueues are allowed
Returns
len if enqueue was successful, error otherwise

Definition at line 972 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 a future segment.

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 906 of file svm_fifo.c.

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

◆ svm_fifo_fill_chunk_list()

int svm_fifo_fill_chunk_list ( svm_fifo_t f)

Ensure the whole fifo size is writeable.

Allocates enough chunks to cover the whole fifo size.

Parameters
ffifo

Definition at line 1228 of file svm_fifo.c.

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

◆ svm_fifo_find_chunk()

static svm_fifo_chunk_t* svm_fifo_find_chunk ( svm_fifo_t f,
u32  pos 
)
static

Find chunk for given byte position.

Parameters
ffifo
posnormalized position in fifo
Returns
chunk that includes given position or 0

Definition at line 488 of file svm_fifo.c.

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

◆ svm_fifo_find_next_chunk()

static svm_fifo_chunk_t* svm_fifo_find_next_chunk ( svm_fifo_t f,
svm_fifo_chunk_t start,
u32  pos 
)
static

Definition at line 500 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 1360 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 768 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 761 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 115 of file svm_fifo.c.

+ 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 372 of file svm_fifo.c.

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

◆ svm_fifo_init_ooo_lookup()

void svm_fifo_init_ooo_lookup ( svm_fifo_t f,
u8  ooo_type 
)

Initialize rbtrees used for ooo lookups.

Parameters
ffifo
ooo_typetype of ooo operation (0 enqueue, 1 dequeue)

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 
)

Set fifo pointers to requested offset.

Init fifo head and tail.

Definition at line 1369 of file svm_fifo.c.

+ Here is the call graph for this function:
+ Here is the caller 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 1410 of file svm_fifo.c.

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

◆ svm_fifo_max_read_chunk()

u32 svm_fifo_max_read_chunk ( svm_fifo_t f)

Max contiguous chunk of data that can be read.

Should only be called by consumers.

Definition at line 514 of file svm_fifo.c.

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

◆ svm_fifo_max_write_chunk()

u32 svm_fifo_max_write_chunk ( svm_fifo_t f)

Max contiguous chunk of data that can be written.

Should only be called by producers

Definition at line 534 of file svm_fifo.c.

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

◆ svm_fifo_n_chunks()

u32 svm_fifo_n_chunks ( svm_fifo_t f)

Number of chunks linked into the fifo.

Parameters
ffifo
Returns
number of chunks in fifo linked list

Definition at line 1505 of file svm_fifo.c.

+ 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 1354 of file svm_fifo.c.

+ Here is the call graph for this function:
+ 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 dequeuing 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 781 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 1141 of file svm_fifo.c.

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

◆ svm_fifo_provision_chunks()

int svm_fifo_provision_chunks ( svm_fifo_t f,
svm_fifo_seg_t fs,
u32  n_segs,
u32  len 
)

Provision and return chunks for number of bytes requested.

Allocates enough chunks to cover the bytes requested and returns them in the fifo segment array. The number of bytes provisioned may be less than requested if not enough segments were provided.

Parameters
ffifo
fsarray of fifo segments
n_segslength of fifo segments array
lennumber of bytes to preallocate
Returns
number of fifo segments provisioned or error

Definition at line 1244 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 1555 of file svm_fifo.c.

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

◆ svm_fifo_segments()

int svm_fifo_segments ( svm_fifo_t f,
u32  offset,
svm_fifo_seg_t fs,
u32  n_segs,
u32  max_bytes 
)

Get pointers to fifo chunks data in svm_fifo_seg_t array.

Populates fifo segment array with pointers to fifo chunk data and lengths. Because this returns pointers to data, it must be paired with svm_fifo_dequeue_drop to actually release the fifo chunks after the data is consumed.

Parameters
ffifo
offsetoffset from where to retrieve segments
fsarray of fifo segments allocated by caller
n_segsnumber of fifo segments in array
max_bytesmax bytes to be mapped to fifo segments
Returns
number of bytes in fifo segments or SVM_FIFO_EEMPTY

Definition at line 1283 of file svm_fifo.c.

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