aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2023-05-22 09:19:57 -0700
committerDave Wallace <dwallacelf@gmail.com>2023-05-23 17:34:50 +0000
commitdb3fbfca514e1fdc1530ed7ffe430fe26acdbb49 (patch)
treee2d499933589a141613a957e93a505ea4957a7ca
parent02063b985ac2fd3ce24a42fe9e27f434ea088053 (diff)
vcl: avoid reusing user provided events in lt mode
Epoll events might not have been cleared by user so always compute event flags locally and assign to user provided epoll event. Type: fix Signed-off-by: Ping Yu <ping.yu@intel.com> Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: I3b594a0fd7be345a0e0ad81d1d3636e9354cc15d
-rw-r--r--src/vcl/vppcom.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/vcl/vppcom.c b/src/vcl/vppcom.c
index 0b4d75765ea..ecbbf7a7d5f 100644
--- a/src/vcl/vppcom.c
+++ b/src/vcl/vppcom.c
@@ -3369,7 +3369,7 @@ static void
vcl_epoll_wait_handle_lt (vcl_worker_t *wrk, struct epoll_event *events,
int maxevents, u32 *n_evts)
{
- u32 add_event = 0, next, *to_remove = 0, *si;
+ u32 add_event = 0, evt_flags = 0, next, *to_remove = 0, *si;
vcl_session_t *s;
u64 evt_data;
int rv;
@@ -3387,26 +3387,28 @@ vcl_epoll_wait_handle_lt (vcl_worker_t *wrk, struct epoll_event *events,
if ((s->vep.ev.events & EPOLLIN) && (rv = vcl_session_read_ready (s)))
{
add_event = 1;
- events[*n_evts].events |= rv > 0 ? EPOLLIN : EPOLLHUP | EPOLLRDHUP;
+ evt_flags |= rv > 0 ? EPOLLIN : EPOLLHUP | EPOLLRDHUP;
evt_data = s->vep.ev.data.u64;
}
if ((s->vep.ev.events & EPOLLOUT) && (rv = vcl_session_write_ready (s)))
{
add_event = 1;
- events[*n_evts].events |= rv > 0 ? EPOLLOUT : EPOLLHUP | EPOLLRDHUP;
+ evt_flags |= rv > 0 ? EPOLLOUT : EPOLLHUP | EPOLLRDHUP;
evt_data = s->vep.ev.data.u64;
}
if (!add_event && s->session_state > VCL_STATE_READY)
{
add_event = 1;
- events[*n_evts].events |= EPOLLHUP | EPOLLRDHUP;
+ evt_flags |= EPOLLHUP | EPOLLRDHUP;
evt_data = s->vep.ev.data.u64;
}
if (add_event)
{
+ events[*n_evts].events = evt_flags;
events[*n_evts].data.u64 = evt_data;
*n_evts += 1;
add_event = 0;
+ evt_flags = 0;
if (EPOLLONESHOT & s->vep.ev.events)
s->vep.ev.events = 0;
if (*n_evts == maxevents)