aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/session
diff options
context:
space:
mode:
authorFilip Tehlar <ftehlar@cisco.com>2021-11-24 10:30:59 +0000
committerFilip Tehlar <ftehlar@cisco.com>2021-11-24 19:48:52 +0000
commit2711ca710affe0c52bf63e08e0cf0588094e6198 (patch)
tree14226994c19666bef5b3c25826ee84f9935cf6ba /src/vnet/session
parent32c7335ea9da8470041be2f155afba77985809db (diff)
session: improve fifo segment allocation
This patch ensures that fifo segment has at least the size that was requested during allocation. Type: improvement Signed-off-by: Filip Tehlar <ftehlar@cisco.com> Change-Id: Iea8a885ac290183e25e5c8f9163bba226c5efa15
Diffstat (limited to 'src/vnet/session')
-rw-r--r--src/vnet/session/segment_manager.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/vnet/session/segment_manager.c b/src/vnet/session/segment_manager.c
index e04f626eab2..a55f7d3472c 100644
--- a/src/vnet/session/segment_manager.c
+++ b/src/vnet/session/segment_manager.c
@@ -119,6 +119,12 @@ segment_manager_add_segment_inline (segment_manager_t *sm, uword segment_size,
* Allocate ssvm segment
*/
segment_size = segment_size ? segment_size : props->add_segment_size;
+ /* add overhead to ensure the result segment size is at least
+ * of that requested */
+ segment_size +=
+ sizeof (fifo_segment_header_t) +
+ vlib_thread_main.n_vlib_mains * sizeof (fifo_segment_slice_t) +
+ FIFO_SEGMENT_ALLOC_OVERHEAD;
segment_size = round_pow2 (segment_size, clib_mem_get_page_size ());
if (props->segment_type != SSVM_SEGMENT_PRIVATE)