FD.io VPP  v19.04.4-rc0-5-ge88582fac
Vector Packet Processing
segment_manager.c File Reference
+ Include dependency graph for segment_manager.c:

Go to the source code of this file.

Functions

segment_manager_properties_tsegment_manager_properties_get (segment_manager_t *sm)
 
segment_manager_properties_tsegment_manager_properties_init (segment_manager_properties_t *props)
 
static u8 segment_manager_app_detached (segment_manager_t *sm)
 
void segment_manager_app_detach (segment_manager_t *sm)
 
static u32 segment_manager_segment_index (segment_manager_t *sm, svm_fifo_segment_private_t *seg)
 
void segment_manager_del_segment (segment_manager_t *sm, svm_fifo_segment_private_t *fs)
 Remove segment without lock. More...
 
static void segment_manager_lock_and_del_segment (segment_manager_t *sm, u32 fs_index)
 Removes segment after acquiring writer lock. More...
 
svm_fifo_segment_private_tsegment_manager_get_segment (segment_manager_t *sm, u32 segment_index)
 Reads a segment from the segment manager's pool without lock. More...
 
u64 segment_manager_segment_handle (segment_manager_t *sm, svm_fifo_segment_private_t *segment)
 
void segment_manager_parse_segment_handle (u64 segment_handle, u32 *sm_index, u32 *segment_index)
 
svm_fifo_segment_private_tsegment_manager_get_segment_w_handle (u64 segment_handle)
 
svm_fifo_segment_private_tsegment_manager_get_segment_w_lock (segment_manager_t *sm, u32 segment_index)
 Reads a segment from the segment manager's pool and acquires reader lock. More...
 
void segment_manager_segment_reader_unlock (segment_manager_t *sm)
 
void segment_manager_segment_writer_unlock (segment_manager_t *sm)
 
int segment_manager_add_segment (segment_manager_t *sm, u32 segment_size)
 Adds segment to segment manager's pool. More...
 
segment_manager_tsegment_manager_new ()
 
int segment_manager_init (segment_manager_t *sm, u32 first_seg_size, u32 prealloc_fifo_pairs)
 Initializes segment manager based on options provided. More...
 
u8 segment_manager_has_fifos (segment_manager_t *sm)
 
void segment_manager_del_sessions (segment_manager_t *sm)
 Initiate disconnects for all sessions 'owned' by a segment manager. More...
 
void segment_manager_del (segment_manager_t *sm)
 Removes segment manager. More...
 
void segment_manager_init_del (segment_manager_t *sm)
 
int segment_manager_try_alloc_fifos (svm_fifo_segment_private_t *fifo_segment, u32 rx_fifo_size, u32 tx_fifo_size, svm_fifo_t **rx_fifo, svm_fifo_t **tx_fifo)
 
int segment_manager_alloc_session_fifos (segment_manager_t *sm, svm_fifo_t **rx_fifo, svm_fifo_t **tx_fifo, u32 *fifo_segment_index)
 
void segment_manager_dealloc_fifos (svm_fifo_t *rx_fifo, svm_fifo_t *tx_fifo)
 
u32 segment_manager_evt_q_expected_size (u32 q_len)
 
svm_msg_q_tsegment_manager_alloc_queue (svm_fifo_segment_private_t *segment, segment_manager_properties_t *props)
 Allocates shm queue in the first segment. More...
 
void segment_manager_dealloc_queue (segment_manager_t *sm, svm_queue_t *q)
 Frees shm queue allocated in the first segment. More...
 
void segment_manager_main_init (segment_manager_main_init_args_t *a)
 
static clib_error_tsegment_manager_show_fn (vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)
 

Variables

segment_manager_main_t segment_manager_main
 
static u32 segment_name_counter = 0
 Counter used to build segment names. More...
 
static u32 default_fifo_size = 1 << 12
 Default fifo and segment size. More...
 
static u32 default_segment_size = 1 << 20
 
static u32 default_app_evt_queue_size = 128
 
static vlib_cli_command_t segment_manager_show_command
 (constructor) VLIB_CLI_COMMAND (segment_manager_show_command) More...
 

