FD.io VPP  v21.06-3-gbb25fbf28
Vector Packet Processing
fifo_segment.c File Reference
+ Include dependency graph for fifo_segment.c:

Go to the source code of this file.

Macros

#define FS_CL_HEAD_MASK   0xFFFFFFFFFFFF
 
#define FS_CL_HEAD_TMASK   0xFFFF000000000000
 
#define FS_CL_HEAD_TINC   (1ULL << 48)
 

Functions

static void * fsh_alloc_aligned (fifo_segment_header_t *fsh, uword size, uword align)
 
static void * fsh_alloc (fifo_segment_header_t *fsh, uword size)
 
static fifo_segment_slice_tfsh_slice_get (fifo_segment_header_t *fsh, u32 slice_index)
 
static fifo_slice_private_tfs_slice_private_get (fifo_segment_t *fs, u32 slice_index)
 
static uword fsh_n_free_bytes (fifo_segment_header_t *fsh)
 
static void fsh_cached_bytes_add (fifo_segment_header_t *fsh, uword size)
 
static void fsh_cached_bytes_sub (fifo_segment_header_t *fsh, uword size)
 
static uword fsh_n_cached_bytes (fifo_segment_header_t *fsh)
 
static void fsh_active_fifos_update (fifo_segment_header_t *fsh, int inc)
 
static u32 fsh_n_active_fifos (fifo_segment_header_t *fsh)
 
static uword fsh_virtual_mem (fifo_segment_header_t *fsh)
 
void fsh_virtual_mem_update (fifo_segment_header_t *fsh, u32 slice_index, int n_bytes)
 
static int fss_chunk_fl_index_is_valid (fifo_segment_slice_t *fss, u32 fl_index)
 
static svm_fifo_chunk_tfss_chunk_free_list_head (fifo_segment_header_t *fsh, fifo_segment_slice_t *fss, u32 fl_index)
 
static void fss_chunk_free_list_push (fifo_segment_header_t *fsh, fifo_segment_slice_t *fss, u32 fl_index, svm_fifo_chunk_t *c)
 
static void fss_chunk_free_list_push_list (fifo_segment_header_t *fsh, fifo_segment_slice_t *fss, u32 fl_index, svm_fifo_chunk_t *head, svm_fifo_chunk_t *tail)
 
static svm_fifo_chunk_tfss_chunk_free_list_pop (fifo_segment_header_t *fsh, fifo_segment_slice_t *fss, u32 fl_index)
 
static void fss_fifo_free_list_push (fifo_segment_header_t *fsh, fifo_segment_slice_t *fss, svm_fifo_shared_t *sf)
 
static void fss_fifo_free_list_push_list (fifo_segment_header_t *fsh, fifo_segment_slice_t *fss, svm_fifo_shared_t *head, svm_fifo_shared_t *tail)
 
svm_fifo_shared_tfss_fifo_free_list_pop (fifo_segment_header_t *fsh, fifo_segment_slice_t *fss)
 
static void pfss_fifo_add_active_list (fifo_slice_private_t *pfss, svm_fifo_t *f)
 
static void pfss_fifo_del_active_list (fifo_slice_private_t *pfss, svm_fifo_t *f)
 
static uword fss_fl_chunk_bytes (fifo_segment_slice_t *fss)
 
static void fss_fl_chunk_bytes_add (fifo_segment_slice_t *fss, uword size)
 
static void fss_fl_chunk_bytes_sub (fifo_segment_slice_t *fss, uword size)
 
int fifo_segment_init (fifo_segment_t *fs)
 Initialize fifo segment shared header. More...
 
int fifo_segment_create (fifo_segment_main_t *sm, fifo_segment_create_args_t *a)
 Create a fifo segment and initialize as master. More...
 
int fifo_segment_attach (fifo_segment_main_t *sm, fifo_segment_create_args_t *a)
 Attach as slave to a fifo segment. More...
 
void fifo_segment_delete (fifo_segment_main_t *sm, fifo_segment_t *s)
 
u32 fifo_segment_index (fifo_segment_main_t *sm, fifo_segment_t *s)
 
fifo_segment_tfifo_segment_get_segment (fifo_segment_main_t *sm, u32 segment_index)
 
fifo_segment_tfifo_segment_get_segment_if_valid (fifo_segment_main_t *sm, u32 segment_index)
 
void fifo_segment_info (fifo_segment_t *seg, char **address, size_t *size)
 
void fifo_segment_main_init (fifo_segment_main_t *sm, u64 baseva, u32 timeout_in_seconds)
 
static u32 fs_freelist_for_size (u32 size)
 
static u32 fs_freelist_index_to_size (u32 fl_index)
 
