15 #ifndef SRC_VNET_SESSION_SEGMENT_MANAGER_H_ 16 #define SRC_VNET_SESSION_SEGMENT_MANAGER_H_ 23 typedef struct _segment_manager_props
38 typedef struct _segment_manager
54 u8 first_is_protected;
68 #define SEGMENT_MANAGER_INVALID_APP_INDEX ((u32) ~0) 72 u32 prealloc_fifo_pairs);
112 u32 rx_fifo_size,
u32 tx_fifo_size,
void segment_manager_free(segment_manager_t *sm)
Cleanup segment manager.
u32 segment_manager_index(segment_manager_t *sm)
int segment_manager_init(segment_manager_t *sm, u32 first_seg_size, u32 prealloc_fifo_pairs)
Initializes segment manager based on options provided.
struct segment_manager_main_init_args_ segment_manager_main_init_args_t
fifo_segment_t * segment_manager_get_segment_w_handle(u64 sh)
u8 segment_manager_has_fifos(segment_manager_t *sm)
segment_manager_t * segment_manager_get(u32 index)
struct _svm_fifo svm_fifo_t
void segment_manager_segment_reader_unlock(segment_manager_t *sm)
int segment_manager_try_alloc_fifos(fifo_segment_t *fs, u32 rx_fifo_size, u32 tx_fifo_size, svm_fifo_t **rx_fifo, svm_fifo_t **tx_fifo)
enum ssvm_segment_type_ ssvm_segment_type_t
segment_manager_props_t * segment_manager_props_init(segment_manager_props_t *sm)
void segment_manager_app_detach(segment_manager_t *sm)
int segment_manager_add_first_segment(segment_manager_t *sm, u32 segment_size)
Simple first-fit virtual space allocator.
segment_manager_t * segment_manager_alloc(void)
segment_manager_t * segment_manager_get_if_valid(u32 index)
int segment_manager_shrink_fifo(segment_manager_t *sm, svm_fifo_t *f, u32 size, u8 is_producer)
Request to shrink fifo owned by segment manager.
u32 segment_manager_evt_q_expected_size(u32 q_size)
svm_msg_q_t * segment_manager_event_queue(segment_manager_t *sm)
u64 segment_manager_make_segment_handle(u32 segment_manager_index, u32 segment_index)
svm_msg_q_t * segment_manager_alloc_queue(fifo_segment_t *fs, segment_manager_props_t *props)
Allocates shm queue in the first segment.
void segment_manager_dealloc_fifos(svm_fifo_t *rx_fifo, svm_fifo_t *tx_fifo)
int segment_manager_add_segment(segment_manager_t *sm, u32 segment_size)
Adds segment to segment manager's pool.
struct _segment_manager_props segment_manager_props_t
void segment_manager_del_segment(segment_manager_t *sm, fifo_segment_t *fs)
Remove segment without lock.
fifo_segment_t * segment_manager_get_segment(segment_manager_t *sm, u32 segment_index)
Reads a segment from the segment manager's pool without lock.
int segment_manager_alloc_session_fifos(segment_manager_t *sm, svm_fifo_t **rx_fifo, svm_fifo_t **tx_fifo)
Unidirectional shared-memory multi-ring message queue.
int segment_manager_collect_fifo_chunks(segment_manager_t *sm, svm_fifo_t *f)
Collect fifo chunks that are no longer used.
void segment_manager_segment_writer_unlock(segment_manager_t *sm)
u64 segment_manager_segment_handle(segment_manager_t *sm, fifo_segment_t *segment)
struct _segment_manager segment_manager_t
struct _svm_queue svm_queue_t
void segment_manager_dealloc_queue(segment_manager_t *sm, svm_queue_t *q)
Frees shm queue allocated in the first segment.
void segment_manager_init_free(segment_manager_t *sm)
Initiate segment manager cleanup.
static void add_segment(mstate m, char *tbase, size_t tsize, flag_t mmapped)
void segment_manager_format_sessions(segment_manager_t *sm, int verbose)
int segment_manager_grow_fifo(segment_manager_t *sm, svm_fifo_t *f, u32 size)
Grows fifo owned by segment manager.
fifo_segment_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.
void segment_manager_main_init(segment_manager_main_init_args_t *a)
void segment_manager_del_sessions(segment_manager_t *sm)
Cleanup segment manager sessions.