summaryrefslogtreecommitdiffstats
path: root/src/vcl
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2018-01-31 06:52:17 -0800
committerDave Barach <openvpp@barachs.net>2018-02-05 21:45:28 +0000
commita332c46a51f9b4e13963340dfee1318e7513c124 (patch)
treefde1056972c5b164987bd15ce0530a3d48d1bbd7 /src/vcl
parente71eb5922a293eca36dbd323970741daaca3c5c7 (diff)
session: segment manager refactor
- use valloc as a 'central' segment baseva manager - use per segment manager segment pools and use rwlocks to guard them - add session test that exercises segment creation - embed segment manager properties into application since they're shared - fix rw locks Change-Id: I761164c147275d9e8a926f1eda395e090d231f9a Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/vcl')
-rw-r--r--src/vcl/vppcom.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/vcl/vppcom.c b/src/vcl/vppcom.c
index 167a74591e7..dd7e90e2a99 100644
--- a/src/vcl/vppcom.c
+++ b/src/vcl/vppcom.c
@@ -2304,8 +2304,8 @@ vppcom_app_create (char *app_name)
clib_time_init (&vcm->clib_time);
vppcom_init_error_string_table ();
- svm_fifo_segment_init (vcl_cfg->segment_baseva,
- 20 /* timeout in secs */ );
+ svm_fifo_segment_main_init (vcl_cfg->segment_baseva,
+ 20 /* timeout in secs */ );
clib_spinlock_init (&vcm->sessions_lockp);
}
@@ -2722,7 +2722,7 @@ vppcom_session_accept (uint32_t listen_session_index, vppcom_endpt_t * ep,
{
session_t *listen_session = 0;
session_t *client_session = 0;
- u32 client_session_index = ~0;
+ u32 client_session_index = ~0, n_fifos;
int rv;
f64 wait_for;
char *cut_thru_str;
@@ -2821,9 +2821,6 @@ vppcom_session_accept (uint32_t listen_session_index, vppcom_endpt_t * ep,
format ((u8 *) a->segment_name, "%d:segment%d%c",
getpid (), vcm->unique_segment_index++, 0);
a->segment_size = vcm->cfg.segment_size;
- a->preallocated_fifo_pairs = vcm->cfg.preallocated_fifo_pairs;
- a->rx_fifo_size = vcm->cfg.rx_fifo_size;
- a->tx_fifo_size = vcm->cfg.tx_fifo_size;
rv = svm_fifo_segment_create (a);
if (PREDICT_FALSE (rv))
@@ -2850,6 +2847,14 @@ vppcom_session_accept (uint32_t listen_session_index, vppcom_endpt_t * ep,
vec_free (a->new_segment_indices);
seg = svm_fifo_segment_get_segment (client_session->sm_seg_index);
+ if (vcm->cfg.preallocated_fifo_pairs)
+ {
+ n_fifos = vcm->cfg.preallocated_fifo_pairs;
+ svm_fifo_segment_preallocate_fifo_pairs (seg, vcm->cfg.rx_fifo_size,
+ vcm->cfg.tx_fifo_size,
+ &n_fifos);
+ }
+
client_session->server_rx_fifo =
svm_fifo_segment_alloc_fifo (seg, vcm->cfg.rx_fifo_size,
FIFO_SEGMENT_RX_FREELIST);