vcl: fix poll support

Type: fix

Change-Id: I827f19d893153277baba3c2d0efde5f2827eb0ff
Signed-off-by: Florin Coras <fcoras@cisco.com>
This commit is contained in:
Florin Coras 2024-05-10 20:28:12 -07:00
parent 6b224de844
commit 63b34c8d22
3 changed files with 24 additions and 2 deletions

View File

@ -2734,12 +2734,19 @@ epoll_wait (int epfd, struct epoll_event *events, int maxevents, int timeout)
int
poll (struct pollfd *fds, nfds_t nfds, int timeout)
{
ldp_worker_ctx_t *ldpw = ldp_worker_get_current ();
int rv, i, n_revents = 0;
ldp_worker_ctx_t *ldpw;
vls_handle_t vlsh;
vcl_poll_t *vp;
double max_time;
ldp_init_check ();
if (PREDICT_FALSE (vppcom_worker_index () == ~0))
vls_register_vcl_worker ();
ldpw = ldp_worker_get_current ();
LDBG (3, "fds %p, nfds %ld, timeout %d", fds, nfds, timeout);
if (PREDICT_FALSE (ldpw->clib_time.init_cpu_time == 0))
@ -2780,7 +2787,7 @@ poll (struct pollfd *fds, nfds_t nfds, int timeout)
{
if (vec_len (ldpw->vcl_poll))
{
rv = vppcom_poll (ldpw->vcl_poll, vec_len (ldpw->vcl_poll), 0);
rv = vls_poll (ldpw->vcl_poll, vec_len (ldpw->vcl_poll), 0);
if (rv < 0)
{
errno = -rv;

View File

@ -1626,6 +1626,20 @@ vls_select (int n_bits, vcl_si_set * read_map, vcl_si_set * write_map,
return rv;
}
int
vls_poll (vcl_poll_t *vp, uint32_t n_sids, double wait_for_time)
{
int rv;
vcl_locked_session_t *vls = NULL;
vls_mt_detect ();
vls_mt_guard (vls, VLS_MT_OP_XPOLL);
rv = vppcom_poll (vp, n_sids, wait_for_time);
vls_mt_unguard ();
vls_handle_pending_wrk_cleanup ();
return rv;
}
static void
vls_unshare_vcl_worker_sessions (vcl_worker_t * wrk)
{

View File

@ -48,6 +48,7 @@ int vls_epoll_wait (vls_handle_t ep_vlsh, struct epoll_event *events,
int maxevents, double wait_for_time);
int vls_select (int n_bits, vcl_si_set * read_map, vcl_si_set * write_map,
vcl_si_set * except_map, double wait_for_time);
int vls_poll (vcl_poll_t *vp, uint32_t n_sids, double wait_for_time);
vcl_session_handle_t vlsh_to_sh (vls_handle_t vlsh);
vcl_session_handle_t vlsh_to_session_index (vls_handle_t vlsh);
int vlsh_to_worker_index (vls_handle_t vlsh);