X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvnet%2Fsession%2Fsegment_manager.h;h=cd02d5480ae006d235a5ad2b7b4ccc890fcf7b4d;hb=07063b8ea;hp=b40926091c40e98be2c60863cec0dac275a83572;hpb=ef4f3e7fea359f651c548182a7597abc066ca372;p=vpp.git diff --git a/src/vnet/session/segment_manager.h b/src/vnet/session/segment_manager.h index b40926091c4..cd02d5480ae 100644 --- a/src/vnet/session/segment_manager.h +++ b/src/vnet/session/segment_manager.h @@ -19,6 +19,7 @@ #include #include #include +#include typedef struct _segment_manager_props { @@ -34,6 +35,10 @@ typedef struct _segment_manager_props u8 n_slices; /**< number of fs slices/threads */ ssvm_segment_type_t segment_type; /**< seg type: if set to SSVM_N_TYPES, private segments are used */ + u32 max_fifo_size; /**< max fifo size */ + u8 high_watermark; /**< memory usage high watermark % */ + u8 low_watermark; /**< memory usage low watermark % */ + u8 pct_first_alloc; /**< pct of fifo size to alloc */ } segment_manager_props_t; typedef struct _segment_manager @@ -58,6 +63,10 @@ typedef struct _segment_manager * App event queue allocated in first segment */ svm_msg_q_t *event_queue; + + u32 max_fifo_size; + u8 high_watermark; + u8 low_watermark; } segment_manager_t; typedef struct segment_manager_main_init_args_ @@ -69,8 +78,7 @@ typedef struct segment_manager_main_init_args_ #define SEGMENT_MANAGER_INVALID_APP_INDEX ((u32) ~0) segment_manager_t *segment_manager_alloc (void); -int segment_manager_init (segment_manager_t * sm, uword first_seg_size, - u32 prealloc_fifo_pairs); +int segment_manager_init (segment_manager_t * sm); /** * Cleanup segment manager @@ -118,50 +126,9 @@ int segment_manager_try_alloc_fifos (fifo_segment_t * fs, void segment_manager_dealloc_fifos (svm_fifo_t * rx_fifo, svm_fifo_t * tx_fifo); -/** - * Grows fifo owned by segment manager - * - * @param sm segment manager that owns the fifo - * @param f fifo to be grown - * @param size amount of bytes to add to fifo - * @return 0 on success, negative number otherwise - */ -int segment_manager_grow_fifo (segment_manager_t * sm, svm_fifo_t * f, - u32 size); - -/** - * Request to shrink fifo owned by segment manager - * - * If this is not called by the producer, no attempt is made to reduce the - * size until the producer tries to enqueue more data. To collect the chunks - * that are to be removed call @ref segment_manager_collect_fifo_chunks - * - * Size reduction does not affect fifo chunk boundaries. Therefore chunks are - * not split and the amount of bytes to be removed can be equal to or less - * than what was requested. - * - * @param sm segment manager that owns the fifo - * @param f fifo to be shrunk - * @param size amount of bytes to remove from fifo - * @param is_producer flag that indicates is caller is the producer for the - * fifo. - * @return actual number of bytes to be removed - */ -int segment_manager_shrink_fifo (segment_manager_t * sm, svm_fifo_t * f, - u32 size, u8 is_producer); +void segment_manager_set_watermarks (segment_manager_t * sm, + u8 high_watermark, u8 low_watermark); -/** - * Collect fifo chunks that are no longer used - * - * This should not be called unless SVM_FIFO_F_COLLECT_CHUNKS is set for - * the fifo. The chunks are returned to the fifo segment freelist. - * - * @param sm segment manager that owns the fifo - * @param f fifo whose chunks are to be collected - * @return 0 on success, error otherwise - */ -int segment_manager_collect_fifo_chunks (segment_manager_t * sm, - svm_fifo_t * f); u8 segment_manager_has_fifos (segment_manager_t * sm); svm_msg_q_t *segment_manager_alloc_queue (fifo_segment_t * fs,