summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorhanlin <hanlin_wang@163.com>2019-12-26 11:44:28 +0800
committerDave Wallace <dwallacelf@gmail.com>2020-08-12 14:37:52 +0000
commit6104daa550b702b59ac6764efba593261d68c743 (patch)
treecdc0cdb524898410aefb64b1447396bd161efa24 /src
parentc69b18f818410fa297b25ed961bd05f139643f4b (diff)
vcl: EPOLLOUT should be generated when epoll_ctl called with EPOLLOUT
event Type: fix When we call epoll_ctl to add or mod fd with EPOLLOUT event, mostly to check if we can write. So we expect a EPOLLOUT event should be generated immediately unless tx queue is full. Signed-off-by: hanlin <hanlin_wang@163.com> Change-Id: Ie99986a44dbb07b6ff2fba6512171056f79e77bd (cherry picked from commit 475c9d7bcd0f2ceca77022eaef67ad9a84365609)
Diffstat (limited to 'src')
-rw-r--r--src/vcl/vppcom.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/vcl/vppcom.c b/src/vcl/vppcom.c
index 52639c4e2b0..6be438c89eb 100644
--- a/src/vcl/vppcom.c
+++ b/src/vcl/vppcom.c
@@ -2475,6 +2475,15 @@ vppcom_epoll_ctl (uint32_t vep_handle, int op, uint32_t session_handle,
svm_fifo_add_want_deq_ntf (session->tx_fifo,
SVM_FIFO_WANT_DEQ_NOTIF_IF_FULL);
+ /* Generate EPOLLOUT when tx_fifo/ct_tx_fifo not full */
+ if ((event->events & EPOLLOUT) &&
+ (vcl_session_write_ready (session) > 0))
+ {
+ session_event_t e = { 0 };
+ e.event_type = SESSION_IO_EVT_TX;
+ e.session_index = session->session_index;
+ vec_add1 (wrk->unhandled_evts_vector, e);
+ }
VDBG (1, "EPOLL_CTL_ADD: vep_sh %u, sh %u, events 0x%x, data 0x%llx!",
vep_handle, session_handle, event->events, event->data.u64);
vcl_evt (VCL_EVT_EPOLL_CTLADD, session, event->events, event->data.u64);
@@ -2500,6 +2509,17 @@ vppcom_epoll_ctl (uint32_t vep_handle, int op, uint32_t session_handle,
rv = VPPCOM_EINVAL;
goto done;
}
+
+ /* Generate EPOLLOUT when tx_fifo/ct_tx_fifo not full */
+ if ((event->events & EPOLLOUT) &&
+ !(session->vep.ev.events & EPOLLOUT) &&
+ (vcl_session_write_ready (session) > 0))
+ {
+ session_event_t e = { 0 };
+ e.event_type = SESSION_IO_EVT_TX;
+ e.session_index = session->session_index;
+ vec_add1 (wrk->unhandled_evts_vector, e);
+ }
session->vep.et_mask = VEP_DEFAULT_ET_MASK;
session->vep.ev = *event;
VDBG (1, "EPOLL_CTL_MOD: vep_sh %u, sh %u, events 0x%x, data 0x%llx!",