aboutsummaryrefslogtreecommitdiffstats
path: root/src/svm/message_queue.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/svm/message_queue.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/svm/message_queue.c')
-rw-r--r--src/svm/message_queue.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/svm/message_queue.c b/src/svm/message_queue.c
index e97cab898e8..d6a77e783e3 100644
--- a/src/svm/message_queue.c
+++ b/src/svm/message_queue.c
@@ -15,6 +15,7 @@
#include <svm/message_queue.h>
#include <vppinfra/mem.h>
+#include <sys/eventfd.h>
static inline svm_msg_q_ring_t *
svm_msg_q_ring_inline (svm_msg_q_t * mq, u32 ring_index)
@@ -235,6 +236,38 @@ svm_msg_q_sub_w_lock (svm_msg_q_t * mq, svm_msg_q_msg_t * msg)
svm_queue_sub_raw (mq->q, (u8 *) msg);
}
+void
+svm_msg_q_set_consumer_eventfd (svm_msg_q_t * mq, int fd)
+{
+ mq->q->consumer_evtfd = fd;
+}
+
+void
+svm_msg_q_set_producer_eventfd (svm_msg_q_t * mq, int fd)
+{
+ mq->q->producer_evtfd = fd;
+}
+
+int
+svm_msg_q_alloc_consumer_eventfd (svm_msg_q_t * mq)
+{
+ int fd;
+ if ((fd = eventfd (0, EFD_NONBLOCK)) < 0)
+ return -1;
+ svm_msg_q_set_consumer_eventfd (mq, fd);
+ return 0;
+}
+
+int
+svm_msg_q_alloc_producer_eventfd (svm_msg_q_t * mq)
+{
+ int fd;
+ if ((fd = eventfd (0, EFD_NONBLOCK)) < 0)
+ return -1;
+ svm_msg_q_set_producer_eventfd (mq, fd);
+ return 0;
+}
+
/*
* fd.io coding-style-patch-verification: ON
*