FD.io VPP
v20.01-48-g3e0dafb74
Vector Packet Processing
|
Go to the source code of this file.
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, | ||
svm_fifo_chunk_t ** | last | ||
) |
Definition at line 23 of file svm_fifo.c.
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, | ||
svm_fifo_chunk_t ** | last | ||
) |
Definition at line 53 of file svm_fifo.c.
Definition at line 1350 of file svm_fifo.c.
Definition at line 1256 of file svm_fifo.c.
Definition at line 1369 of file svm_fifo.c.
|
static |
Add segment to fifo's out-of-order segment list.
Takes care of merging adjacent segments and removing overlapping ones.
Definition at line 197 of file svm_fifo.c.
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
static |
Definition at line 378 of file svm_fifo.c.
|
inlinestatic |
|
inlinestatic |
|
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 330 of file svm_fifo.c.
|
inlinestatic |
Definition at line 120 of file svm_fifo.c.
|
inlinestatic |
Definition at line 114 of file svm_fifo.c.
|
inlinestatic |
Definition at line 108 of file svm_fifo.c.
|
inlinestatic |
Definition at line 102 of file svm_fifo.c.
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.
f | fifo to be extended |
c | chunk or linked list of chunks to be added |
Definition at line 579 of file svm_fifo.c.
void svm_fifo_add_subscriber | ( | svm_fifo_t * | f, |
u8 | sub | ||
) |
Add io events subscriber to list.
f | fifo |
sub | subscriber opaque index (typically app worker index) |
Definition at line 1175 of file svm_fifo.c.
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 471 of file svm_fifo.c.
|
inlinestatic |
void svm_fifo_clone | ( | svm_fifo_t * | df, |
svm_fifo_t * | sf | ||
) |
Clones fifo.
Clone fifo.
Assumptions:
Definition at line 1130 of file svm_fifo.c.
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.
f | fifo |
Definition at line 715 of file svm_fifo.c.
|
inlinestatic |
Definition at line 94 of file svm_fifo.c.
|
inlinestatic |
Definition at line 86 of file svm_fifo.c.
svm_fifo_t* svm_fifo_create | ( | 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 436 of file svm_fifo.c.
void svm_fifo_del_subscriber | ( | svm_fifo_t * | f, |
u8 | subscriber | ||
) |
Remove io events subscriber form list.
f | fifo |
sub | subscriber index to be removed |
Definition at line 1183 of file svm_fifo.c.
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.
f | fifo |
len | length of data to dequeue |
dst | buffer to where to dequeue the data |
Definition at line 981 of file svm_fifo.c.
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.
f | fifo |
len | number of bytes to drop |
Definition at line 1029 of file svm_fifo.c.
void svm_fifo_dequeue_drop_all | ( | svm_fifo_t * | f | ) |
Dequeue and drop all bytes from fifo.
Advances head to tail position.
f | fifo |
Definition at line 1061 of file svm_fifo.c.
u8* svm_fifo_dump_trace | ( | u8 * | s, |
svm_fifo_t * | f | ||
) |
Definition at line 1268 of file svm_fifo.c.
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.
f | fifo |
len | length of data to copy |
src | buffer from where to copy the data |
Definition at line 888 of file svm_fifo.c.
void svm_fifo_enqueue_nocopy | ( | svm_fifo_t * | f, |
u32 | len | ||
) |
Advance tail.
Advance tail pointer.
Definition at line 964 of file svm_fifo.c.
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 931 of file svm_fifo.c.
|
static |
Find chunk for given byte position.
f | fifo |
pos | normalized position in fifo |
Definition at line 503 of file svm_fifo.c.
ooo_segment_t* svm_fifo_first_ooo_segment | ( | svm_fifo_t * | f | ) |
First out-of-order segment for fifo.
f | fifo |
Definition at line 1147 of file svm_fifo.c.
void svm_fifo_free | ( | svm_fifo_t * | f | ) |
Free fifo and associated state.
f | fifo |
Definition at line 853 of file svm_fifo.c.
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.
f | fifo to cleanup |
Definition at line 847 of file svm_fifo.c.
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.
f | fifo to cleanup |
Definition at line 132 of file svm_fifo.c.
|
inlinestatic |
void svm_fifo_init | ( | svm_fifo_t * | f, |
u32 | size | ||
) |
Initialize fifo.
f | fifo |
size | size for fifo |
Definition at line 392 of file svm_fifo.c.
void svm_fifo_init_chunks | ( | svm_fifo_t * | f | ) |
Initialize fifo chunks and rbtree.
f | fifo |
Definition at line 408 of file svm_fifo.c.
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 1156 of file svm_fifo.c.
u8 svm_fifo_is_sane | ( | svm_fifo_t * | f | ) |
Check if fifo is sane.
Debug only.
f | fifo |
Definition at line 1198 of file svm_fifo.c.
u32 svm_fifo_n_ooo_segments | ( | svm_fifo_t * | f | ) |
Number of out-of-order segments for fifo.
f | fifo |
Definition at line 1141 of file svm_fifo.c.
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.
f | fifo |
src | src of new data |
len | length of new data |
Definition at line 866 of file svm_fifo.c.
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.
f | fifo |
offset | offset from which to copy the data |
len | length of data to copy |
dst | buffer to where to dequeue the data |
Definition at line 1007 of file svm_fifo.c.
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
try_shrink | is set. |
f | fifo |
len | number of bytes to remove from fifo. The actual number of bytes to be removed will be less or equal to this value. |
try_shrink | flg 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 |
Definition at line 807 of file svm_fifo.c.
u8* svm_fifo_replay | ( | u8 * | s, |
svm_fifo_t * | f, | ||
u8 | no_read, | ||
u8 | verbose | ||
) |
Definition at line 1292 of file svm_fifo.c.
int svm_fifo_segments | ( | svm_fifo_t * | f, |
svm_fifo_seg_t * | fs | ||
) |
Definition at line 1077 of file svm_fifo.c.
void svm_fifo_segments_free | ( | svm_fifo_t * | f, |
svm_fifo_seg_t * | fs | ||
) |
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.
f | fifo |
Definition at line 1237 of file svm_fifo.c.
|
static |
Definition at line 569 of file svm_fifo.c.
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.