All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2 net] revert a F-RTO extension due to broken middle-boxes
@ 2018-02-27 22:15 Yuchung Cheng
  2018-02-27 22:15 ` [PATCH 1/2 net] tcp: revert F-RTO middle-box workaround Yuchung Cheng
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Yuchung Cheng @ 2018-02-27 22:15 UTC (permalink / raw)
  To: davem; +Cc: netdev, ncardwell, tm, Yuchung Cheng

This patch series reverts a (non-standard) TCP F-RTO extension that aimed
to detect more spurious timeouts. Unfortunately it could result in poor
performance due to broken middle-boxes that modify TCP packets. E.g.
https://www.spinics.net/lists/netdev/msg484154.html
We believe the best and simplest solution is to just revert the change.

Yuchung Cheng (2):
  tcp: revert F-RTO middle-box workaround
  tcp: revert F-RTO extension to detect more spurious timeouts

 net/ipv4/tcp_input.c | 23 +++++++----------------
 1 file changed, 7 insertions(+), 16 deletions(-)

-- 
2.16.1.291.g4437f3f132-goog

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

* [PATCH 1/2 net] tcp: revert F-RTO middle-box workaround
  2018-02-27 22:15 [PATCH 0/2 net] revert a F-RTO extension due to broken middle-boxes Yuchung Cheng
@ 2018-02-27 22:15 ` Yuchung Cheng
  2018-02-27 22:15 ` [PATCH 2/2 net] tcp: revert F-RTO extension to detect more spurious timeouts Yuchung Cheng
  2018-02-28 16:38 ` [PATCH 0/2 net] revert a F-RTO extension due to broken middle-boxes David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Yuchung Cheng @ 2018-02-27 22:15 UTC (permalink / raw)
  To: davem; +Cc: netdev, ncardwell, tm, Yuchung Cheng

This reverts commit cc663f4d4c97b7297fb45135ab23cfd508b35a77. While fixing
some broken middle-boxes that modifies receive window fields, it does not
address middle-boxes that strip off SACK options. The best solution is
to fully revert this patch and the root F-RTO enhancement.

Fixes: cc663f4d4c97 ("tcp: restrict F-RTO to work-around broken middle-boxes")
Reported-by: Teodor Milkov <tm@del.bg>
Signed-off-by: Yuchung Cheng <ycheng@google.com>
Signed-off-by: Neal Cardwell <ncardwell@google.com>
---
 net/ipv4/tcp_input.c | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 575d3c1fb6e8..cd8ea972dc65 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -1909,7 +1909,6 @@ void tcp_enter_loss(struct sock *sk)
 	struct tcp_sock *tp = tcp_sk(sk);
 	struct net *net = sock_net(sk);
 	struct sk_buff *skb;
-	bool new_recovery = icsk->icsk_ca_state < TCP_CA_Recovery;
 	bool is_reneg;			/* is receiver reneging on SACKs? */
 	bool mark_lost;
 
@@ -1968,17 +1967,15 @@ void tcp_enter_loss(struct sock *sk)
 	tp->high_seq = tp->snd_nxt;
 	tcp_ecn_queue_cwr(tp);
 
-	/* F-RTO RFC5682 sec 3.1 step 1: retransmit SND.UNA if no previous
-	 * loss recovery is underway except recurring timeout(s) on
-	 * the same SND.UNA (sec 3.2). Disable F-RTO on path MTU probing
-	 *
-	 * In theory F-RTO can be used repeatedly during loss recovery.
-	 * In practice this interacts badly with broken middle-boxes that
-	 * falsely raise the receive window, which results in repeated
-	 * timeouts and stop-and-go behavior.
+	/* F-RTO RFC5682 sec 3.1 step 1 mandates to disable F-RTO
+	 * if a previous recovery is underway, otherwise it may incorrectly
+	 * call a timeout spurious if some previously retransmitted packets
+	 * are s/acked (sec 3.2). We do not apply that retriction since
+	 * retransmitted skbs are permanently tagged with TCPCB_EVER_RETRANS
+	 * so FLAG_ORIG_SACK_ACKED is always correct. But we do disable F-RTO
+	 * on PTMU discovery to avoid sending new data.
 	 */
 	tp->frto = net->ipv4.sysctl_tcp_frto &&
-		   (new_recovery || icsk->icsk_retransmits) &&
 		   !inet_csk(sk)->icsk_mtup.probe_size;
 }
 
-- 
2.16.1.291.g4437f3f132-goog

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

