summaryrefslogtreecommitdiffstats
path: root/src/vnet/session/segment_manager.c
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2019-05-03 11:46:55 -0700
committerFlorin Coras <florin.coras@gmail.com>2019-05-03 20:27:45 +0000
commit344ce4277885e448912fdfc35bcfaf130c74d086 (patch)
treee2ecaf3ad0c4ca224a32815af44ffd781bcfae5d /src/vnet/session/segment_manager.c
parenta7570b0378b071129937a89a5632011a962cdb43 (diff)
session/svm: apis for fifo shrinking
Change-Id: Ie519683bb90aae6fb95f2a09e251cded1890ed41 Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/vnet/session/segment_manager.c')
-rw-r--r--src/vnet/session/segment_manager.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/vnet/session/segment_manager.c b/src/vnet/session/segment_manager.c
index 9a8af3b42fc..6213cd517f6 100644
--- a/src/vnet/session/segment_manager.c
+++ b/src/vnet/session/segment_manager.c
@@ -682,6 +682,37 @@ segment_manager_grow_fifo (segment_manager_t * sm, svm_fifo_t * f, u32 size)
return rv;
}
+int
+segment_manager_collect_fifo_chunks (segment_manager_t * sm, svm_fifo_t * f)
+{
+ fifo_segment_t *fs;
+ int rv;
+
+ fs = segment_manager_get_segment_w_lock (sm, f->segment_index);
+ rv = fifo_segment_collect_fifo_chunks (fs, f);
+ segment_manager_segment_reader_unlock (sm);
+
+ return rv;
+}
+
+int
+segment_manager_shrink_fifo (segment_manager_t * sm, svm_fifo_t * f, u32 size,
+ u8 is_producer)
+{
+ int rv;
+
+ rv = svm_fifo_reduce_size (f, size, is_producer);
+
+ /* Nothing to collect at this point */
+ if (!is_producer)
+ return rv;
+
+ if (f->flags & SVM_FIFO_F_COLLECT_CHUNKS)
+ segment_manager_collect_fifo_chunks (sm, f);
+
+ return rv;
+}
+
u32
segment_manager_evt_q_expected_size (u32 q_len)
{