netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] tcp: send loss probe after 1s if no RTT available
@ 2015-09-18 18:40 Yuchung Cheng
  2015-09-21 23:19 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Yuchung Cheng @ 2015-09-18 18:40 UTC (permalink / raw)
  To: davem; +Cc: netdev, Yuchung Cheng, Nandita Dukkipati, Neal Cardwell,
	Eric Dumazet

This patch makes TLP to use 1 sec timer by default when RTT is
not available due to SYN/ACK retransmission or SYN cookies.

Prior to this change, the lack of RTT prevents TLP so the first
data packets sent can only be recovered by fast recovery or RTO.
If the fast recovery fails to trigger the RTO is 3 second when
SYN/ACK is retransmitted. With this patch we can trigger fast
recovery in 1sec instead.

Note that we need to check Fast Open more properly. A Fast Open
connection could be (accepted then) closed before it receives
the final ACK of 3WHS so the state is FIN_WAIT_1. Without the
new check, TLP will retransmit FIN instead of SYN/ACK.

Signed-off-by: Yuchung Cheng <ycheng@google.com>
Signed-off-by: Nandita Dukkipati <nanditad@google.com>
Signed-off-by: Neal Cardwell <ncardwell@google.com>
Signed-off-by: Eric Dumazet <edumazet@google.com>
---
 net/ipv4/tcp_output.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index d0ad355..4cd0b50 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -2165,7 +2165,7 @@ bool tcp_schedule_loss_probe(struct sock *sk)
 	/* Don't do any loss probe on a Fast Open connection before 3WHS
 	 * finishes.
 	 */
-	if (sk->sk_state == TCP_SYN_RECV)
+	if (tp->fastopen_rsk)
 		return false;
 
 	/* TLP is only scheduled when next timer event is RTO. */
@@ -2175,7 +2175,7 @@ bool tcp_schedule_loss_probe(struct sock *sk)
 	/* Schedule a loss probe in 2*RTT for SACK capable connections
 	 * in Open state, that are either limited by cwnd or application.
 	 */
-	if (sysctl_tcp_early_retrans < 3 || !tp->srtt_us || !tp->packets_out ||
+	if (sysctl_tcp_early_retrans < 3 || !tp->packets_out ||
 	    !tcp_is_sack(tp) || inet_csk(sk)->icsk_ca_state != TCP_CA_Open)
 		return false;
 
@@ -2184,9 +2184,10 @@ bool tcp_schedule_loss_probe(struct sock *sk)
 		return false;
 
 	/* Probe timeout is at least 1.5*rtt + TCP_DELACK_MAX to account
-	 * for delayed ack when there's one outstanding packet.
+	 * for delayed ack when there's one outstanding packet. If no RTT
+	 * sample is available then probe after TCP_TIMEOUT_INIT.
 	 */
-	timeout = rtt << 1;
+	timeout = rtt << 1 ? : TCP_TIMEOUT_INIT;
 	if (tp->packets_out == 1)
 		timeout = max_t(u32, timeout,
 				(rtt + (rtt >> 1) + TCP_DELACK_MAX));
-- 
2.6.0.rc0.131.gf624c3d

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net-next] tcp: send loss probe after 1s if no RTT available
  2015-09-18 18:40 [PATCH net-next] tcp: send loss probe after 1s if no RTT available Yuchung Cheng
@ 2015-09-21 23:19 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2015-09-21 23:19 UTC (permalink / raw)
  To: ycheng; +Cc: netdev, nanditad, ncardwell, edumazet

From: Yuchung Cheng <ycheng@google.com>
Date: Fri, 18 Sep 2015 11:40:33 -0700

> This patch makes TLP to use 1 sec timer by default when RTT is
> not available due to SYN/ACK retransmission or SYN cookies.
> 
> Prior to this change, the lack of RTT prevents TLP so the first
> data packets sent can only be recovered by fast recovery or RTO.
> If the fast recovery fails to trigger the RTO is 3 second when
> SYN/ACK is retransmitted. With this patch we can trigger fast
> recovery in 1sec instead.
> 
> Note that we need to check Fast Open more properly. A Fast Open
> connection could be (accepted then) closed before it receives
> the final ACK of 3WHS so the state is FIN_WAIT_1. Without the
> new check, TLP will retransmit FIN instead of SYN/ACK.
> 
> Signed-off-by: Yuchung Cheng <ycheng@google.com>
> Signed-off-by: Nandita Dukkipati <nanditad@google.com>
> Signed-off-by: Neal Cardwell <ncardwell@google.com>
> Signed-off-by: Eric Dumazet <edumazet@google.com>

Applied.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-09-21 23:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-18 18:40 [PATCH net-next] tcp: send loss probe after 1s if no RTT available Yuchung Cheng
2015-09-21 23:19 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).