summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2023-02-07 09:11:47 -0800
committerDave Barach <vpp@barachs.net>2023-02-28 17:50:34 +0000
commitb0116a13dcc631d5128209dec867c3fb5209629d (patch)
tree59ec6df480b48221b0b7b8962ec5bc9ba812100b
parentaf004ddad1231682d0a64ce9671e2619c2910c7a (diff)
vcl: handle lt events in epoll ctl
Type: fix Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I4e176e9ada32d5f61d10aeca1c68f72114dec9b8
-rw-r--r--src/vcl/vppcom.c44
1 files changed, 26 insertions, 18 deletions
diff --git a/src/vcl/vppcom.c b/src/vcl/vppcom.c
index 1b0da450781..e3fb14fa4e5 100644
--- a/src/vcl/vppcom.c
+++ b/src/vcl/vppcom.c
@@ -2755,6 +2755,24 @@ vppcom_epoll_create (void)
return vcl_session_handle (vep_session);
}
+static void
+vcl_epoll_ctl_add_unhandled_event (vcl_worker_t *wrk, vcl_session_t *s,
+ u8 is_epollet, session_evt_type_t evt)
+{
+ if (!is_epollet)
+ {
+ vcl_epoll_lt_add (wrk, s);
+ return;
+ }
+
+ session_event_t e = { 0 };
+ e.session_index = s->session_index;
+ e.event_type = evt;
+ if (evt == SESSION_IO_EVT_RX)
+ s->flags &= ~VCL_SESSION_F_HAS_RX_EVT;
+ vec_add1 (wrk->unhandled_evts_vector, e);
+}
+
int
vppcom_epoll_ctl (uint32_t vep_handle, int op, uint32_t session_handle,
struct epoll_event *event)
@@ -2843,20 +2861,15 @@ vppcom_epoll_ctl (uint32_t vep_handle, int op, uint32_t session_handle,
/* Generate EPOLLOUT if tx fifo not full */
if ((event->events & EPOLLOUT) && (vcl_session_write_ready (s) > 0))
{
- session_event_t e = { 0 };
- e.event_type = SESSION_IO_EVT_TX;
- e.session_index = s->session_index;
- vec_add1 (wrk->unhandled_evts_vector, e);
+ vcl_epoll_ctl_add_unhandled_event (wrk, s, event->events & EPOLLET,
+ SESSION_IO_EVT_TX);
add_evt = 1;
}
/* Generate EPOLLIN if rx fifo has data */
if ((event->events & EPOLLIN) && (vcl_session_read_ready (s) > 0))
{
- session_event_t e = { 0 };
- e.event_type = SESSION_IO_EVT_RX;
- e.session_index = s->session_index;
- vec_add1 (wrk->unhandled_evts_vector, e);
- s->flags &= ~VCL_SESSION_F_HAS_RX_EVT;
+ vcl_epoll_ctl_add_unhandled_event (wrk, s, event->events & EPOLLET,
+ SESSION_IO_EVT_RX);
add_evt = 1;
}
if (!add_evt && vcl_session_is_closing (s))
@@ -2900,20 +2913,15 @@ vppcom_epoll_ctl (uint32_t vep_handle, int op, uint32_t session_handle,
if ((event->events & EPOLLOUT) && !(s->vep.ev.events & EPOLLOUT) &&
(vcl_session_write_ready (s) > 0))
{
- session_event_t e = { 0 };
- e.event_type = SESSION_IO_EVT_TX;
- e.session_index = s->session_index;
- vec_add1 (wrk->unhandled_evts_vector, e);
+ vcl_epoll_ctl_add_unhandled_event (wrk, s, event->events & EPOLLET,
+ SESSION_IO_EVT_TX);
}
/* Generate EPOLLIN if session read ready and event was not on */
if ((event->events & EPOLLIN) && !(s->vep.ev.events & EPOLLIN) &&
(vcl_session_read_ready (s) > 0))
{
- session_event_t e = { 0 };
- e.event_type = SESSION_IO_EVT_RX;
- e.session_index = s->session_index;
- vec_add1 (wrk->unhandled_evts_vector, e);
- s->flags &= ~VCL_SESSION_F_HAS_RX_EVT;
+ vcl_epoll_ctl_add_unhandled_event (wrk, s, event->events & EPOLLET,
+ SESSION_IO_EVT_RX);
}
s->vep.et_mask = VEP_DEFAULT_ET_MASK;
s->vep.ev = *event;