aboutsummaryrefslogtreecommitdiffstats
path: root/src/vnet/session
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2018-10-31 23:09:22 -0700
committerDave Barach <openvpp@barachs.net>2018-11-01 20:43:29 +0000
commite55a6d7a97044c2f4fd0231242e062924d75c7b6 (patch)
treeae58b4562748db8397604029261008b94aaecd8c /src/vnet/session
parentf6c68d74eca9038516986254846de60a4f7c02ae (diff)
tcp: fast retransmit pacing
Force pacing for fast retransmit to avoid bursts of retransmitted packets. Change-Id: I2ff42c328899b36322c4de557b1f7d853dba8fe2 Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/vnet/session')
-rw-r--r--src/vnet/session/session_node.c3
-rw-r--r--src/vnet/session/transport.c40
-rw-r--r--src/vnet/session/transport_interface.h14
3 files changed, 45 insertions, 12 deletions
diff --git a/src/vnet/session/session_node.c b/src/vnet/session/session_node.c
index 6ef461a5f34..34131723665 100644
--- a/src/vnet/session/session_node.c
+++ b/src/vnet/session/session_node.c
@@ -570,7 +570,8 @@ session_tx_fifo_read_and_snd_i (vlib_main_t * vm, vlib_node_runtime_t * node,
ctx->tc = session_tx_get_transport (ctx, peek_data);
ctx->snd_mss = ctx->transport_vft->send_mss (ctx->tc);
ctx->snd_space =
- transport_connection_max_tx_burst (ctx->tc, vm->clib_time.last_cpu_time);
+ transport_connection_snd_space (ctx->tc, vm->clib_time.last_cpu_time,
+ ctx->snd_mss);
if (ctx->snd_space == 0 || ctx->snd_mss == 0)
{
vec_add1 (wrk->pending_event_vector, *e);
diff --git a/src/vnet/session/transport.c b/src/vnet/session/transport.c
index fefedcae8f2..0dd9ccd3213 100644
--- a/src/vnet/session/transport.c
+++ b/src/vnet/session/transport.c
@@ -497,9 +497,14 @@ static inline u32
spacer_max_burst (spacer_t * pacer, u64 norm_time_now)
{
u64 n_periods = norm_time_now - pacer->last_update;
+ u64 inc;
+
+ if (n_periods > 0 && (inc = n_periods * pacer->tokens_per_period) > 10)
+ {
+ pacer->last_update = norm_time_now;
+ pacer->bucket += inc;
+ }
- pacer->last_update = norm_time_now;
- pacer->bucket += n_periods * pacer->tokens_per_period;
return clib_min (pacer->bucket, pacer->max_burst_size);
}
@@ -525,17 +530,22 @@ spacer_set_pace_rate (spacer_t * pacer, u64 rate_bytes_per_sec)
void
transport_connection_tx_pacer_init (transport_connection_t * tc,
- u32 rate_bytes_per_sec, u32 burst_bytes)
+ u32 rate_bytes_per_sec,
+ u32 initial_bucket)
{
vlib_main_t *vm = vlib_get_main ();
u64 time_now = vm->clib_time.last_cpu_time;
spacer_t *pacer = &tc->pacer;
+ f64 dispatch_period;
+ u32 burst_size;
tc->flags |= TRANSPORT_CONNECTION_F_IS_TX_PACED;
- spacer_update_max_burst_size (&tc->pacer, burst_bytes);
+ dispatch_period = transport_dispatch_period (tc->thread_index);
+ burst_size = rate_bytes_per_sec * dispatch_period;
+ spacer_update_max_burst_size (&tc->pacer, burst_size);
spacer_set_pace_rate (&tc->pacer, rate_bytes_per_sec);
pacer->last_update = time_now >> SPACER_CPU_TICKS_PER_PERIOD_SHIFT;
- pacer->bucket = burst_bytes;
+ pacer->bucket = initial_bucket;
}
void
@@ -550,17 +560,24 @@ transport_connection_tx_pacer_update (transport_connection_t * tc,
}
u32
-transport_connection_max_tx_burst (transport_connection_t * tc, u64 time_now)
+transport_connection_tx_pacer_burst (transport_connection_t * tc,
+ u64 time_now)
+{
+ time_now >>= SPACER_CPU_TICKS_PER_PERIOD_SHIFT;
+ return spacer_max_burst (&tc->pacer, time_now);
+}
+
+u32
+transport_connection_snd_space (transport_connection_t * tc, u64 time_now,
+ u16 mss)
{
u32 snd_space, max_paced_burst;
- u32 mss;
snd_space = tp_vfts[tc->proto].send_space (tc);
if (transport_connection_is_tx_paced (tc))
{
time_now >>= SPACER_CPU_TICKS_PER_PERIOD_SHIFT;
max_paced_burst = spacer_max_burst (&tc->pacer, time_now);
- mss = tp_vfts[tc->proto].send_mss (tc);
max_paced_burst = (max_paced_burst < mss) ? 0 : max_paced_burst;
snd_space = clib_min (snd_space, max_paced_burst);
snd_space = snd_space - snd_space % mss;
@@ -577,6 +594,13 @@ transport_connection_update_tx_stats (transport_connection_t * tc, u32 bytes)
}
void
+transport_connection_tx_pacer_update_bytes (transport_connection_t * tc,
+ u32 bytes)
+{
+ spacer_update_bucket (&tc->pacer, bytes);
+}
+
+void
transport_init_tx_pacers_period (void)
{
f64 cpu_freq = os_cpu_clock_frequency ();
diff --git a/src/vnet/session/transport_interface.h b/src/vnet/session/transport_interface.h
index ce3bb7fab7c..b7aa4b7fa3c 100644
--- a/src/vnet/session/transport_interface.h
+++ b/src/vnet/session/transport_interface.h
@@ -111,7 +111,7 @@ void transport_enable_disable (vlib_main_t * vm, u8 is_en);
*/
void transport_connection_tx_pacer_init (transport_connection_t * tc,
u32 rate_bytes_per_sec,
- u32 burst_bytes);
+ u32 initial_bucket);
/**
* Update tx pacer pacing rate
@@ -127,9 +127,13 @@ void transport_connection_tx_pacer_update (transport_connection_t * tc,
*
* @param tc transport connection
* @param time_now current cpu time as returned by @ref clib_cpu_time_now
+ * @param mss transport's mss
*/
-u32 transport_connection_max_tx_burst (transport_connection_t * tc,
- u64 time_now);
+u32 transport_connection_snd_space (transport_connection_t * tc,
+ u64 time_now, u16 mss);
+
+u32 transport_connection_tx_pacer_burst (transport_connection_t * tc,
+ u64 time_now);
/**
* Initialize period for tx pacers
@@ -163,6 +167,10 @@ u8 *format_transport_pacer (u8 * s, va_list * args);
void transport_connection_update_tx_stats (transport_connection_t * tc,
u32 bytes);
+void
+transport_connection_tx_pacer_update_bytes (transport_connection_t * tc,
+ u32 bytes);
+
#endif /* SRC_VNET_SESSION_TRANSPORT_INTERFACE_H_ */
/*