static int fs_chunk_size_is_valid (fifo_segment_header_t *fsh, u32 size)
 
svm_fifo_chunk_tfs_try_alloc_multi_chunk (fifo_segment_header_t *fsh, fifo_segment_slice_t *fss, u32 data_bytes)
 
static int fsh_try_alloc_fifo_hdr_batch (fifo_segment_header_t *fsh, fifo_segment_slice_t *fss, u32 batch_size)
 
static int fsh_try_alloc_chunk_batch (fifo_segment_header_t *fsh, fifo_segment_slice_t *fss, u32 fl_index, u32 batch_size)
 
static int fs_try_alloc_fifo_batch (fifo_segment_header_t *fsh, fifo_segment_slice_t *fss, u32 fl_index, u32 batch_size)
 
static svm_fifo_shared_tfsh_try_alloc_fifo_hdr (fifo_segment_header_t *fsh, fifo_segment_slice_t *fss)
 
static svm_fifo_chunk_tfsh_try_alloc_chunk (fifo_segment_header_t *fsh, fifo_segment_slice_t *fss, u32 data_bytes)
 
static svm_fifo_shared_tfs_try_alloc_fifo (fifo_segment_header_t *fsh, u32 slice_index, u32 data_bytes)
 Try to allocate new fifo. More...
 
svm_fifo_chunk_tfsh_alloc_chunk (fifo_segment_header_t *fsh, u32 slice_index, u32 chunk_size)
 Allocate chunks in fifo segment. More...
 
static void fsh_slice_collect_chunks (fifo_segment_header_t *fsh, fifo_segment_slice_t *fss, svm_fifo_chunk_t *c)
 
void fsh_collect_chunks (fifo_segment_header_t *fsh, u32 slice_index, svm_fifo_chunk_t *c)
 Return chunks to fifo segment. More...
 
svm_fifo_tfs_fifo_alloc (fifo_segment_t *fs, u32 slice_index)
 
void fs_fifo_free (fifo_segment_t *fs, svm_fifo_t *f, u32 slice_index)
 
void fifo_segment_cleanup (fifo_segment_t *fs)
 
svm_fifo_tfifo_segment_alloc_fifo_w_slice (fifo_segment_t *fs, u32 slice_index, u32 data_bytes, fifo_segment_ftype_t ftype)
 Allocate fifo in fifo segment. More...
 
svm_fifo_tfifo_segment_alloc_fifo_w_offset (fifo_segment_t *fs, uword offset)
 
svm_fifo_tfifo_segment_duplicate_fifo (fifo_segment_t *fs, svm_fifo_t *f)
 
void fifo_segment_free_fifo (fifo_segment_t *fs, svm_fifo_t *f)
 Free fifo allocated in fifo segment. More...
 
void fifo_segment_free_client_fifo (fifo_segment_t *fs, svm_fifo_t *f)
 Free fifo allocated by external applications. More...
 
void fifo_segment_detach_fifo (fifo_segment_t *fs, svm_fifo_t **f)
 
void fifo_segment_attach_fifo (fifo_segment_t *fs, svm_fifo_t **f, u32 slice_index)
 
uword fifo_segment_fifo_offset (svm_fifo_t *f)
 
svm_fifo_chunk_tfifo_segment_alloc_chunk_w_slice (fifo_segment_t *fs, u32 slice_index, u32 chunk_size)
 
void fifo_segment_collect_chunk (fifo_segment_t *fs, u32 slice_index, svm_fifo_chunk_t *c)
 
uword fifo_segment_chunk_offset (fifo_segment_t *fs, svm_fifo_chunk_t *c)
 
svm_msg_q_tfifo_segment_msg_q_alloc (fifo_segment_t *fs, u32 mq_index, svm_msg_q_cfg_t *cfg)
 Allocate message queue on segment. More...
 
svm_msg_q_tfifo_segment_msg_q_attach (fifo_segment_t *fs, uword offset, u32 mq_index)
 Attach message queue at fifo segment offset. More...
 
void fifo_segment_msg_qs_discover (fifo_segment_t *fs, int *fds, u32 n_fds)
 Discover mqs on mq only segment. More...
 
uword fifo_segment_msg_q_offset (fifo_segment_t *fs, u32 mq_index)
 Message queue offset on segment. More...
 
int fifo_segment_prealloc_fifo_hdrs (fifo_segment_t *fs, u32 slice_index, u32 batch_size)
 Try to preallocate fifo headers. More...
 
int fifo_segment_prealloc_fifo_chunks (fifo_segment_t *fs, u32 slice_index, u32 chunk_size, u32 batch_size)
 Try to preallocate fifo chunks on segment. More...
 