Function Documentation

◆ segment_manager_add_segment()

int segment_manager_add_segment ( segment_manager_t sm,
u32  segment_size 
)

Adds segment to segment manager's pool.

If needed a writer's lock is acquired before allocating a new segment to avoid affecting any of the segments pool readers.

Definition at line 195 of file segment_manager.c.

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

◆ segment_manager_alloc_queue()

svm_msg_q_t* segment_manager_alloc_queue ( svm_fifo_segment_private_t segment,
segment_manager_properties_t props 
)

Allocates shm queue in the first segment.

Must be called with lock held

Definition at line 673 of file segment_manager.c.

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

◆ segment_manager_alloc_session_fifos()

int segment_manager_alloc_session_fifos ( segment_manager_t sm,
svm_fifo_t **  rx_fifo,
svm_fifo_t **  tx_fifo,
u32 fifo_segment_index 
)

Definition at line 515 of file segment_manager.c.

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

◆ segment_manager_app_detach()

void segment_manager_app_detach ( segment_manager_t sm)

Definition at line 58 of file segment_manager.c.

+ Here is the caller graph for this function:

◆ segment_manager_app_detached()

static u8 segment_manager_app_detached ( segment_manager_t sm)
static

Definition at line 52 of file segment_manager.c.

+ Here is the caller graph for this function:

◆ segment_manager_dealloc_fifos()

void segment_manager_dealloc_fifos ( svm_fifo_t rx_fifo,
svm_fifo_t tx_fifo 
)

Definition at line 604 of file segment_manager.c.

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

◆ segment_manager_dealloc_queue()

void segment_manager_dealloc_queue ( segment_manager_t sm,
svm_queue_t q 
)

Frees shm queue allocated in the first segment.

Definition at line 710 of file segment_manager.c.

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

◆ segment_manager_del()

void segment_manager_del ( segment_manager_t sm)

Removes segment manager.

Since the fifos allocated in the segment keep backpointers to the sessions prior to removing the segment, we call session disconnect. This subsequently propagates into transport.

Definition at line 435 of file segment_manager.c.

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

◆ segment_manager_del_segment()

void segment_manager_del_segment ( segment_manager_t sm,
svm_fifo_segment_private_t fs 
)

Remove segment without lock.

Definition at line 74 of file segment_manager.c.

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

◆ segment_manager_del_sessions()

void segment_manager_del_sessions ( segment_manager_t sm)

Initiate disconnects for all sessions 'owned' by a segment manager.

Definition at line 389 of file segment_manager.c.

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

◆ segment_manager_evt_q_expected_size()

u32 segment_manager_evt_q_expected_size ( u32  q_len)

Definition at line 651 of file segment_manager.c.

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

◆ segment_manager_get_segment()

svm_fifo_segment_private_t* segment_manager_get_segment ( segment_manager_t sm,
u32  segment_index 
)

Reads a segment from the segment manager's pool without lock.

Definition at line 126 of file segment_manager.c.

+ Here is the caller graph for this function:

◆ segment_manager_get_segment_w_handle()

svm_fifo_segment_private_t* segment_manager_get_segment_w_handle ( u64  segment_handle)

Definition at line 148 of file segment_manager.c.

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

◆ segment_manager_get_segment_w_lock()

svm_fifo_segment_private_t* segment_manager_get_segment_w_lock ( segment_manager_t sm,
u32  segment_index 
)

Reads a segment from the segment manager's pool and acquires reader lock.

Caller must drop the reader's lock by calling segment_manager_segment_reader_unlock once it finishes working with the segment.

Definition at line 169 of file segment_manager.c.

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

◆ segment_manager_has_fifos()

u8 segment_manager_has_fifos ( segment_manager_t sm)

Definition at line 360 of file segment_manager.c.

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

◆ segment_manager_init()

int segment_manager_init ( segment_manager_t sm,
u32  first_seg_size,
u32  prealloc_fifo_pairs 
)

Initializes segment manager based on options provided.

Returns error if ssvm segment(s) allocation fails.