* [PATCH 2/2 net] tcp: revert F-RTO extension to detect more spurious timeouts
  2018-02-27 22:15 [PATCH 0/2 net] revert a F-RTO extension due to broken middle-boxes Yuchung Cheng
  2018-02-27 22:15 ` [PATCH 1/2 net] tcp: revert F-RTO middle-box workaround Yuchung Cheng
@ 2018-02-27 22:15 ` Yuchung Cheng
  2018-02-28 16:38 ` [PATCH 0/2 net] revert a F-RTO extension due to broken middle-boxes David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Yuchung Cheng @ 2018-02-27 22:15 UTC (permalink / raw)
  To: davem; +Cc: netdev, ncardwell, tm, Yuchung Cheng

This reverts commit 89fe18e44f7ee5ab1c90d0dff5835acee7751427.

While the patch could detect more spurious timeouts, it could cause
poor TCP performance on broken middle-boxes that modifies TCP packets
(e.g. receive window, SACK options). Since the performance gain is
much smaller compared to the potential loss. The best solution is
to fully revert the change.

Fixes: 89fe18e44f7e ("tcp: extend F-RTO to catch more spurious timeouts")
Reported-by: Teodor Milkov <tm@del.bg>
Signed-off-by: Yuchung Cheng <ycheng@google.com>
Signed-off-by: Neal Cardwell <ncardwell@google.com>
---
 net/ipv4/tcp_input.c | 30 ++++++++++++------------------
 1 file changed, 12 insertions(+), 18 deletions(-)

diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index cd8ea972dc65..8d480542aa07 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -1909,6 +1909,7 @@ void tcp_enter_loss(struct sock *sk)
 	struct tcp_sock *tp = tcp_sk(sk);
 	struct net *net = sock_net(sk);
 	struct sk_buff *skb;
+	bool new_recovery = icsk->icsk_ca_state < TCP_CA_Recovery;
 	bool is_reneg;			/* is receiver reneging on SACKs? */
 	bool mark_lost;
 
@@ -1967,15 +1968,12 @@ void tcp_enter_loss(struct sock *sk)
 	tp->high_seq = tp->snd_nxt;
 	tcp_ecn_queue_cwr(tp);
 
-	/* F-RTO RFC5682 sec 3.1 step 1 mandates to disable F-RTO
-	 * if a previous recovery is underway, otherwise it may incorrectly
-	 * call a timeout spurious if some previously retransmitted packets
-	 * are s/acked (sec 3.2). We do not apply that retriction since
-	 * retransmitted skbs are permanently tagged with TCPCB_EVER_RETRANS
-	 * so FLAG_ORIG_SACK_ACKED is always correct. But we do disable F-RTO
-	 * on PTMU discovery to avoid sending new data.
+	/* F-RTO RFC5682 sec 3.1 step 1: retransmit SND.UNA if no previous
+	 * loss recovery is underway except recurring timeout(s) on
+	 * the same SND.UNA (sec 3.2). Disable F-RTO on path MTU probing
 	 */
 	tp->frto = net->ipv4.sysctl_tcp_frto &&
+		   (new_recovery || icsk->icsk_retransmits) &&
 		   !inet_csk(sk)->icsk_mtup.probe_size;
 }
 
@@ -2628,18 +2626,14 @@ static void tcp_process_loss(struct sock *sk, int flag, bool is_dupack,
 	    tcp_try_undo_loss(sk, false))
 		return;
 
-	/* The ACK (s)acks some never-retransmitted data meaning not all
-	 * the data packets before the timeout were lost. Therefore we
-	 * undo the congestion window and state. This is essentially
-	 * the operation in F-RTO (RFC5682 section 3.1 step 3.b). Since
-	 * a retransmitted skb is permantly marked, we can apply such an
-	 * operation even if F-RTO was not used.
-	 */
-	if ((flag & FLAG_ORIG_SACK_ACKED) &&
-	    tcp_try_undo_loss(sk, tp->undo_marker))
-		return;
-
 	if (tp->frto) { /* F-RTO RFC5682 sec 3.1 (sack enhanced version). */
+		/* Step 3.b. A timeout is spurious if not all data are
+		 * lost, i.e., never-retransmitted data are (s)acked.
+		 */
+		if ((flag & FLAG_ORIG_SACK_ACKED) &&
+		    tcp_try_undo_loss(sk, true))
+			return;
+
 		if (after(tp->snd_nxt, tp->high_seq)) {
 			if (flag & FLAG_DATA_SACKED || is_dupack)
 				tp->frto = 0; /* Step 3.a. loss was real */
-- 
2.16.1.291.g4437f3f132-goog

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

* Re: [PATCH 0/2 net] revert a F-RTO extension due to broken middle-boxes
  2018-02-27 22:15 [PATCH 0/2 net] revert a F-RTO extension due to broken middle-boxes Yuchung Cheng
  2018-02-27 22:15 ` [PATCH 1/2 net] tcp: revert F-RTO middle-box workaround Yuchung Cheng
  2018-02-27 22:15 ` [PATCH 2/2 net] tcp: revert F-RTO extension to detect more spurious timeouts Yuchung Cheng
@ 2018-02-28 16:38 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2018-02-28 16:38 UTC (permalink / raw)
  To: ycheng; +Cc: netdev, ncardwell, tm

From: Yuchung Cheng <ycheng@google.com>
Date: Tue, 27 Feb 2018 14:15:00 -0800

> This patch series reverts a (non-standard) TCP F-RTO extension that aimed
> to detect more spurious timeouts. Unfortunately it could result in poor
> performance due to broken middle-boxes that modify TCP packets. E.g.
> https://www.spinics.net/lists/netdev/msg484154.html
> We believe the best and simplest solution is to just revert the change.

Fair enough.

Series applied and queued up for -stable, thanks.

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

end of thread, other threads:[~2018-02-28 16:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-27 22:15 [PATCH 0/2 net] revert a F-RTO extension due to broken middle-boxes Yuchung Cheng
2018-02-27 22:15 ` [PATCH 1/2 net] tcp: revert F-RTO middle-box workaround Yuchung Cheng
2018-02-27 22:15 ` [PATCH 2/2 net] tcp: revert F-RTO extension to detect more spurious timeouts Yuchung Cheng
2018-02-28 16:38 ` [PATCH 0/2 net] revert a F-RTO extension due to broken middle-boxes David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.