diff options
author | Florin Coras <fcoras@cisco.com> | 2019-06-12 15:38:19 -0700 |
---|---|---|
committer | Dave Barach <openvpp@barachs.net> | 2019-06-25 16:02:51 +0000 |
commit | 52814737c351b394d28a8b0ee1544176180f45e0 (patch) | |
tree | 76c8f32699624a6beb9554d4effa646c6270a791 /src/vnet/session | |
parent | 6e5baf29e2e48dc62a439d148f243dbb735de786 (diff) |
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>
Diffstat (limited to 'src/vnet/session')
-rw-r--r-- | src/vnet/session/transport.c | 12 | ||||
-rw-r--r-- | src/vnet/session/transport.h | 15 |
2 files changed, 27 insertions, 0 deletions
diff --git a/src/vnet/session/transport.c b/src/vnet/session/transport.c index 6077ab19070..bbd9c3555f4 100644 --- a/src/vnet/session/transport.c +++ b/src/vnet/session/transport.c @@ -634,6 +634,12 @@ spacer_set_pace_rate (spacer_t * pacer, u64 rate_bytes_per_sec) 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 @@ transport_connection_snd_space (transport_connection_t * tc, u64 time_now, 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) { diff --git a/src/vnet/session/transport.h b/src/vnet/session/transport.h index 0aaaf7482d3..fadb02d6710 100644 --- a/src/vnet/session/transport.h +++ b/src/vnet/session/transport.h @@ -193,10 +193,25 @@ void transport_connection_tx_pacer_update (transport_connection_t * tc, u32 transport_connection_snd_space (transport_connection_t * tc, u64 time_now, u16 mss); +/** + * Get tx pacer max burst + * + * @param tc transport connection + * @param time_now current cpu time + * @return max burst for connection + */ u32 transport_connection_tx_pacer_burst (transport_connection_t * tc, u64 time_now); /** + * Get tx pacer current rate + * + * @param tc transport connection + * @return rate for connection in bytes/s + */ +u64 transport_connection_tx_pacer_rate (transport_connection_t * tc); + +/** * Initialize period for tx pacers * * Defines a unit of time with respect to number of cpu cycles that is to |