From patchwork Fri Mar 9 14:10:30 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: 883651 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 3zyTn93vfBz9sbb for ; Sat, 10 Mar 2018 01:10:53 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751170AbeCIOKq (ORCPT ); Fri, 9 Mar 2018 09:10:46 -0500 Received: from smtp-rs1-vallila2.fe.helsinki.fi ([128.214.173.75]:38242 "EHLO smtp-rs1-vallila2.fe.helsinki.fi" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751077AbeCIOKp (ORCPT ); Fri, 9 Mar 2018 09:10:45 -0500 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 w29EAc1S026169; Fri, 9 Mar 2018 16:10:38 +0200 Received: by whs-18.cs.helsinki.fi (Postfix, from userid 1070048) id 9C1F336038A; Fri, 9 Mar 2018 16:10:38 +0200 (EET) From: =?utf-8?q?Ilpo_J=C3=A4rvinen?= To: netdev@vger.kernel.org Cc: Yuchung Cheng , Neal Cardwell , Eric Dumazet Subject: [PATCH v2 net 3/5] tcp: move false FR condition into tcp_false_fast_retrans_possible() Date: Fri, 9 Mar 2018 16:10:30 +0200 Message-Id: <1520604632-21185-4-git-send-email-ilpo.jarvinen@helsinki.fi> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1520604632-21185-1-git-send-email-ilpo.jarvinen@helsinki.fi> References: <1520604632-21185-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 No functional changes. This change simplifies the next change slightly. Signed-off-by: Ilpo Järvinen --- net/ipv4/tcp_input.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 1277afb..4ccba94 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c @@ -2211,6 +2211,17 @@ static void tcp_update_scoreboard(struct sock *sk, int fast_rexmit) } } +/* False fast retransmits may occur when SACK is not in use under certain + * conditions (RFC6582). The sender MUST hold old state until something + * *above* high_seq is ACKed to prevent triggering such false fast + * retransmits. SACK TCP is safe. + */ +static bool tcp_false_fast_retrans_possible(const struct tcp_sock *tp, + const u32 snd_una) +{ + return tcp_is_reno(tp) && (snd_una == tp->high_seq); +} + static bool tcp_tsopt_ecr_before(const struct tcp_sock *tp, u32 when) { return tp->rx_opt.saw_tstamp && tp->rx_opt.rcv_tsecr && @@ -2350,10 +2361,10 @@ static bool tcp_try_undo_recovery(struct sock *sk) } else if (tp->rack.reo_wnd_persist) { tp->rack.reo_wnd_persist--; } - if (tp->snd_una == tp->high_seq && tcp_is_reno(tp)) { - /* Hold old state until something *above* high_seq - * is ACKed. For Reno it is MUST to prevent false - * fast retransmits (RFC2582). SACK TCP is safe. */ + if (tcp_false_fast_retrans_possible(tp, tp->snd_una)) { + /* Hold old state until something *above* high_seq is ACKed + * if false fast retransmit is possible. + */ if (!tcp_any_retrans_done(sk)) tp->retrans_stamp = 0; return true;