void fifo_segment_preallocate_fifo_pairs (fifo_segment_t *fs, u32 rx_fifo_size, u32 tx_fifo_size, u32 *n_fifo_pairs)
 Pre-allocates fifo pairs in fifo segment. More...
 
u32 fifo_segment_num_fifos (fifo_segment_t *fs)
 Get number of active fifos. More...
 
static u32 fs_slice_num_free_fifos (fifo_segment_header_t *fsh, fifo_segment_slice_t *fss)
 
u32 fifo_segment_num_free_fifos (fifo_segment_t *fs)
 
static u32 fs_slice_num_free_chunks (fifo_segment_header_t *fsh, fifo_segment_slice_t *fss, u32 size)
 
u32 fifo_segment_num_free_chunks (fifo_segment_t *fs, u32 size)
 Find number of free chunks of given size. More...
 
uword fifo_segment_size (fifo_segment_t *fs)
 Fifo segment allocated size. More...
 
u8 fsh_has_reached_mem_limit (fifo_segment_header_t *fsh)
 Fifo segment has reached mem limit. More...
 
void fsh_reset_mem_limit (fifo_segment_header_t *fsh)
 Fifo segment reset mem limit flag. More...
 
void * fifo_segment_alloc (fifo_segment_t *fs, uword size)
 Fifo segment reset mem limit flag. More...
 
uword fifo_segment_free_bytes (fifo_segment_t *fs)
 Fifo segment estimate of number of free bytes. More...
 
uword fifo_segment_cached_bytes (fifo_segment_t *fs)
 Fifo segment number of cached bytes. More...
 
uword fifo_segment_available_bytes (fifo_segment_t *fs)
 
uword fifo_segment_fl_chunk_bytes (fifo_segment_t *fs)
 Number of bytes on chunk free lists. More...
 
u8 fifo_segment_has_fifos (fifo_segment_t *fs)
 
svm_fifo_tfifo_segment_get_slice_fifo_list (fifo_segment_t *fs, u32 slice_index)
 
u8 fifo_segment_get_mem_usage (fifo_segment_t *fs)
 
fifo_segment_mem_status_t fifo_segment_determine_status (fifo_segment_header_t *fsh, u8 usage)
 
fifo_segment_mem_status_t fifo_segment_get_mem_status (fifo_segment_t *fs)
 
u8format_fifo_segment_type (u8 *s, va_list *args)
 
u8format_fifo_segment (u8 *s, va_list *args)
 Segment format function. More...
 

Variables

static char * fifo_segment_mem_status_strings []
 

Macro Definition Documentation

◆ FS_CL_HEAD_MASK

#define FS_CL_HEAD_MASK   0xFFFFFFFFFFFF

Definition at line 136 of file fifo_segment.c.

◆ FS_CL_HEAD_TINC

#define FS_CL_HEAD_TINC   (1ULL << 48)

Definition at line 138 of file fifo_segment.c.

◆ FS_CL_HEAD_TMASK

#define FS_CL_HEAD_TMASK   0xFFFF000000000000

Definition at line 137 of file fifo_segment.c.

Function Documentation

◆ fifo_segment_alloc()

void* fifo_segment_alloc ( fifo_segment_t fs,
uword  size 
)

Fifo segment reset mem limit flag.

Parameters
fsfifo segment
sizesize requested
Returns
pointer to memory allocated or 0

Definition at line 1392 of file fifo_segment.c.

+ Here is the call graph for this function:

◆ fifo_segment_alloc_chunk_w_slice()

svm_fifo_chunk_t* fifo_segment_alloc_chunk_w_slice ( fifo_segment_t fs,
u32  slice_index,
u32  chunk_size 
)

Definition at line 1054 of file fifo_segment.c.

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

◆ fifo_segment_alloc_fifo_w_offset()

svm_fifo_t* fifo_segment_alloc_fifo_w_offset ( fifo_segment_t fs,
uword  offset 
)

Definition at line 891 of file fifo_segment.c.

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

◆ fifo_segment_alloc_fifo_w_slice()

svm_fifo_t* fifo_segment_alloc_fifo_w_slice ( fifo_segment_t fs,
u32  slice_index,
u32  data_bytes,
fifo_segment_ftype_t  ftype 
)

Allocate fifo in fifo segment.

Parameters
fsfifo segment for fifo
data_bytessize of default fifo chunk in bytes
ftypefifo type fifo_segment_ftype_t
Returns
new fifo or 0 if alloc failed

Definition at line 846 of file fifo_segment.c.

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

◆ fifo_segment_attach()

int fifo_segment_attach ( fifo_segment_main_t sm,
fifo_segment_create_args_t a 
)

Attach as slave to a fifo segment.

Definition at line 381 of file fifo_segment.c.

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

