summaryrefslogtreecommitdiffstats
path: root/src/vnet
diff options
context:
space:
mode:
authorFlorin Coras <fcoras@cisco.com>2019-09-11 13:42:57 -0700
committerAndrew Yourtchenko <ayourtch@gmail.com>2019-09-29 16:45:32 +0000
commit6702641f536ba1a14075b2b24ffd2fb9c6167791 (patch)
tree948ba872a335926b9731e182399a6d76afbd0b09 /src/vnet
parentdedb3c8d95322cbac280660bc21665b35d8a3af1 (diff)
tcp: use rate sample rtt in recovery if possible
If in recovery and rate samples are taken for burts that have not been retransmitted, use the rtt estimate. Type: feature Change-Id: I95028f492008457c959157aa4ee4c3435fa9c3f0 Signed-off-by: Florin Coras <fcoras@cisco.com> (cherry picked from commit 1dbda64b467f020db131cb9a01422b8f3fbf58df)
Diffstat (limited to 'src/vnet')
-rwxr-xr-xsrc/vnet/tcp/tcp_input.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/vnet/tcp/tcp_input.c b/src/vnet/tcp/tcp_input.c
index f4e1026e4c5..ad937e90438 100755
--- a/src/vnet/tcp/tcp_input.c
+++ b/src/vnet/tcp/tcp_input.c
@@ -494,14 +494,20 @@ tcp_update_rto (tcp_connection_t * tc)
* return 1 if valid rtt 0 otherwise
*/
static int
-tcp_update_rtt (tcp_connection_t * tc, u32 ack)
+tcp_update_rtt (tcp_connection_t * tc, tcp_rate_sample_t * rs, u32 ack)
{
u32 mrtt = 0;
/* Karn's rule, part 1. Don't use retransmitted segments to estimate
* RTT because they're ambiguous. */
- if (tcp_in_cong_recovery (tc) || tc->sack_sb.sacked_bytes)
+ if (tcp_in_cong_recovery (tc))
{
+ /* Accept rtt estimates for samples that have not been retransmitted */
+ if ((tc->flags & TCP_CONN_RATE_SAMPLE) && !(rs->flags & TCP_BTS_IS_RXT))
+ {
+ mrtt = rs->rtt_time * THZ;
+ goto estimate_rtt;
+ }
if (tcp_in_recovery (tc))
return 0;
goto done;
@@ -524,6 +530,8 @@ tcp_update_rtt (tcp_connection_t * tc, u32 ack)
mrtt = clib_max (now - tc->rcv_opts.tsecr, 1);
}
+estimate_rtt:
+
/* Ignore dubious measurements */
if (mrtt == 0 || mrtt > TCP_RTT_MAX)
goto done;
@@ -1601,15 +1609,15 @@ process_ack:
tc->snd_una = vnet_buffer (b)->tcp.ack_number;
tcp_validate_txf_size (tc, tc->bytes_acked);
+ if (tc->flags & TCP_CONN_RATE_SAMPLE)
+ tcp_bt_sample_delivery_rate (tc, &rs);
+
if (tc->bytes_acked)
{
tcp_program_dequeue (wrk, tc);
- tcp_update_rtt (tc, vnet_buffer (b)->tcp.ack_number);
+ tcp_update_rtt (tc, &rs, vnet_buffer (b)->tcp.ack_number);
}
- if (tc->flags & TCP_CONN_RATE_SAMPLE)
- tcp_bt_sample_delivery_rate (tc, &rs);
-
TCP_EVT (TCP_EVT_ACK_RCVD, tc);
/*