summaryrefslogtreecommitdiffstats
path: root/src/vnet/session/transport.c
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2018-11-01 16:30:54 -0700
committerMarco Varlese <marco.varlese@suse.de>2018-11-02 08:06:46 +0000
commitc44a558164a466a74a4c10d4e7d7dd1b9a4b01dd (patch)
tree3f71b876678de40d0bd6f0a15f463dbe51d61719 /src/vnet/session/transport.c
parentbe72ae6149a432899698a887b1820cf5c9d9456f (diff)
session: measure dispatch period only if under load
Also reset pacer on tcp retransmit timeout Change-Id: I5a9edee4c00d1d169248d79587a9b10437c2bd87 Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/vnet/session/transport.c')
-rw-r--r--src/vnet/session/transport.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/src/vnet/session/transport.c b/src/vnet/session/transport.c
index 0dd9ccd3213..42149eb36a6 100644
--- a/src/vnet/session/transport.c
+++ b/src/vnet/session/transport.c
@@ -529,23 +529,32 @@ 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 initial_bucket)
+transport_connection_tx_pacer_reset (transport_connection_t * tc,
+ u32 rate_bytes_per_sec,
+ u32 start_bucket, u64 time_now)
{
- 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;
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 = initial_bucket;
+ pacer->bucket = start_bucket;
+}
+
+void
+transport_connection_tx_pacer_init (transport_connection_t * tc,
+ u32 rate_bytes_per_sec,
+ u32 initial_bucket)
+{
+ vlib_main_t *vm = vlib_get_main ();
+ tc->flags |= TRANSPORT_CONNECTION_F_IS_TX_PACED;
+ transport_connection_tx_pacer_reset (tc, rate_bytes_per_sec,
+ initial_bucket,
+ vm->clib_time.last_cpu_time);
}
void