◆ fifo_segment_attach_fifo()

void fifo_segment_attach_fifo ( fifo_segment_t fs,
svm_fifo_t **  f,
u32  slice_index 
)

Definition at line 1011 of file fifo_segment.c.

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

◆ fifo_segment_available_bytes()

uword fifo_segment_available_bytes ( fifo_segment_t fs)

Definition at line 1414 of file fifo_segment.c.

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

◆ fifo_segment_cached_bytes()

uword fifo_segment_cached_bytes ( fifo_segment_t fs)

Fifo segment number of cached bytes.

Returns fifo segment's number of cached bytes.

Parameters
fsfifo segment
Returns
cached bytes

Definition at line 1408 of file fifo_segment.c.

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

◆ fifo_segment_chunk_offset()

uword fifo_segment_chunk_offset ( fifo_segment_t fs,
svm_fifo_chunk_t c 
)

Definition at line 1072 of file fifo_segment.c.

+ Here is the caller graph for this function:

◆ fifo_segment_cleanup()

void fifo_segment_cleanup ( fifo_segment_t fs)

Definition at line 826 of file fifo_segment.c.

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

◆ fifo_segment_collect_chunk()

void fifo_segment_collect_chunk ( fifo_segment_t fs,
u32  slice_index,
svm_fifo_chunk_t c 
)

Definition at line 1065 of file fifo_segment.c.

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

◆ fifo_segment_create()

int fifo_segment_create ( fifo_segment_main_t sm,
fifo_segment_create_args_t a 
)

Create a fifo segment and initialize as master.

Definition at line 347 of file fifo_segment.c.

+ Here is the call graph for this function:

◆ fifo_segment_delete()

void fifo_segment_delete ( fifo_segment_main_t sm,
fifo_segment_t s 
)

Definition at line 420 of file fifo_segment.c.

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

◆ fifo_segment_detach_fifo()

void fifo_segment_detach_fifo ( fifo_segment_t fs,
svm_fifo_t **  f 
)

Definition at line 984 of file fifo_segment.c.

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

◆ fifo_segment_determine_status()

fifo_segment_mem_status_t fifo_segment_determine_status ( fifo_segment_header_t fsh,
u8  usage 
)

Definition at line 1463 of file fifo_segment.c.

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

◆ fifo_segment_duplicate_fifo()

svm_fifo_t* fifo_segment_duplicate_fifo ( fifo_segment_t fs,
svm_fifo_t f 
)

Definition at line 907 of file fifo_segment.c.

+ Here is the call graph for this function:

◆ fifo_segment_fifo_offset()

uword fifo_segment_fifo_offset ( svm_fifo_t f)

Definition at line 1048 of file fifo_segment.c.

+ Here is the caller graph for this function:

◆ fifo_segment_fl_chunk_bytes()

uword fifo_segment_fl_chunk_bytes ( fifo_segment_t fs)

Number of bytes on chunk free lists.

Parameters
fsfifo segment
Returns
free bytes on chunk free lists

Definition at line 1420 of file fifo_segment.c.

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

◆ fifo_segment_free_bytes()

uword fifo_segment_free_bytes ( fifo_segment_t fs)

Fifo segment estimate of number of free bytes.

Returns fifo segment's internal estimate of the number of free bytes. To force a synchronization between the segment and the underlying memory allocator, call fifo_segment_update_free_bytes

Parameters
fsfifo segment
Returns
free bytes estimate

Definition at line 1402 of file fifo_segment.c.

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

◆ fifo_segment_free_client_fifo()

void fifo_segment_free_client_fifo ( fifo_segment_t fs,
svm_fifo_t f 
)

Free fifo allocated by external applications.

@params fs fifo segment for fifo

Parameters
ffifo to be freed

Definition at line 978 of file fifo_segment.c.

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

◆ fifo_segment_free_fifo()

void fifo_segment_free_fifo ( fifo_segment_t fs,
svm_fifo_t f 
)

Free fifo allocated in fifo segment.

Parameters
fsfifo segment for fifo
ffifo to be freed

Definition at line 918 of file fifo_segment.c.

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

◆ fifo_segment_get_mem_status()

fifo_segment_mem_status_t fifo_segment_get_mem_status ( fifo_segment_t fs)

Definition at line 1489 of file fifo_segment.c.

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

◆ fifo_segment_get_mem_usage()

u8 fifo_segment_get_mem_usage ( fifo_segment_t fs)

Definition at line 1452 of file fifo_segment.c.

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

◆ fifo_segment_get_segment()

fifo_segment_t* fifo_segment_get_segment ( fifo_segment_main_t sm,
u32  segment_index 
)

Definition at line 435 of file fifo_segment.c.

