summaryrefslogtreecommitdiffstats
path: root/src/vnet/session/segment_manager.c
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2018-08-02 10:45:44 -0700
committerDave Barach <openvpp@barachs.net>2018-08-10 20:26:24 +0000
commit993683150202254c6ba8dd43e087a7229edd5d4c (patch)
tree141ce2cdfe546bfe2ad46e66ac9569a33a895072 /src/vnet/session/segment_manager.c
parentf46663c65b0238311af93fcfa3030eefdb56e299 (diff)
vcl: support for eventfd mq signaling
- support eventfd based mq signaling. Based on configuration, vcl epoll/select can use either condvars or epoll on mq eventfds. - add vcl support for memfd segments - vpp explicitly registers cut-through segments with apps/vcl - if using eventfd, make ldp allow one call to libc_epoll_create. Needed for the message queue epfd - update svm_queue_t to allow blocking calls with eventfd signaling. Change-Id: I064151ac370bbe29bb16c968bf4e3659c8286bea 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.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/src/vnet/session/segment_manager.c b/src/vnet/session/segment_manager.c
index c7d2482d6bf..6f149ad9412 100644
--- a/src/vnet/session/segment_manager.c
+++ b/src/vnet/session/segment_manager.c
@@ -88,7 +88,7 @@ segment_manager_del_segment (segment_manager_t * sm,
/**
* Removes segment after acquiring writer lock
*/
-always_inline void
+static inline void
segment_manager_lock_and_del_segment (segment_manager_t * sm, u32 fs_index)
{
svm_fifo_segment_private_t *fs;
@@ -290,8 +290,7 @@ segment_manager_init (segment_manager_t * sm, u32 first_seg_size,
segment = segment_manager_get_segment (sm, seg_index);
if (i == 0)
- sm->event_queue = segment_manager_alloc_queue (segment,
- props->evt_q_size);
+ sm->event_queue = segment_manager_alloc_queue (segment, props);
svm_fifo_segment_preallocate_fifo_pairs (segment,
props->rx_fifo_size,
@@ -311,8 +310,7 @@ segment_manager_init (segment_manager_t * sm, u32 first_seg_size,
return seg_index;
}
segment = segment_manager_get_segment (sm, seg_index);
- sm->event_queue = segment_manager_alloc_queue (segment,
- props->evt_q_size);
+ sm->event_queue = segment_manager_alloc_queue (segment, props);
}
return 0;
@@ -623,7 +621,7 @@ segment_manager_evt_q_expected_size (u32 q_len)
*/
svm_msg_q_t *
segment_manager_alloc_queue (svm_fifo_segment_private_t * segment,
- u32 queue_size)
+ segment_manager_properties_t * props)
{
u32 fifo_evt_size, session_evt_size = 256, notif_q_size;
svm_msg_q_cfg_t _cfg, *cfg = &_cfg;
@@ -631,21 +629,27 @@ segment_manager_alloc_queue (svm_fifo_segment_private_t * segment,
void *oldheap;
fifo_evt_size = sizeof (session_event_t);
- notif_q_size = clib_max (16, queue_size >> 4);
+ notif_q_size = clib_max (16, props->evt_q_size >> 4);
/* *INDENT-OFF* */
svm_msg_q_ring_cfg_t rc[SESSION_MQ_N_RINGS] = {
- {queue_size, fifo_evt_size, 0},
+ {props->evt_q_size, fifo_evt_size, 0},
{notif_q_size, session_evt_size, 0}
};
/* *INDENT-ON* */
cfg->consumer_pid = 0;
cfg->n_rings = 2;
- cfg->q_nitems = queue_size;
+ cfg->q_nitems = props->evt_q_size;
cfg->ring_cfgs = rc;
oldheap = ssvm_push_heap (segment->ssvm.sh);
q = svm_msg_q_alloc (cfg);
ssvm_pop_heap (oldheap);
+
+ if (props->use_mq_eventfd)
+ {
+ if (svm_msg_q_alloc_producer_eventfd (q))
+ clib_warning ("failed to alloc eventfd");
+ }
return q;
}