aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/tcp_output.c
diff options
context:
space:
mode:
authorYuchung Cheng <ycheng@google.com>2017-07-19 18:41:26 -0400
committerDavid S. Miller <davem@davemloft.net>2017-07-19 19:14:10 -0400
commitbb4d991a28cc86a2dfbeefeff32911ca9f779c18 (patch)
tree6fd415a7d0b54a9e639067375013fe8f2c3a48b7 /net/ipv4/tcp_output.c
parentc4b2bf6b4a35348fe6d1eb06928eb68d7b9d99a9 (diff)
tcp: adjust tail loss probe timeout
This patch adjusts the timeout formula to schedule the TCP loss probe (TLP). The previous formula uses 2*SRTT or 1.5*RTT + DelayACKMax if only one packet is in flight. It keeps a lower bound of 10 msec which is too large for short RTT connections (e.g. within a data-center). The new formula = 2*RTT + (inflight == 1 ? 200ms : 2ticks) which performs better for short and fast connections. Signed-off-by: Yuchung Cheng <ycheng@google.com> Signed-off-by: Neal Cardwell <ncardwell@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/tcp_output.c')
-rw-r--r--net/ipv4/tcp_output.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index 4e985dea1dd2..886d874775df 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -2377,7 +2377,6 @@ bool tcp_schedule_loss_probe(struct sock *sk)
2377 struct inet_connection_sock *icsk = inet_csk(sk); 2377 struct inet_connection_sock *icsk = inet_csk(sk);
2378 struct tcp_sock *tp = tcp_sk(sk); 2378 struct tcp_sock *tp = tcp_sk(sk);
2379 u32 timeout, tlp_time_stamp, rto_time_stamp; 2379 u32 timeout, tlp_time_stamp, rto_time_stamp;
2380 u32 rtt = usecs_to_jiffies(tp->srtt_us >> 3);
2381 2380
2382 /* No consecutive loss probes. */ 2381 /* No consecutive loss probes. */
2383 if (WARN_ON(icsk->icsk_pending == ICSK_TIME_LOSS_PROBE)) { 2382 if (WARN_ON(icsk->icsk_pending == ICSK_TIME_LOSS_PROBE)) {
@@ -2406,15 +2405,19 @@ bool tcp_schedule_loss_probe(struct sock *sk)
2406 tcp_send_head(sk)) 2405 tcp_send_head(sk))
2407 return false; 2406 return false;
2408 2407
2409 /* Probe timeout is at least 1.5*rtt + TCP_DELACK_MAX to account 2408 /* Probe timeout is 2*rtt. Add minimum RTO to account
2410 * for delayed ack when there's one outstanding packet. If no RTT 2409 * for delayed ack when there's one outstanding packet. If no RTT
2411 * sample is available then probe after TCP_TIMEOUT_INIT. 2410 * sample is available then probe after TCP_TIMEOUT_INIT.
2412 */ 2411 */
2413 timeout = rtt << 1 ? : TCP_TIMEOUT_INIT; 2412 if (tp->srtt_us) {
2414 if (tp->packets_out == 1) 2413 timeout = usecs_to_jiffies(tp->srtt_us >> 2);
2415 timeout = max_t(u32, timeout, 2414 if (tp->packets_out == 1)
2416 (rtt + (rtt >> 1) + TCP_DELACK_MAX)); 2415 timeout += TCP_RTO_MIN;
2417 timeout = max_t(u32, timeout, msecs_to_jiffies(10)); 2416 else
2417 timeout += TCP_TIMEOUT_MIN;
2418 } else {
2419 timeout = TCP_TIMEOUT_INIT;
2420 }
2418 2421
2419 /* If RTO is shorter, just schedule TLP in its place. */ 2422 /* If RTO is shorter, just schedule TLP in its place. */
2420 tlp_time_stamp = tcp_jiffies32 + timeout; 2423 tlp_time_stamp = tcp_jiffies32 + timeout;