+ Here is the caller graph for this function:

◆ fifo_segment_get_segment_if_valid()

fifo_segment_t* fifo_segment_get_segment_if_valid ( fifo_segment_main_t sm,
u32  segment_index 
)

Definition at line 441 of file fifo_segment.c.

+ Here is the caller graph for this function:

◆ fifo_segment_get_slice_fifo_list()

svm_fifo_t* fifo_segment_get_slice_fifo_list ( fifo_segment_t fs,
u32  slice_index 
)

Definition at line 1443 of file fifo_segment.c.

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

◆ fifo_segment_has_fifos()

u8 fifo_segment_has_fifos ( fifo_segment_t fs)

Definition at line 1437 of file fifo_segment.c.

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

◆ fifo_segment_index()

u32 fifo_segment_index ( fifo_segment_main_t sm,
fifo_segment_t s 
)

Definition at line 429 of file fifo_segment.c.

◆ fifo_segment_info()

void fifo_segment_info ( fifo_segment_t seg,
char **  address,
size_t *  size 
)

Definition at line 449 of file fifo_segment.c.

+ Here is the caller graph for this function:

◆ fifo_segment_init()

int fifo_segment_init ( fifo_segment_t fs)

Initialize fifo segment shared header.

Definition at line 295 of file fifo_segment.c.

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

◆ fifo_segment_main_init()

void fifo_segment_main_init ( fifo_segment_main_t sm,
u64  baseva,
u32  timeout_in_seconds 
)

Definition at line 456 of file fifo_segment.c.

+ Here is the caller graph for this function:

◆ fifo_segment_msg_q_alloc()

svm_msg_q_t* fifo_segment_msg_q_alloc ( fifo_segment_t fs,
u32  mq_index,
svm_msg_q_cfg_t cfg 
)

Allocate message queue on segment.

Parameters
fsfifo segment for mq
mq_indexindex in private mqs vector to use to attach
cfgconfiguration for mq
Returns
attached message queue

Definition at line 1078 of file fifo_segment.c.

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

◆ fifo_segment_msg_q_attach()

svm_msg_q_t* fifo_segment_msg_q_attach ( fifo_segment_t fs,
uword  offset,
u32  mq_index 
)

Attach message queue at fifo segment offset.

Parameters
fsfifo segment for mq
offsetoffset for shared mq on the segment
mq_indexindex in private mqs vector to use to attach
Returns
attached message queue

Definition at line 1105 of file fifo_segment.c.

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

◆ fifo_segment_msg_q_offset()

uword fifo_segment_msg_q_offset ( fifo_segment_t fs,
u32  mq_index 
)

Message queue offset on segment.

Parameters
fsfifo segment for mq
mq_indexindex of mq in private mqs vector
Returns
offset of the shared mq the private mq is attached to

Definition at line 1162 of file fifo_segment.c.

+ Here is the caller graph for this function:

◆ fifo_segment_msg_qs_discover()

void fifo_segment_msg_qs_discover ( fifo_segment_t fs,
int *  fds,
u32  n_fds 
)

Discover mqs on mq only segment.

Parameters
fsfifo segment for mq
fdsarray of fds is mqs use eventfds
n_fdsnumber of fds

Definition at line 1130 of file fifo_segment.c.

+ Here is the call graph for this function:

◆ fifo_segment_num_fifos()

u32 fifo_segment_num_fifos ( fifo_segment_t fs)

Get number of active fifos.

Definition at line 1274 of file fifo_segment.c.

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

◆ fifo_segment_num_free_chunks()

u32 fifo_segment_num_free_chunks ( fifo_segment_t fs,
u32  size 
)

Find number of free chunks of given size.

Parameters
fsfifo segment
sizechunk size of interest or ~0 if all should be counted
Returns
number of chunks of given size

Definition at line 1358 of file fifo_segment.c.

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

◆ fifo_segment_num_free_fifos()

u32 fifo_segment_num_free_fifos ( fifo_segment_t fs)

Definition at line 1298 of file fifo_segment.c.

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

◆ fifo_segment_prealloc_fifo_chunks()

int fifo_segment_prealloc_fifo_chunks ( fifo_segment_t fs,
u32  slice_index,
u32  chunk_size,
u32  batch_size 
)

Try to preallocate fifo chunks on segment.

Tries to preallocate chunks of requested size on segment and adds them to chunk freelist.

Parameters
fsfifo segment
chunk_sizesize of chunks to be allocated in bytes
batch_sizenumber of chunks to be allocated
Returns
0 on success, negative number otherwise

Definition at line 1185 of file fifo_segment.c.

+ Here is the call graph for this function:

◆ fifo_segment_prealloc_fifo_hdrs()

