From patchwork Wed May 16 23:40:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yuchung Cheng X-Patchwork-Id: 915011 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@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=pass (p=reject dis=none) header.from=google.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="qqKfdOKW"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 40mWCL24bmz9s1B for ; Thu, 17 May 2018 09:40:46 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751665AbeEPXkm (ORCPT ); Wed, 16 May 2018 19:40:42 -0400 Received: from mail-wm0-f65.google.com ([74.125.82.65]:54746 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751438AbeEPXkk (ORCPT ); Wed, 16 May 2018 19:40:40 -0400 Received: by mail-wm0-f65.google.com with SMTP id f6-v6so5246191wmc.4 for ; Wed, 16 May 2018 16:40:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=A/dDemnUIoD56+1lPiwy4Y1M9ua7HFkRNQ84/XPiIPA=; b=qqKfdOKW1b7/iRB1aPFqp1gRs6wEG93M02HNayTw5es9Zz7mTpy7NF6QgLhY6f7VQt heVGgb7hHGw4l0kJMxoipjXrUiqQ1k2FQ7iCxn/hM5qQkCS1jxPyMm53wVhlgJkILPWt pwzHk8pxYzg/oDBaeP9wW7NBP+5GHXP8IVBV0HPEMUs9iBgfu36qmQAsS+8p0YH66ueK uSF1fD/050JpWV+vQXdRBaRjxToOMl/efW22lZrZCoyuDew/D6f3PemGLXx7oFFgRPLL GTpPvWc21rLfUJQYA5QiPkOtekD8uph7mm6gvHo0jF46fQDaG7Sczg1DJ1w+JNB+MZ/B id1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=A/dDemnUIoD56+1lPiwy4Y1M9ua7HFkRNQ84/XPiIPA=; b=oLvxLN/YedKtkGQQkl+CHiNw67X1TJoeT7SkpHh4UNjXHU4P2ZXzq9CW8Cag2CvDo6 xEaltTsHKhiJY3uGRI3dxQ9TGAJ8eBI7GMuLxBDuas1pixgt0Qbv/DH8M35SqnKmrFr4 xo76StdZ6w7fnPeywZzh7WCdlU1CfDWkoGHIEORxCEhkpgF5reDjnQt6sQ6gtDY7s5T1 R1CAHHapoECj9fbO6n28P+65FEmQUaM8S5hNvlP2qdHsBWY0rFBDpicKVBx1TzzNjAIc XTSu8TIxD+EowVHdmUBZDmYl/U2mAeo+wEU1jkU+eP4Q4ItYRAXJ6JP7oPiQaddBhNaC EYdA== X-Gm-Message-State: ALKqPwdl0q9TSAy1h4bNtx8Jd1KQzmO+AzUMHfJiw2+k/GOt9kurI2Dc 3DON77yTEVTP1YhvCeNKB6EGmw== X-Google-Smtp-Source: AB8JxZqvqQ6Ustp1LL48upyQV87PDmrkAifO+ehAAnOlEsPgFIZIUdlyfeAxTFbE3FY+R53+YSVkDA== X-Received: by 2002:a1c:1a53:: with SMTP id a80-v6mr203266wma.36.1526514039353; Wed, 16 May 2018 16:40:39 -0700 (PDT) Received: from ycheng2.svl.corp.google.com ([2620:15c:2c4:201:d660:6c0b:8a4f:4c77]) by smtp.gmail.com with ESMTPSA id b11-v6sm4796488wrf.50.2018.05.16.16.40.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 16 May 2018 16:40:38 -0700 (PDT) From: Yuchung Cheng To: davem@davemloft.net Cc: netdev@vger.kernel.org, edumazet@google.com, ncardwell@google.com, soheil@google.com, priyarjha@google.com, Yuchung Cheng Subject: [PATCH net-next 2/8] tcp: disable RFC6675 loss detection Date: Wed, 16 May 2018 16:40:11 -0700 Message-Id: <20180516234017.172775-3-ycheng@google.com> X-Mailer: git-send-email 2.17.0.441.gb46fe60e1d-goog In-Reply-To: <20180516234017.172775-1-ycheng@google.com> References: <20180516234017.172775-1-ycheng@google.com> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org This patch disables RFC6675 loss detection and make sysctl net.ipv4.tcp_recovery = 1 controls a binary choice between RACK (1) or RFC6675 (0). Signed-off-by: Yuchung Cheng Signed-off-by: Neal Cardwell Reviewed-by: Eric Dumazet Reviewed-by: Soheil Hassas Yeganeh Reviewed-by: Priyaranjan Jha --- Documentation/networking/ip-sysctl.txt | 3 ++- net/ipv4/tcp_input.c | 12 ++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/Documentation/networking/ip-sysctl.txt b/Documentation/networking/ip-sysctl.txt index 13bbac50dc8b..ea304a23c8d7 100644 --- a/Documentation/networking/ip-sysctl.txt +++ b/Documentation/networking/ip-sysctl.txt @@ -449,7 +449,8 @@ tcp_recovery - INTEGER features. RACK: 0x1 enables the RACK loss detection for fast detection of lost - retransmissions and tail drops. + retransmissions and tail drops. It also subsumes and disables + RFC6675 recovery for SACK connections. RACK: 0x2 makes RACK's reordering window static (min_rtt/4). RACK: 0x4 disables RACK's DUPACK threshold heuristic diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index b188e0d75edd..ccbe04f80040 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c @@ -2035,6 +2035,11 @@ static inline int tcp_dupack_heuristics(const struct tcp_sock *tp) return tp->sacked_out + 1; } +static bool tcp_is_rack(const struct sock *sk) +{ + return sock_net(sk)->ipv4.sysctl_tcp_recovery & TCP_RACK_LOSS_DETECTION; +} + /* Linux NewReno/SACK/ECN state machine. * -------------------------------------- * @@ -2141,7 +2146,7 @@ static bool tcp_time_to_recover(struct sock *sk, int flag) return true; /* Not-A-Trick#2 : Classic rule... */ - if (tcp_dupack_heuristics(tp) > tp->reordering) + if (!tcp_is_rack(sk) && tcp_dupack_heuristics(tp) > tp->reordering) return true; return false; @@ -2722,8 +2727,7 @@ static void tcp_rack_identify_loss(struct sock *sk, int *ack_flag) { struct tcp_sock *tp = tcp_sk(sk); - /* Use RACK to detect loss */ - if (sock_net(sk)->ipv4.sysctl_tcp_recovery & TCP_RACK_LOSS_DETECTION) { + if (tcp_is_rack(sk)) { u32 prior_retrans = tp->retrans_out; tcp_rack_mark_lost(sk); @@ -2862,7 +2866,7 @@ static void tcp_fastretrans_alert(struct sock *sk, const u32 prior_snd_una, fast_rexmit = 1; } - if (do_lost) + if (!tcp_is_rack(sk) && do_lost) tcp_update_scoreboard(sk, fast_rexmit); *rexmit = REXMIT_LOST; }