FD.io VPP
v21.01.1
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 | ||
) |
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 | ||
) |
|
static |
Definition at line 580 of file svm_fifo.c.
Definition at line 542 of file svm_fifo.c.
|
static |
Definition at line 731 of file svm_fifo.c.
|
static |
Definition at line 697 of file svm_fifo.c.
|
static |
Definition at line 802 of file svm_fifo.c.
|
inlinestatic |
Definition at line 1040 of file svm_fifo.c.
|
static |
Definition at line 648 of file svm_fifo.c.
|
static |
Definition at line 599 of file svm_fifo.c.
Definition at line 1551 of file svm_fifo.c.
Definition at line 1570 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 178 of file svm_fifo.c.
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
static |
|
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 308 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 1326 of file svm_fifo.c.
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 423 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 459 of file svm_fifo.c.
void svm_fifo_clone | ( | svm_fifo_t * | df, |
svm_fifo_t * | sf | ||
) |
Clones fifo.
Clone fifo.
Assumptions:
Definition at line 1280 of file svm_fifo.c.
|
inlinestatic |
Definition at line 99 of file svm_fifo.c.
|
inlinestatic |
Definition at line 91 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 1334 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. 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.
f | fifo |
len | length of data to dequeue |
dst | buffer to where to dequeue the data |
Definition at line 1092 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 1151 of file svm_fifo.c.
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 1189 of file svm_fifo.c.
u8* svm_fifo_dump_trace | ( | u8 * | s, |
svm_fifo_t * | f | ||
) |
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 840 of file svm_fifo.c.
void svm_fifo_enqueue_nocopy | ( | svm_fifo_t * | f, |
u32 | len | ||
) |
Advance tail.
Advance tail pointer.
Definition at line 935 of file svm_fifo.c.
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.
f | fifo |
segs | array of segments to enqueue |
n_segs | number of segments |
allow_partial | if set partial enqueues are allowed |
Definition at line 959 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 898 of file svm_fifo.c.
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.
f | fifo |
Definition at line 1209 of file svm_fifo.c.
|
static |
Find chunk for given byte position.
f | fifo |
pos | normalized position in fifo |
Definition at line 485 of file svm_fifo.c.
|
static |
Definition at line 497 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 1301 of file svm_fifo.c.
void svm_fifo_free | ( | svm_fifo_t * | f | ) |
Free fifo and associated state.
f | fifo |
Definition at line 762 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 755 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 113 of file svm_fifo.c.
void svm_fifo_init | ( | svm_fifo_t * | f, |
u32 | size | ||
) |
Initialize fifo.
f | fifo |
size | size for fifo |
Definition at line 370 of file svm_fifo.c.
void svm_fifo_init_ooo_lookup | ( | svm_fifo_t * | f, |
u8 | ooo_type | ||
) |
Initialize rbtrees used for ooo lookups.
f | fifo |
ooo_type | type of ooo operation (0 enqueue, 1 dequeue) |
Definition at line 405 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 1310 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 1349 of file svm_fifo.c.
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 511 of file svm_fifo.c.
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 531 of file svm_fifo.c.
u32 svm_fifo_n_chunks | ( | svm_fifo_t * | f | ) |
Number of chunks linked into the fifo.
f | fifo |
Definition at line 1442 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 1295 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 dequeuing 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 775 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 1127 of file svm_fifo.c.
u8* svm_fifo_replay | ( | u8 * | s, |
svm_fifo_t * | f, | ||
u8 | no_read, | ||
u8 | verbose | ||
) |
Definition at line 1492 of file svm_fifo.c.
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.
f | fifo |
offset | offset from where to retrieve segments |
fs | array of fifo segments allocated by caller |
n_segs | number of fifo segments in array |
max_bytes | max bytes to be mapped to fifo segments |
Definition at line 1225 of file svm_fifo.c.