tcp: improve pacing after idle send periods
Rest pacer on ack reception if we haven't recently sent anything.
Type: feature
Change-Id: I820bacd81b65130052dfafbfcbe6ca4553069fbc
Signed-off-by: Florin Coras <fcoras@cisco.com>
diff --git a/src/vnet/session/transport.c b/src/vnet/session/transport.c
index 49a4af7..8f7e30c 100644
--- a/src/vnet/session/transport.c
+++ b/src/vnet/session/transport.c
@@ -47,10 +47,6 @@
*/
static double transport_pacer_period;
-#define TRANSPORT_PACER_MIN_MSS 1460
-#define TRANSPORT_PACER_MIN_BURST TRANSPORT_PACER_MIN_MSS
-#define TRANSPORT_PACER_MAX_BURST (43 * TRANSPORT_PACER_MIN_MSS)
-
u8 *
format_transport_proto (u8 * s, va_list * args)
{
@@ -583,6 +579,13 @@
u64 n_periods = norm_time_now - pacer->last_update;
u64 inc;
+ if (PREDICT_FALSE (n_periods > 5e5))
+ {
+ pacer->last_update = norm_time_now;
+ pacer->bucket = TRANSPORT_PACER_MIN_BURST;
+ return TRANSPORT_PACER_MIN_BURST;
+ }
+
if (n_periods > 0
&& (inc = (f32) n_periods * pacer->tokens_per_period) > 10)
{
@@ -674,7 +677,7 @@
u32 snd_space, max_paced_burst;
snd_space = tp_vfts[tc->proto].send_space (tc);
- if (transport_connection_is_tx_paced (tc))
+ if (snd_space && transport_connection_is_tx_paced (tc))
{
time_now >>= SPACER_CPU_TICKS_PER_PERIOD_SHIFT;
max_paced_burst = spacer_max_burst (&tc->pacer, time_now);