FD.io VPP
v21.06-3-gbb25fbf28
Vector Packet Processing
|
Go to the source code of this file.
Macros | |
#define | F_INVALID_CPTR (fs_sptr_t) ~0ULL |
#define F_INVALID_CPTR (fs_sptr_t) ~0ULL |
Definition at line 24 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, | ||
fs_sptr_t * | last | ||
) |
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 | ||
) |
|
static |
Definition at line 586 of file svm_fifo.c.
Definition at line 548 of file svm_fifo.c.
|
static |
Definition at line 737 of file svm_fifo.c.
|
static |
Definition at line 703 of file svm_fifo.c.
|
static |
Definition at line 809 of file svm_fifo.c.
|
inlinestatic |
Definition at line 1054 of file svm_fifo.c.
|
static |
Definition at line 654 of file svm_fifo.c.
|
static |
Definition at line 605 of file svm_fifo.c.
Definition at line 1614 of file svm_fifo.c.
Definition at line 1633 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 180 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 310 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 1387 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 426 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 462 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 1338 of file svm_fifo.c.
|
inlinestatic |
Definition at line 101 of file svm_fifo.c.
|
inlinestatic |
Definition at line 93 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 1395 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 1105 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 1168 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 1207 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 847 of file svm_fifo.c.
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.
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 972 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 906 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 1228 of file svm_fifo.c.
|
static |
Find chunk for given byte position.
f | fifo |
pos | normalized position in fifo |
Definition at line 488 of file svm_fifo.c.
|
static |
Definition at line 500 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 1360 of file svm_fifo.c.
void svm_fifo_free | ( | svm_fifo_t * | f | ) |
Free fifo and associated state.
f | fifo |
Definition at line 768 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 761 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 115 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 372 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 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 1369 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 1410 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 514 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 534 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 1505 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 1354 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 781 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 1141 of file svm_fifo.c.
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.
f | fifo |
fs | array of fifo segments |
n_segs | length of fifo segments array |
len | number of bytes to preallocate |
Definition at line 1244 of file svm_fifo.c.
u8* svm_fifo_replay | ( | u8 * | s, |
svm_fifo_t * | f, | ||
u8 | no_read, | ||
u8 | verbose | ||
) |
Definition at line 1555 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 1283 of file svm_fifo.c.