diff options
author | Florin Coras <fcoras@cisco.com> | 2018-05-21 17:47:40 -0700 |
---|---|---|
committer | Damjan Marion <dmarion@me.com> | 2018-10-25 10:13:18 +0000 |
commit | d67f112063e6c57160a3d0260537b9dcfe23d217 (patch) | |
tree | c2d5251e7896290cc0a968fb2b4d6d9ba87aef17 /src/vnet/session/session_node.c | |
parent | 2fab01ee0f9b406584272968863eee16a3bb1fb9 (diff) |
tcp/session: add tx pacer
Adds tx pacing infrastructure for transport protocols that want to use
it. Particularly useful for connections with non-negligible rtt and
constrained network throughput as it avoids large tx bursts that lead to
local interface tx or network drops.
By default the pacer is disabled. To enabled it for tcp, add tx-pacing
to tcp's startup conf. We are still slightly inefficient in the handling
of incoming packets in established state so the pacer slightly affect
maximum throughput in low lacency scenarios.
Change-Id: Id445b2ffcd64cce015f75b773f7d722faa0f7ca9
Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/vnet/session/session_node.c')
-rw-r--r-- | src/vnet/session/session_node.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/vnet/session/session_node.c b/src/vnet/session/session_node.c index c1aea6723b6..eb974397165 100644 --- a/src/vnet/session/session_node.c +++ b/src/vnet/session/session_node.c @@ -568,7 +568,8 @@ session_tx_fifo_read_and_snd_i (vlib_main_t * vm, vlib_node_runtime_t * node, ctx->transport_vft = transport_protocol_get_vft (tp); ctx->tc = session_tx_get_transport (ctx, peek_data); ctx->snd_mss = ctx->transport_vft->send_mss (ctx->tc); - ctx->snd_space = ctx->transport_vft->send_space (ctx->tc); + ctx->snd_space = + transport_connection_max_tx_burst (ctx->tc, vm->clib_time.last_cpu_time); if (ctx->snd_space == 0 || ctx->snd_mss == 0) { vec_add1 (smm->pending_event_vector[thread_index], *e); @@ -685,6 +686,7 @@ session_tx_fifo_read_and_snd_i (vlib_main_t * vm, vlib_node_runtime_t * node, _vec_len (smm->tx_buffers[thread_index]) = n_bufs; *n_tx_packets += ctx->n_segs_per_evt; + transport_connection_update_tx_stats (ctx->tc, ctx->max_len_to_snd); vlib_put_next_frame (vm, node, next_index, n_left_to_next); /* If we couldn't dequeue all bytes mark as partially read */ @@ -743,6 +745,17 @@ session_event_get_session (session_event_t * e, u8 thread_index) return session_get_if_valid (e->fifo->master_session_index, thread_index); } +static void +session_update_dispatch_period (session_manager_main_t * smm, f64 now, + u32 thread_index) +{ + f64 sample, prev_period = smm->dispatch_period[thread_index], a = 0.8; + + sample = now - smm->last_vlib_time[thread_index]; + smm->dispatch_period[thread_index] = a * sample + (1 - a) * prev_period; + smm->last_vlib_time[thread_index] = now; +} + static uword session_queue_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node, vlib_frame_t * frame) @@ -764,6 +777,7 @@ session_queue_node_fn (vlib_main_t * vm, vlib_node_runtime_t * node, /* * Update transport time */ + session_update_dispatch_period (smm, now, thread_index); transport_update_time (now, thread_index); /* |