summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2020-01-15 01:30:46 +0000
committerAndrew Yourtchenko <ayourtch@gmail.com>2020-08-12 15:59:46 +0000
commit0347bf689bd6a671f63ffd5bc5eeddf6bb47b1a9 (patch)
tree68fcec60041e1764648525267278430e2dfd45c7
parent72c354dcd5b525c951c3139170786308a9226500 (diff)
vcl: add rx event on epoll ctl if needed
Type: fix Signed-off-by: Florin Coras <fcoras@cisco.com> Change-Id: Ib6d0387076a4bb0b52e4cdfdcd62b6060b704fe6 (cherry picked from commit 6e3c1f8ec3faa8f0cad591fada32ad2f506ec0a0)
-rw-r--r--src/vcl/vcl_private.h8
-rw-r--r--src/vcl/vppcom.c12
2 files changed, 18 insertions, 2 deletions
diff --git a/src/vcl/vcl_private.h b/src/vcl/vcl_private.h
index 7746862da60..f83b19ebc61 100644
--- a/src/vcl/vcl_private.h
+++ b/src/vcl/vcl_private.h
@@ -513,6 +513,14 @@ vcl_session_is_ct (vcl_session_t * s)
}
static inline u8
+vcl_session_is_cl (vcl_session_t * s)
+{
+ if (s->session_type == VPPCOM_PROTO_UDP)
+ return 1;
+ return 0;
+}
+
+static inline u8
vcl_session_is_open (vcl_session_t * s)
{
return ((s->session_state & STATE_OPEN)
diff --git a/src/vcl/vppcom.c b/src/vcl/vppcom.c
index 6be438c89eb..d27201ad27a 100644
--- a/src/vcl/vppcom.c
+++ b/src/vcl/vppcom.c
@@ -595,7 +595,7 @@ vcl_session_bound_handler (vcl_worker_t * wrk, session_bound_msg_t * mp)
vec_validate (wrk->vpp_event_queues, 0);
wrk->vpp_event_queues[0] = session->vpp_evt_q;
- if (session->is_dgram)
+ if (vcl_session_is_cl (session))
{
svm_fifo_t *rx_fifo, *tx_fifo;
session->vpp_evt_q = uword_to_pointer (mp->vpp_evt_q, svm_msg_q_t *);
@@ -2475,7 +2475,7 @@ 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 */
+ /* Generate EPOLLOUT if tx fifo not full */
if ((event->events & EPOLLOUT) &&
(vcl_session_write_ready (session) > 0))
{
@@ -2484,6 +2484,14 @@ vppcom_epoll_ctl (uint32_t vep_handle, int op, uint32_t session_handle,
e.session_index = session->session_index;
vec_add1 (wrk->unhandled_evts_vector, e);
}
+ /* Generate EPOLLIN if rx fifo has data */
+ if ((event->events & EPOLLIN) && (vcl_session_read_ready (session) > 0))
+ {
+ session_event_t e = { 0 };
+ e.event_type = SESSION_IO_EVT_RX;
+ 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);