diff options
author | Florin Coras <fcoras@cisco.com> | 2023-06-01 21:50:03 -0700 |
---|---|---|
committer | Andrew Yourtchenko <ayourtch@gmail.com> | 2023-06-13 12:50:09 +0000 |
commit | fcbf306cf3c8e530117e6f77fd477afb21b62e51 (patch) | |
tree | 40f5e51b88b61d0aaf1d3b4b4f43576eafe1034c /src/vcl | |
parent | 16912d23abaa652ac6fe00b1af9b4f09c728b3b1 (diff) |
vcl: fix epoll ctl frequent deq ntf requests
SVM_FIFO_WANT_DEQ_NOTIF_IF_FULL should be treated as a
config option that is not frequently changed. Or alternatively, it
should be set together with SVM_FIFO_WANT_DEQ_NOTIF to elicit a one time
tx notification.
Type: fix
Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: Ie4132c7789ee87227a875ff981eb98f9f4d898a9
(cherry picked from commit 470d72f54abbd3e34053cc4f4e281593faf0fb77)
Diffstat (limited to 'src/vcl')
-rw-r--r-- | src/vcl/vppcom.c | 48 |
1 files changed, 30 insertions, 18 deletions
diff --git a/src/vcl/vppcom.c b/src/vcl/vppcom.c index 474670e7565..f2166f851ae 100644 --- a/src/vcl/vppcom.c +++ b/src/vcl/vppcom.c @@ -2868,15 +2868,22 @@ vppcom_epoll_ctl (uint32_t vep_handle, int op, uint32_t session_handle, s->flags |= VCL_SESSION_F_IS_VEP_SESSION; vep_session->vep.next_sh = session_handle; - if (event->events & EPOLLOUT) - vcl_session_add_want_deq_ntf (s, SVM_FIFO_WANT_DEQ_NOTIF_IF_FULL); - - /* Generate EPOLLOUT if tx fifo not full */ - if ((event->events & EPOLLOUT) && (vcl_session_write_ready (s) > 0)) + if ((event->events & EPOLLOUT)) { - vcl_epoll_ctl_add_unhandled_event (wrk, s, event->events & EPOLLET, - SESSION_IO_EVT_TX); - add_evt = 1; + int write_ready = vcl_session_write_ready (s); + + vcl_session_add_want_deq_ntf (s, SVM_FIFO_WANT_DEQ_NOTIF_IF_FULL); + if (write_ready > 0) + { + /* Generate EPOLLOUT if tx fifo not full */ + vcl_epoll_ctl_add_unhandled_event ( + wrk, s, event->events & EPOLLET, SESSION_IO_EVT_TX); + add_evt = 1; + } + else + { + vcl_session_add_want_deq_ntf (s, SVM_FIFO_WANT_DEQ_NOTIF); + } } /* Generate EPOLLIN if rx fifo has data */ if ((event->events & EPOLLIN) && (vcl_session_read_ready (s) > 0)) @@ -2922,18 +2929,23 @@ vppcom_epoll_ctl (uint32_t vep_handle, int op, uint32_t session_handle, goto done; } - if (event->events & EPOLLOUT) - vcl_session_add_want_deq_ntf (s, SVM_FIFO_WANT_DEQ_NOTIF_IF_FULL); - else - vcl_session_del_want_deq_ntf (s, SVM_FIFO_WANT_DEQ_NOTIF_IF_FULL); - - /* Generate EPOLLOUT if session write ready nd event was not on */ - if ((event->events & EPOLLOUT) && !(s->vep.ev.events & EPOLLOUT) && - (vcl_session_write_ready (s) > 0)) + /* Generate EPOLLOUT if session write ready and event was not on */ + if ((event->events & EPOLLOUT) && !(s->vep.ev.events & EPOLLOUT)) { - vcl_epoll_ctl_add_unhandled_event (wrk, s, event->events & EPOLLET, - SESSION_IO_EVT_TX); + /* Fifo size load acq synchronized with update store rel */ + int write_ready = vcl_session_write_ready (s); + + vcl_session_add_want_deq_ntf (s, SVM_FIFO_WANT_DEQ_NOTIF_IF_FULL); + if (write_ready > 0) + vcl_epoll_ctl_add_unhandled_event (wrk, s, event->events & EPOLLET, + SESSION_IO_EVT_TX); + else + /* Request deq ntf in case dequeue happened while updating flag */ + vcl_session_add_want_deq_ntf (s, SVM_FIFO_WANT_DEQ_NOTIF); } + else if (!(event->events & EPOLLOUT)) + vcl_session_del_want_deq_ntf (s, SVM_FIFO_WANT_DEQ_NOTIF_IF_FULL); + /* 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)) |