diff options
author | Florin Coras <fcoras@cisco.com> | 2019-06-26 09:12:34 -0700 |
---|---|---|
committer | John Lo <loj@cisco.com> | 2019-07-10 22:17:36 +0000 |
commit | 85fc13004df7f67012a04e73564ecef1b3641ef3 (patch) | |
tree | cc50b441d83b6c86ebeb1db51ff66dee83e9e2a4 /src/vnet/tcp/tcp_bt.c | |
parent | adbaf7bc2e301e591d63fae47f0a9bbb1577494e (diff) |
tcp: improve rate estimate
Type:feature
- sample rtt estimation
- report acked+sacked
- report last lost bytes
- use snd_una == snd_nxt to detect 0 bytes in flight
Change-Id: I83181261fdb375c7e33d24b7a82343561e6a905f
Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/vnet/tcp/tcp_bt.c')
-rw-r--r-- | src/vnet/tcp/tcp_bt.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/vnet/tcp/tcp_bt.c b/src/vnet/tcp/tcp_bt.c index 74947474b53..dd3d9539d9a 100644 --- a/src/vnet/tcp/tcp_bt.c +++ b/src/vnet/tcp/tcp_bt.c @@ -242,6 +242,7 @@ tcp_bt_alloc_tx_sample (tcp_connection_t * tc, u32 min_seq) bts->delivered = tc->delivered; bts->delivered_time = tc->delivered_time; bts->tx_rate = transport_connection_tx_pacer_rate (&tc->connection); + bts->tx_time = tcp_time_now_us (tc->c_thread_index); bts->flags |= tc->app_limited ? TCP_BTS_IS_APP_LIMITED : 0; return bts; } @@ -268,7 +269,7 @@ tcp_bt_track_tx (tcp_connection_t * tc) tcp_bt_sample_t *bts, *tail; u32 bts_index; - if (!tcp_flight_size (tc)) + if (tc->snd_una == tc->snd_nxt) tc->delivered_time = tcp_time_now_us (tc->c_thread_index); bts = tcp_bt_alloc_tx_sample (tc, tc->snd_nxt); @@ -415,12 +416,12 @@ static void tcp_bt_sample_to_rate_sample (tcp_connection_t * tc, tcp_bt_sample_t * bts, tcp_rate_sample_t * rs) { - if (rs->sample_delivered && rs->sample_delivered >= bts->delivered) + if (rs->prior_delivered && rs->prior_delivered >= bts->delivered) return; - rs->sample_delivered = bts->delivered; - rs->delivered = tc->delivered - bts->delivered; - rs->ack_time = tc->delivered_time - bts->delivered_time; + rs->prior_delivered = bts->delivered; + rs->prior_time = bts->delivered_time; + rs->rtt_time = bts->tx_time; rs->tx_rate = bts->tx_rate; rs->flags = bts->flags; } @@ -527,6 +528,12 @@ tcp_bt_sample_delivery_rate (tcp_connection_t * tc, tcp_rate_sample_t * rs) if (tc->sack_sb.last_sacked_bytes) tcp_bt_walk_samples_ooo (tc, rs); + + rs->interval_time = tc->delivered_time - rs->prior_time; + rs->delivered = tc->delivered - rs->prior_delivered; + rs->rtt_time = tc->delivered_time - rs->rtt_time; + rs->acked_and_sacked = delivered; + rs->lost = tc->sack_sb.last_lost_bytes; } void |