diff options
Diffstat (limited to 'src/vcl/vppcom.c')
-rw-r--r-- | src/vcl/vppcom.c | 50 |
1 files changed, 31 insertions, 19 deletions
diff --git a/src/vcl/vppcom.c b/src/vcl/vppcom.c index 0925246f8a1..bdbd9256a7a 100644 --- a/src/vcl/vppcom.c +++ b/src/vcl/vppcom.c @@ -1090,8 +1090,8 @@ vppcom_app_create (char *app_name) void vppcom_app_destroy (void) { + vcl_worker_t *wrk, *current_wrk; struct dlmallinfo mi; - vcl_worker_t *wrk; mspace heap; if (!pool_elts (vcm->workers)) @@ -1099,16 +1099,20 @@ vppcom_app_destroy (void) vcl_evt (VCL_EVT_DETACH, vcm); - vcl_send_app_detach (vcl_worker_get_current ()); + current_wrk = vcl_worker_get_current (); /* *INDENT-OFF* */ pool_foreach (wrk, vcm->workers, ({ - vcl_worker_cleanup (wrk, 0 /* notify vpp */ ); + if (current_wrk != wrk) + vcl_worker_cleanup (wrk, 0 /* notify vpp */ ); })); /* *INDENT-ON* */ + vcl_send_app_detach (current_wrk); + vppcom_disconnect_from_vpp (); + vcl_worker_cleanup (current_wrk, 0 /* notify vpp */ ); + vcl_elog_stop (vcm); - vl_client_disconnect_from_vlib (); /* * Free the heap and fix vcm @@ -1118,6 +1122,7 @@ vppcom_app_destroy (void) munmap (mspace_least_addr (heap), mi.arena); vcm = &_vppcom_main; + vcm->is_init = 0; } int @@ -2024,7 +2029,7 @@ vcl_select_handle_mq_event (vcl_worker_t * wrk, session_event_t * e, case SESSION_IO_EVT_RX: sid = e->session_index; session = vcl_session_get (wrk, sid); - if (!session) + if (!session || !vcl_session_is_open (session)) break; vcl_fifo_rx_evt_valid_or_break (session); if (sid < n_bits && read_map) @@ -2036,7 +2041,7 @@ vcl_select_handle_mq_event (vcl_worker_t * wrk, session_event_t * e, case SESSION_IO_EVT_TX: sid = e->session_index; session = vcl_session_get (wrk, sid); - if (!session) + if (!session || !vcl_session_is_open (session)) break; if (sid < n_bits && write_map) { @@ -2217,7 +2222,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; vcl_worker_t *wrk = vcl_worker_get_current (); vcl_session_t *session = 0; - int rv, i; + int i; if (n_bits && read_map) { @@ -2251,13 +2256,12 @@ vppcom_select (int n_bits, vcl_si_set * read_map, vcl_si_set * write_map, clib_bitmap_foreach (sid, wrk->wr_bitmap, ({ if (!(session = vcl_session_get (wrk, sid))) { - if (except_map && sid < minbits) - clib_bitmap_set_no_check (except_map, sid, 1); - continue; + clib_bitmap_set_no_check ((uword*)write_map, sid, 1); + bits_set++; + continue; } - rv = svm_fifo_is_full_prod (session->tx_fifo); - if (!rv) + if (vcl_session_write_ready (session)) { clib_bitmap_set_no_check ((uword*)write_map, sid, 1); bits_set++; @@ -2273,13 +2277,12 @@ check_rd: clib_bitmap_foreach (sid, wrk->rd_bitmap, ({ if (!(session = vcl_session_get (wrk, sid))) { - if (except_map && sid < minbits) - clib_bitmap_set_no_check (except_map, sid, 1); - continue; + clib_bitmap_set_no_check ((uword*)read_map, sid, 1); + bits_set++; + continue; } - rv = vcl_session_read_ready (session); - if (rv) + if (vcl_session_read_ready (session)) { clib_bitmap_set_no_check ((uword*)read_map, sid, 1); bits_set++; @@ -2749,7 +2752,7 @@ vcl_epoll_wait_handle_mq (vcl_worker_t * wrk, svm_msg_q_t * mq, } } ASSERT (maxevents > *num_ev); - vcl_mq_dequeue_batch (wrk, mq, maxevents - *num_ev); + vcl_mq_dequeue_batch (wrk, mq, ~0); svm_msg_q_unlock (mq); handle_dequeued: @@ -2757,7 +2760,10 @@ handle_dequeued: { msg = vec_elt_at_index (wrk->mq_msg_vector, i); e = svm_msg_q_msg_data (mq, msg); - vcl_epoll_wait_handle_mq_event (wrk, e, events, num_ev); + if (*num_ev < maxevents) + vcl_epoll_wait_handle_mq_event (wrk, e, events, num_ev); + else + vcl_handle_mq_event (wrk, e); svm_msg_q_free_msg (mq, msg); } vec_reset_length (wrk->mq_msg_vector); @@ -3633,6 +3639,12 @@ vppcom_worker_unregister (void) vcl_set_worker_index (~0); } +void +vppcom_worker_index_set (int index) +{ + vcl_set_worker_index (index); +} + int vppcom_worker_index (void) { |