vcl: ensure sessions are open on select events

Type: fix

Signed-off-by: Florin Coras <fcoras@cisco.com>
Change-Id: I4d56b61af574dfdaf6028160ce331606bdf65609
(cherry picked from commit f49cf470c583507fa1b5b841887107071701ef5e)
This commit is contained in:
Florin Coras
2020-04-19 23:12:08 +00:00
committed by Andrew Yourtchenko
parent 00eac4a8f8
commit 188d2c481e

View File

@ -2024,7 +2024,7 @@ vcl_select_handle_mq_event (vcl_worker_t * wrk, session_event_t * e,
case SESSION_IO_EVT_RX: case SESSION_IO_EVT_RX:
sid = e->session_index; sid = e->session_index;
session = vcl_session_get (wrk, sid); session = vcl_session_get (wrk, sid);
if (!session) if (!session || !vcl_session_is_open (session))
break; break;
vcl_fifo_rx_evt_valid_or_break (session); vcl_fifo_rx_evt_valid_or_break (session);
if (sid < n_bits && read_map) if (sid < n_bits && read_map)
@ -2036,7 +2036,7 @@ vcl_select_handle_mq_event (vcl_worker_t * wrk, session_event_t * e,
case SESSION_IO_EVT_TX: case SESSION_IO_EVT_TX:
sid = e->session_index; sid = e->session_index;
session = vcl_session_get (wrk, sid); session = vcl_session_get (wrk, sid);
if (!session) if (!session || !vcl_session_is_open (session))
break; break;
if (sid < n_bits && write_map) if (sid < n_bits && write_map)
{ {
@ -2217,7 +2217,7 @@ vppcom_select (int n_bits, vcl_si_set * read_map, vcl_si_set * write_map,
u32 sid, minbits = clib_max (n_bits, BITS (uword)), bits_set = 0; u32 sid, minbits = clib_max (n_bits, BITS (uword)), bits_set = 0;
vcl_worker_t *wrk = vcl_worker_get_current (); vcl_worker_t *wrk = vcl_worker_get_current ();
vcl_session_t *session = 0; vcl_session_t *session = 0;
int rv, i; int i;
if (n_bits && read_map) if (n_bits && read_map)
{ {
@ -2256,8 +2256,7 @@ vppcom_select (int n_bits, vcl_si_set * read_map, vcl_si_set * write_map,
continue; continue;
} }
rv = svm_fifo_is_full_prod (session->tx_fifo); if (vcl_session_write_ready (session) > 0)
if (!rv)
{ {
clib_bitmap_set_no_check ((uword*)write_map, sid, 1); clib_bitmap_set_no_check ((uword*)write_map, sid, 1);
bits_set++; bits_set++;
@ -2278,8 +2277,7 @@ check_rd:
continue; continue;
} }
rv = vcl_session_read_ready (session); if (vcl_session_read_ready (session) > 0)
if (rv)
{ {
clib_bitmap_set_no_check ((uword*)read_map, sid, 1); clib_bitmap_set_no_check ((uword*)read_map, sid, 1);
bits_set++; bits_set++;