int fifo_segment_prealloc_fifo_hdrs ( fifo_segment_t fs,
u32  slice_index,
u32  batch_size 
)

Try to preallocate fifo headers.

Tries to preallocate fifo headers and adds them to freelist.

Parameters
fsfifo segment
batch_sizenumber of chunks to be allocated
Returns
0 on success, negative number otherwise

Definition at line 1174 of file fifo_segment.c.

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

◆ fifo_segment_preallocate_fifo_pairs()

void fifo_segment_preallocate_fifo_pairs ( fifo_segment_t fs,
u32  rx_fifo_size,
u32  tx_fifo_size,
u32 n_fifo_pairs 
)

Pre-allocates fifo pairs in fifo segment.

The number of fifos pre-allocated is the minimum of the requested number of pairs and the maximum number that fit within the segment. If the maximum is hit, the number of fifo pairs requested is updated by subtracting the number of fifos that have been successfully allocated.

Parameters
fsfifo segment for fifo
rx_fifo_sizedata size of rx fifos
tx_fifo_sizedata size of tx fifos
n_fifo_pairsnumber of pairs requested. Prior to returning, this is decremented by the the number of pairs allocated.

Definition at line 1208 of file fifo_segment.c.

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

◆ fifo_segment_size()

uword fifo_segment_size ( fifo_segment_t fs)

Fifo segment allocated size.

Returns fifo segment's allocated size

Parameters
fsfifo segment
Returns
allocated size in bytes

Definition at line 1374 of file fifo_segment.c.

+ Here is the caller graph for this function:

◆ format_fifo_segment()

u8* format_fifo_segment ( u8 s,
va_list *  args 
)

Segment format function.

Definition at line 1519 of file fifo_segment.c.

+ Here is the call graph for this function:

◆ format_fifo_segment_type()

u8* format_fifo_segment_type ( u8 s,
va_list *  args 
)

Definition at line 1498 of file fifo_segment.c.

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

◆ fs_chunk_size_is_valid()

static int fs_chunk_size_is_valid ( fifo_segment_header_t fsh,
u32  size 
)
inlinestatic

Definition at line 479 of file fifo_segment.c.

+ Here is the caller graph for this function:

◆ fs_fifo_alloc()

svm_fifo_t* fs_fifo_alloc ( fifo_segment_t fs,
u32  slice_index 
)

Definition at line 803 of file fifo_segment.c.

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

◆ fs_fifo_free()

void fs_fifo_free ( fifo_segment_t fs,
svm_fifo_t f,
u32  slice_index 
)

Definition at line 814 of file fifo_segment.c.

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

◆ fs_freelist_for_size()

static u32 fs_freelist_for_size ( u32  size)
inlinestatic

Definition at line 464 of file fifo_segment.c.

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

◆ fs_freelist_index_to_size()

static u32 fs_freelist_index_to_size ( u32  fl_index)
inlinestatic

Definition at line 473 of file fifo_segment.c.

+ Here is the caller graph for this function:

◆ fs_slice_num_free_chunks()

static u32 fs_slice_num_free_chunks ( fifo_segment_header_t fsh,
fifo_segment_slice_t fss,
u32  size 
)
static

Definition at line 1314 of file fifo_segment.c.

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

◆ fs_slice_num_free_fifos()

static u32 fs_slice_num_free_fifos ( fifo_segment_header_t fsh,
fifo_segment_slice_t fss 
)
static

Definition at line 1280 of file fifo_segment.c.

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

◆ fs_slice_private_get()

static fifo_slice_private_t* fs_slice_private_get ( fifo_segment_t fs,
u32  slice_index 
)
inlinestatic

Definition at line 56 of file fifo_segment.c.

+ Here is the caller graph for this function:

◆ fs_try_alloc_fifo()

static svm_fifo_shared_t* fs_try_alloc_fifo ( fifo_segment_header_t fsh,
u32  slice_index,
u32  data_bytes 
)
static

Try to allocate new fifo.

Tries the following steps in order:

  • grab fifo and chunk from freelists
  • batch fifo and chunk allocation
  • single fifo allocation
  • grab multiple fifo chunks from freelists

Definition at line 725 of file fifo_segment.c.

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

◆ fs_try_alloc_fifo_batch()

static int fs_try_alloc_fifo_batch ( fifo_segment_header_t fsh,
fifo_segment_slice_t fss,
u32  fl_index,
u32  batch_size 
)
static

Definition at line 628 of file fifo_segment.c.

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

◆ fs_try_alloc_multi_chunk()

svm_fifo_chunk_t* fs_try_alloc_multi_chunk ( fifo_segment_header_t fsh,
fifo_segment_slice_t fss,
u32  data_bytes 
)

