summaryrefslogtreecommitdiffstats
path: root/src/vnet/session/transport.c
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/transport.c
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/transport.c')
-rw-r--r--src/vnet/session/transport.c40
1 files changed, 32 insertions, 8 deletions
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 ();