Definition at line 291 of file segment_manager.c.

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

◆ segment_manager_init_del()

void segment_manager_init_del ( segment_manager_t sm)

Definition at line 464 of file segment_manager.c.

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

◆ segment_manager_lock_and_del_segment()

static void segment_manager_lock_and_del_segment ( segment_manager_t sm,
u32  fs_index 
)
inlinestatic

Removes segment after acquiring writer lock.

Definition at line 104 of file segment_manager.c.

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

◆ segment_manager_main_init()

void segment_manager_main_init ( segment_manager_main_init_args_t a)

Definition at line 731 of file segment_manager.c.

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

◆ segment_manager_new()

segment_manager_t* segment_manager_new ( )

Definition at line 276 of file segment_manager.c.

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

◆ segment_manager_parse_segment_handle()

void segment_manager_parse_segment_handle ( u64  segment_handle,
u32 sm_index,
u32 segment_index 
)

Definition at line 140 of file segment_manager.c.

+ Here is the caller graph for this function:

◆ segment_manager_properties_get()

segment_manager_properties_t* segment_manager_properties_get ( segment_manager_t sm)

Definition at line 35 of file segment_manager.c.

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

◆ segment_manager_properties_init()

segment_manager_properties_t* segment_manager_properties_init ( segment_manager_properties_t props)

Definition at line 42 of file segment_manager.c.

+ Here is the caller graph for this function:

◆ segment_manager_segment_handle()

u64 segment_manager_segment_handle ( segment_manager_t sm,
svm_fifo_segment_private_t segment 
)

Definition at line 132 of file segment_manager.c.

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

◆ segment_manager_segment_index()

static u32 segment_manager_segment_index ( segment_manager_t sm,
svm_fifo_segment_private_t seg 
)
inlinestatic

Definition at line 64 of file segment_manager.c.

+ Here is the caller graph for this function:

◆ segment_manager_segment_reader_unlock()

void segment_manager_segment_reader_unlock ( segment_manager_t sm)

Definition at line 176 of file segment_manager.c.

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

◆ segment_manager_segment_writer_unlock()

void segment_manager_segment_writer_unlock ( segment_manager_t sm)

Definition at line 183 of file segment_manager.c.

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

◆ segment_manager_show_fn()

static clib_error_t* segment_manager_show_fn ( vlib_main_t vm,
unformat_input_t input,
vlib_cli_command_t cmd 
)
static

Definition at line 743 of file segment_manager.c.

+ Here is the call graph for this function:

◆ segment_manager_try_alloc_fifos()

int segment_manager_try_alloc_fifos ( svm_fifo_segment_private_t fifo_segment,
u32  rx_fifo_size,
u32  tx_fifo_size,
svm_fifo_t **  rx_fifo,
svm_fifo_t **  tx_fifo 
)

Definition at line 477 of file segment_manager.c.

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

Variable Documentation

◆ default_app_evt_queue_size

u32 default_app_evt_queue_size = 128
static

Definition at line 32 of file segment_manager.c.

◆ default_fifo_size

u32 default_fifo_size = 1 << 12
static

Default fifo and segment size.

TODO config.

Definition at line 30 of file segment_manager.c.

◆ default_segment_size

u32 default_segment_size = 1 << 20
static

Definition at line 31 of file segment_manager.c.

◆ segment_manager_main

segment_manager_main_t segment_manager_main

Definition at line 20 of file segment_manager.c.

◆ segment_manager_show_command

vlib_cli_command_t segment_manager_show_command
static
Initial value:
=
{
.path = "show segment-manager",
.short_help = "show segment-manager [segments][verbose]",
}
static clib_error_t * segment_manager_show_fn(vlib_main_t *vm, unformat_input_t *input, vlib_cli_command_t *cmd)

(constructor) VLIB_CLI_COMMAND (segment_manager_show_command)

Definition at line 806 of file segment_manager.c.

◆ segment_name_counter

u32 segment_name_counter = 0
static

Counter used to build segment names.

Definition at line 25 of file segment_manager.c.