Definition at line 490 of file fifo_segment.c.

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

◆ fsh_active_fifos_update()

static void fsh_active_fifos_update ( fifo_segment_header_t fsh,
int  inc 
)
inlinestatic

Definition at line 96 of file fifo_segment.c.

+ Here is the caller graph for this function:

◆ fsh_alloc()

static void* fsh_alloc ( fifo_segment_header_t fsh,
uword  size 
)
inlinestatic

Definition at line 44 of file fifo_segment.c.

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

◆ fsh_alloc_aligned()

static void* fsh_alloc_aligned ( fifo_segment_header_t fsh,
uword  size,
uword  align 
)
inlinestatic

Definition at line 20 of file fifo_segment.c.

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

◆ fsh_alloc_chunk()

svm_fifo_chunk_t* fsh_alloc_chunk ( fifo_segment_header_t fsh,
u32  slice_index,
u32  chunk_size 
)

Allocate chunks in fifo segment.

Parameters
fshfifo segment header
slice_indexslice where chunks should be alocated
chunk_sizechunk size needed
Returns
chunk (or chunks) that cover at least chunk_size bytes on success, 0 on failure.

Definition at line 761 of file fifo_segment.c.

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

◆ fsh_cached_bytes_add()

static void fsh_cached_bytes_add ( fifo_segment_header_t fsh,
uword  size 
)
inlinestatic

Definition at line 77 of file fifo_segment.c.

+ Here is the caller graph for this function:

◆ fsh_cached_bytes_sub()

static void fsh_cached_bytes_sub ( fifo_segment_header_t fsh,
uword  size 
)
inlinestatic

Definition at line 83 of file fifo_segment.c.

+ Here is the caller graph for this function:

◆ fsh_collect_chunks()

void fsh_collect_chunks ( fifo_segment_header_t fsh,
u32  slice_index,
svm_fifo_chunk_t c 
)

Return chunks to fifo segment.

Parameters
fshfifo segment header
slice_indexslice where chunks should be returned
cpointer to first chunk in 0 terminated linked list

Definition at line 794 of file fifo_segment.c.

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

◆ fsh_has_reached_mem_limit()

u8 fsh_has_reached_mem_limit ( fifo_segment_header_t fsh)

Fifo segment has reached mem limit.

Parameters
fshfifo segment header
Returns
1 (if reached) or 0 (otherwise)

Definition at line 1380 of file fifo_segment.c.

+ Here is the caller graph for this function:

◆ fsh_n_active_fifos()

static u32 fsh_n_active_fifos ( fifo_segment_header_t fsh)
inlinestatic

Definition at line 102 of file fifo_segment.c.

+ Here is the caller graph for this function:

◆ fsh_n_cached_bytes()

static uword fsh_n_cached_bytes ( fifo_segment_header_t fsh)
inlinestatic

Definition at line 89 of file fifo_segment.c.

+ Here is the caller graph for this function:

◆ fsh_n_free_bytes()

static uword fsh_n_free_bytes ( fifo_segment_header_t fsh)
inlinestatic

Definition at line 69 of file fifo_segment.c.

+ Here is the caller graph for this function:

◆ fsh_reset_mem_limit()

void fsh_reset_mem_limit ( fifo_segment_header_t fsh)

Fifo segment reset mem limit flag.

Parameters
fsfifo segment

Definition at line 1386 of file fifo_segment.c.

+ Here is the caller graph for this function:

◆ fsh_slice_collect_chunks()

static void fsh_slice_collect_chunks ( fifo_segment_header_t fsh,
fifo_segment_slice_t fss,
svm_fifo_chunk_t c 
)
static

Definition at line 773 of file fifo_segment.c.

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

◆ fsh_slice_get()

static fifo_segment_slice_t* fsh_slice_get ( fifo_segment_header_t fsh,
u32  slice_index 
)
inlinestatic

Definition at line 50 of file fifo_segment.c.

+ Here is the caller graph for this function:

◆ fsh_try_alloc_chunk()

static svm_fifo_chunk_t* fsh_try_alloc_chunk ( fifo_segment_header_t fsh,
fifo_segment_slice_t fss,
u32  data_bytes 
)
static

Definition at line 656 of file fifo_segment.c.

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

◆ fsh_try_alloc_chunk_batch()

static int fsh_try_alloc_chunk_batch ( fifo_segment_header_t fsh,
fifo_segment_slice_t fss,
u32  fl_index,
u32  batch_size 
)
static

Definition at line 587 of file fifo_segment.c.

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

◆ fsh_try_alloc_fifo_hdr()

static svm_fifo_shared_t* fsh_try_alloc_fifo_hdr ( fifo_segment_header_t fsh,
fifo_segment_slice_t fss 
)
static

