svm: refactor fifo 86/24086/65
authorFlorin Coras <fcoras@cisco.com>
Fri, 20 Dec 2019 00:10:58 +0000 (16:10 -0800)
committerDave Barach <openvpp@barachs.net>
Tue, 25 Feb 2020 19:18:49 +0000 (19:18 +0000)
commitf22f4e562e1b922cff036ef628b77fd2d479d015
tree4cbc3091a5ce89a73c94685dcee198dd583ca375
parentb020806806c0e6c54886cdb4347a5fd1f19504b0
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>
17 files changed:
src/plugins/hs_apps/proxy.c
src/plugins/quic/quic.c
src/plugins/tlsopenssl/tls_openssl.c
src/plugins/unittest/svm_fifo_test.c
src/svm/CMakeLists.txt
src/svm/fifo_segment.c
src/svm/fifo_segment.h
src/svm/fifo_types.h [new file with mode: 0644]
src/svm/svm_fifo.c
src/svm/svm_fifo.h
src/vcl/vppcom.c
src/vnet/session/application_local.c
src/vnet/session/segment_manager.c
src/vnet/session/segment_manager.h
src/vnet/session/session.h
src/vppinfra/rbtree.c
src/vppinfra/rbtree.h