diff options
-rw-r--r-- | src/vcl/vcl_locked.c | 3 | ||||
-rw-r--r-- | src/vcl/vppcom.c | 61 | ||||
-rw-r--r-- | src/vnet/session/session_node.c | 1 | ||||
-rw-r--r-- | src/vnet/tcp/tcp.c | 7 | ||||
-rw-r--r-- | src/vnet/tcp/tcp.h | 3 | ||||
-rw-r--r-- | src/vnet/tcp/tcp_output.c | 3 |
6 files changed, 56 insertions, 22 deletions
diff --git a/src/vcl/vcl_locked.c b/src/vcl/vcl_locked.c index 725f1bf91c0..fb19b5df03f 100644 --- a/src/vcl/vcl_locked.c +++ b/src/vcl/vcl_locked.c @@ -862,6 +862,9 @@ vls_unshare_vcl_worker_sessions (vcl_worker_t * wrk) vcl_locked_session_t *vls; vcl_session_t *s; + if (pool_elts (vcm->workers) <= 1) + return; + current_wrk = vcl_get_worker_index (); is_current = current_wrk == wrk->wrk_index; vls_table_wlock (); diff --git a/src/vcl/vppcom.c b/src/vcl/vppcom.c index 72e11942b6a..bdc11319a7f 100644 --- a/src/vcl/vppcom.c +++ b/src/vcl/vppcom.c @@ -1681,9 +1681,9 @@ vppcom_session_write_inline (uint32_t session_handle, void *buf, size_t n, vcl_worker_t *wrk = vcl_worker_get_current (); int n_write, is_nonblocking; vcl_session_t *s = 0; - svm_fifo_t *tx_fifo = 0; session_evt_type_t et; svm_msg_q_msg_t msg; + svm_fifo_t *tx_fifo; session_event_t *e; svm_msg_q_t *mq; u8 is_ct; @@ -1746,12 +1746,12 @@ vppcom_session_write_inline (uint32_t session_handle, void *buf, size_t n, if (s->is_dgram) n_write = app_send_dgram_raw (tx_fifo, &s->transport, s->vpp_evt_q, buf, n, et, - !is_ct /* do_evt */ , SVM_Q_WAIT); + 0 /* do_evt */ , SVM_Q_WAIT); else n_write = app_send_stream_raw (tx_fifo, s->vpp_evt_q, buf, n, et, - !is_ct /* do_evt */ , SVM_Q_WAIT); + 0 /* do_evt */ , SVM_Q_WAIT); - if (is_ct && svm_fifo_set_event (s->tx_fifo)) + if (svm_fifo_set_event (s->tx_fifo)) app_send_io_evt_to_vpp (s->vpp_evt_q, s->tx_fifo->master_session_index, et, SVM_Q_WAIT); @@ -1940,11 +1940,28 @@ vppcom_select_condvar (vcl_worker_t * wrk, int n_bits, vcl_si_set * except_map, double time_to_wait, u32 * bits_set) { - time_to_wait = (time_to_wait == -1) ? 1e6 : time_to_wait; - vcl_select_handle_mq (wrk, wrk->app_event_queue, n_bits, read_map, - write_map, except_map, (bits_set ? 0 : time_to_wait), - bits_set); - return *bits_set; + double wait = 0, start = 0; + + if (!*bits_set) + { + wait = time_to_wait; + start = clib_time_now (&wrk->clib_time); + } + + do + { + vcl_select_handle_mq (wrk, wrk->app_event_queue, n_bits, read_map, + write_map, except_map, wait, bits_set); + if (*bits_set) + return *bits_set; + if (wait == -1) + continue; + + wait = wait - (clib_time_now (&wrk->clib_time) - start); + } + while (wait > 0); + + return 0; } static int @@ -2517,10 +2534,28 @@ static int vppcom_epoll_wait_condvar (vcl_worker_t * wrk, struct epoll_event *events, int maxevents, u32 n_evts, double wait_for_time) { - wait_for_time = (wait_for_time == -1) ? (double) 1e6 : wait_for_time; - vcl_epoll_wait_handle_mq (wrk, wrk->app_event_queue, events, maxevents, - (n_evts ? 0 : wait_for_time), &n_evts); - return n_evts; + double wait = 0, start = 0; + + if (!n_evts) + { + wait = wait_for_time; + start = clib_time_now (&wrk->clib_time); + } + + do + { + vcl_epoll_wait_handle_mq (wrk, wrk->app_event_queue, events, maxevents, + wait, &n_evts); + if (n_evts) + return n_evts; + if (wait == -1) + continue; + + wait = wait - (clib_time_now (&wrk->clib_time) - start); + } + while (wait > 0); + + return 0; } static int diff --git a/src/vnet/session/session_node.c b/src/vnet/session/session_node.c index fb53846afdc..a7ff2144533 100644 --- a/src/vnet/session/session_node.c +++ b/src/vnet/session/session_node.c @@ -928,6 +928,7 @@ session_queue_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node, clib_warning ("session was freed!"); continue; } + CLIB_PREFETCH (s->tx_fifo, 2 * CLIB_CACHE_LINE_BYTES, LOAD); wrk->ctx.s = s; /* Spray packets in per session type frames, since they go to * different nodes */ diff --git a/src/vnet/tcp/tcp.c b/src/vnet/tcp/tcp.c index 7b28dd3b70c..f40ef424c07 100644 --- a/src/vnet/tcp/tcp.c +++ b/src/vnet/tcp/tcp.c @@ -1156,13 +1156,6 @@ tcp_update_time (f64 now, u8 thread_index) tcp_flush_frames_to_output (wrk); } -static u32 -tcp_session_push_header (transport_connection_t * tconn, vlib_buffer_t * b) -{ - tcp_connection_t *tc = (tcp_connection_t *) tconn; - return tcp_push_header (tc, b); -} - static void tcp_session_flush_data (transport_connection_t * tconn) { diff --git a/src/vnet/tcp/tcp.h b/src/vnet/tcp/tcp.h index 511f0131025..07ceb5a67a6 100644 --- a/src/vnet/tcp/tcp.h +++ b/src/vnet/tcp/tcp.h @@ -820,7 +820,8 @@ tcp_set_time_now (tcp_worker_ctx_t * wrk) return wrk->time_now; } -u32 tcp_push_header (tcp_connection_t * tconn, vlib_buffer_t * b); +u32 tcp_session_push_header (transport_connection_t * tconn, + vlib_buffer_t * b); void tcp_connection_timers_init (tcp_connection_t * tc); void tcp_connection_timers_reset (tcp_connection_t * tc); diff --git a/src/vnet/tcp/tcp_output.c b/src/vnet/tcp/tcp_output.c index 94f96b6fb62..2f728cc7333 100644 --- a/src/vnet/tcp/tcp_output.c +++ b/src/vnet/tcp/tcp_output.c @@ -1173,8 +1173,9 @@ tcp_push_hdr_i (tcp_connection_t * tc, vlib_buffer_t * b, } u32 -tcp_push_header (tcp_connection_t * tc, vlib_buffer_t * b) +tcp_session_push_header (transport_connection_t * tconn, vlib_buffer_t * b) { + tcp_connection_t *tc = (tcp_connection_t *) tconn; tcp_push_hdr_i (tc, b, TCP_STATE_ESTABLISHED, /* compute opts */ 0, /* burst */ 1); tc->snd_una_max = tc->snd_nxt; |