Definition at line 638 of file fifo_segment.c.

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

◆ fsh_try_alloc_fifo_hdr_batch()

static int fsh_try_alloc_fifo_hdr_batch ( fifo_segment_header_t fsh,
fifo_segment_slice_t fss,
u32  batch_size 
)
static

Definition at line 554 of file fifo_segment.c.

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

◆ fsh_virtual_mem()

static uword fsh_virtual_mem ( fifo_segment_header_t fsh)
inlinestatic

Definition at line 108 of file fifo_segment.c.

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

◆ fsh_virtual_mem_update()

void fsh_virtual_mem_update ( fifo_segment_header_t fsh,
u32  slice_index,
int  n_bytes 
)

Definition at line 123 of file fifo_segment.c.

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

◆ fss_chunk_fl_index_is_valid()

static int fss_chunk_fl_index_is_valid ( fifo_segment_slice_t fss,
u32  fl_index 
)
inlinestatic

Definition at line 131 of file fifo_segment.c.

+ Here is the caller graph for this function:

◆ fss_chunk_free_list_head()

static svm_fifo_chunk_t* fss_chunk_free_list_head ( fifo_segment_header_t fsh,
fifo_segment_slice_t fss,
u32  fl_index 
)
static

Definition at line 141 of file fifo_segment.c.

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

◆ fss_chunk_free_list_pop()

static svm_fifo_chunk_t* fss_chunk_free_list_pop ( fifo_segment_header_t fsh,
fifo_segment_slice_t fss,
u32  fl_index 
)
static

Definition at line 191 of file fifo_segment.c.

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

◆ fss_chunk_free_list_push()

static void fss_chunk_free_list_push ( fifo_segment_header_t fsh,
fifo_segment_slice_t fss,
u32  fl_index,
svm_fifo_chunk_t c 
)
static

Definition at line 149 of file fifo_segment.c.

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

◆ fss_chunk_free_list_push_list()

static void fss_chunk_free_list_push_list ( fifo_segment_header_t fsh,
fifo_segment_slice_t fss,
u32  fl_index,
svm_fifo_chunk_t head,
svm_fifo_chunk_t tail 
)
static

Definition at line 170 of file fifo_segment.c.

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

◆ fss_fifo_free_list_pop()

svm_fifo_shared_t* fss_fifo_free_list_pop ( fifo_segment_header_t fsh,
fifo_segment_slice_t fss 
)

Definition at line 240 of file fifo_segment.c.

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

◆ fss_fifo_free_list_push()

static void fss_fifo_free_list_push ( fifo_segment_header_t fsh,
fifo_segment_slice_t fss,
svm_fifo_shared_t sf 
)
static

Definition at line 223 of file fifo_segment.c.

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

◆ fss_fifo_free_list_push_list()

static void fss_fifo_free_list_push_list ( fifo_segment_header_t fsh,
fifo_segment_slice_t fss,
svm_fifo_shared_t head,
svm_fifo_shared_t tail 
)
static

Definition at line 231 of file fifo_segment.c.

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

◆ fss_fl_chunk_bytes()

static uword fss_fl_chunk_bytes ( fifo_segment_slice_t fss)
inlinestatic

Definition at line 274 of file fifo_segment.c.

+ Here is the caller graph for this function:

◆ fss_fl_chunk_bytes_add()

static void fss_fl_chunk_bytes_add ( fifo_segment_slice_t fss,
uword  size 
)
inlinestatic

Definition at line 280 of file fifo_segment.c.

+ Here is the caller graph for this function:

◆ fss_fl_chunk_bytes_sub()

static void fss_fl_chunk_bytes_sub ( fifo_segment_slice_t fss,
uword  size 
)
inlinestatic

Definition at line 286 of file fifo_segment.c.

+ Here is the caller graph for this function:

◆ pfss_fifo_add_active_list()

static void pfss_fifo_add_active_list ( fifo_slice_private_t pfss,
svm_fifo_t f 
)
inlinestatic

Definition at line 249 of file fifo_segment.c.

+ Here is the caller graph for this function:

◆ pfss_fifo_del_active_list()

static void pfss_fifo_del_active_list ( fifo_slice_private_t pfss,
svm_fifo_t f 
)
inlinestatic

Definition at line 260 of file fifo_segment.c.

+ Here is the caller graph for this function:

Variable Documentation

◆ fifo_segment_mem_status_strings

char* fifo_segment_mem_status_strings[]
static
Initial value:
= {
#define _(sym,str)
}

Definition at line 62 of file fifo_segment.c.

foreach_segment_mem_status
#define foreach_segment_mem_status
Definition: fifo_segment.h:43