tcp: delivery rate estimator

Type: feature

First cut implementation with limited testing. The feature is not
enabled by default and the expectation is that cc algorithms will enable
it on demand.

Change-Id: I92b70cb4dabcff0e9ccd1d725952c4880af394da
Signed-off-by: Florin Coras <fcoras@cisco.com>
diff --git a/src/vnet/session/transport.c b/src/vnet/session/transport.c
index 6077ab1..bbd9c35 100644
--- a/src/vnet/session/transport.c
+++ b/src/vnet/session/transport.c
@@ -634,6 +634,12 @@
   pacer->tokens_per_period = rate_bytes_per_sec / transport_pacer_period;
 }
 
+static inline u64
+spacer_pace_rate (spacer_t * pacer)
+{
+  return pacer->tokens_per_period * transport_pacer_period;
+}
+
 void
 transport_connection_tx_pacer_reset (transport_connection_t * tc,
 				     u32 rate_bytes_per_sec,
@@ -690,6 +696,12 @@
   return snd_space;
 }
 
+u64
+transport_connection_tx_pacer_rate (transport_connection_t * tc)
+{
+  return spacer_pace_rate (&tc->pacer);
+}
+
 void
 transport_connection_update_tx_stats (transport_connection_t * tc, u32 bytes)
 {