From patchwork Wed Mar 7 12:59:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ilpo_J=C3=A4rvinen?= X-Patchwork-Id: 882614 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=helsinki.fi Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3zxFhH50Ddz9sWm for ; Thu, 8 Mar 2018 01:02:23 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933407AbeCGOCJ (ORCPT ); Wed, 7 Mar 2018 09:02:09 -0500 Received: from smtp-rs1-vallila2.fe.helsinki.fi ([128.214.173.75]:60022 "EHLO smtp-rs1-vallila2.fe.helsinki.fi" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933173AbeCGOCD (ORCPT ); Wed, 7 Mar 2018 09:02:03 -0500 X-Greylist: delayed 3743 seconds by postgrey-1.27 at vger.kernel.org; Wed, 07 Mar 2018 09:01:59 EST Received: from whs-18.cs.helsinki.fi (whs-18.cs.helsinki.fi [128.214.166.46]) by smtp-rs1.it.helsinki.fi (8.14.4/8.14.4) with ESMTP id w27CxXxO018155; Wed, 7 Mar 2018 14:59:33 +0200 Received: by whs-18.cs.helsinki.fi (Postfix, from userid 1070048) id 1F298360367; Wed, 7 Mar 2018 14:59:33 +0200 (EET) From: =?utf-8?q?Ilpo_J=C3=A4rvinen?= To: netdev@vger.kernel.org Subject: [PATCH net 2/5] tcp: prevent bogus FRTO undos with non-SACK flows Date: Wed, 7 Mar 2018 14:59:26 +0200 Message-Id: <1520427569-14365-3-git-send-email-ilpo.jarvinen@helsinki.fi> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1520427569-14365-1-git-send-email-ilpo.jarvinen@helsinki.fi> References: <1520427569-14365-1-git-send-email-ilpo.jarvinen@helsinki.fi> MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org In a non-SACK case, any non-retransmitted segment acknowledged will set FLAG_ORIG_SACK_ACKED in tcp_clean_rtx_queue even if there is no indication that it would have been delivered for real (the scoreboard is not kept with TCPCB_SACKED_ACKED bits in the non-SACK case). This causes bogus undos in ordinary RTO recoveries where segments are lost here and there, with a few delivered segments in between losses. A cumulative ACKs will cover retransmitted ones at the bottom and the non-retransmitted ones following that causing FLAG_ORIG_SACK_ACKED to be set in tcp_clean_rtx_queue and results in a spurious FRTO undo. We need to make the check more strict for non-SACK case and check that none of the cumulatively ACKed segments were retransmitted, which would be the case for the last step of FRTO algorithm as we sent out only new segments previously. Only then, allow FRTO undo to proceed in non-SACK case. Signed-off-by: Ilpo Järvinen --- net/ipv4/tcp_input.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 0305f6d..1a33752 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c @@ -2629,8 +2629,13 @@ static void tcp_process_loss(struct sock *sk, int flag, bool is_dupack, 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. + * + * As the non-SACK case does not keep track of TCPCB_SACKED_ACKED, + * we need to ensure that none of the cumulative ACKed segments + * was retransmitted to confirm the validity of FLAG_ORIG_SACK_ACKED. */ if ((flag & FLAG_ORIG_SACK_ACKED) && + (tcp_is_sack(tp) || !(flag & FLAG_RETRANS_DATA_ACKED)) && tcp_try_undo_loss(sk, true)) return;