diff options
author | Florin Coras <fcoras@cisco.com> | 2019-12-19 16:10:58 -0800 |
---|---|---|
committer | Dave Barach <openvpp@barachs.net> | 2020-02-25 19:18:49 +0000 |
commit | f22f4e562e1b922cff036ef628b77fd2d479d015 (patch) | |
tree | 4cbc3091a5ce89a73c94685dcee198dd583ca375 /src/vnet/session/segment_manager.h | |
parent | b020806806c0e6c54886cdb4347a5fd1f19504b0 (diff) |
svm: refactor fifo
Type: refactor
Switch from a wrapped byte space to a "continuous" one wherein fifo
chunks are appended to the fifo as more data is enqueued and chunks are
removed as data is dequeued.
The fifo is still subject to a maximum size, i.e., maximum number of
bytes that can be enqueued, so the max number of chunks associated to
the fifo is also constrained.
When enqueueing data, which must fit within the available free space, if
not enough "supporting" chunk memory is available, the fifo asks the
fifo segment for enough chunk memory to ensure that the write can
succeed. To avoid allocating large amounts of small chunks due to small
writes, if possible, the size of the chunks requested is lower capped by
min_alloc.
When dequeuing data, all the chunks that have been completely drained,
i.e., head moved beyond the chunks’ end bytes, are unlinked from the
fifo and returned to the fifo segment. The one exception to this is the
last chunk which is never unlinked.
Change-Id: I98c1dbd9135fb79650365c7e40c29238b96cd4ee
Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/vnet/session/segment_manager.h')
-rw-r--r-- | src/vnet/session/segment_manager.h | 44 |
1 files changed, 0 insertions, 44 deletions
diff --git a/src/vnet/session/segment_manager.h b/src/vnet/session/segment_manager.h index b40926091c4..52f89eef171 100644 --- a/src/vnet/session/segment_manager.h +++ b/src/vnet/session/segment_manager.h @@ -118,50 +118,6 @@ 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); - -/** - * 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, |