From patchwork Tue Jul 27 14:42:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neal Cardwell X-Patchwork-Id: 12402979 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-26.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT,USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 571AAC432BE for ; Tue, 27 Jul 2021 14:43:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 38B6D61AF0 for ; Tue, 27 Jul 2021 14:43:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236848AbhG0OnP (ORCPT ); Tue, 27 Jul 2021 10:43:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51474 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232432AbhG0OnO (ORCPT ); Tue, 27 Jul 2021 10:43:14 -0400 Received: from mail-qk1-x749.google.com (mail-qk1-x749.google.com [IPv6:2607:f8b0:4864:20::749]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CA034C061757 for ; Tue, 27 Jul 2021 07:43:14 -0700 (PDT) Received: by mail-qk1-x749.google.com with SMTP id w2-20020a3794020000b02903b54f40b442so11827437qkd.0 for ; Tue, 27 Jul 2021 07:43:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=HI9N3kwYafXDHt7eo8Df3ukt9WAl+1iGr81tB1AijR4=; b=IDIkLC9BElF1WDlvqxLqYrkeT7qCpZkwBxBWf6cG3n5eqKPbbHvTMQ/AcG6dQjSLIz r0P2FYRkpkLOxd2MSQhhkQO4ykzWxdBm+6OX5RIILPxnuNxz9sfgz7VlPnN2qSaUmwgn Rbpgoh/KOmXutDfk/zBwrIVRKRwvs1G7hkiebUG7Lq4vAZyEqYgnuePbMamHTe3+luh/ ln2+sk58A5l6aVhd3a8h+Cq3LBwJHqetamhiNoge0kEU6GiLEIgHmWDTouQcP5gIYDHa Jj1fmB6/eaxVuy9XK22/IK0uizf6qEoe6toganoWbsTjsDmJ/AVrvbiO64ZeG9Um6LMc 7GzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=HI9N3kwYafXDHt7eo8Df3ukt9WAl+1iGr81tB1AijR4=; b=hIjOY0BOXosIwhG7KqPX3MvuRQTHjuhhN49DoqYwwyee8yJaWH1jeh9y8amwEyBrIU WjHWVvJSWMqRWvUll5smXHJ+hwUCOmoYrAVSQin/tE72V5iK+8Yw5z9ExfY6VHkqOzEs kDdk8ap9pSIXjLCt8j7YWluoOqNA8/7BSkrNvjRl8ZECFTN0zOQnF12zJo2lxH9p+Vzp Usy88yo0ZoHMSS1wQ22jRgkT0VEMKvRmqsZgDM5m5wwDezPiYRSNiBoctnXrpBPxOWHY NPKb5LMoKMmEDy2knO06RmZjYduwSPHynqnCay1xXk0yM+q3qJC6IDreYuSd9IGmfKwk 0JvQ== X-Gm-Message-State: AOAM533kn8vmSys2efyScEmXd3hg9xxlrGY6juTZj3+QiJ3Cp2Jsz0Hv Av8Qu2vgS8a805fLkwB150Efu+oEXWq6fOA= X-Google-Smtp-Source: ABdhPJxUy+iJxWguA9nCaRrjz8W9+yl0QjyAiEWIEQu6awFSE3ik1vPGu7zdHQPGfZQ3+ppSrPfcK0sA4pyTp3g= X-Received: from soy.nyc.corp.google.com ([2620:0:1003:312:17c3:cd0f:c07d:756a]) (user=ncardwell job=sendgmr) by 2002:a0c:ed21:: with SMTP id u1mr9249963qvq.6.1627396993908; Tue, 27 Jul 2021 07:43:13 -0700 (PDT) Date: Tue, 27 Jul 2021 10:42:57 -0400 In-Reply-To: <20210727144258.946533-1-ncardwell@google.com> Message-Id: <20210727144258.946533-2-ncardwell@google.com> Mime-Version: 1.0 References: <20210727144258.946533-1-ncardwell@google.com> X-Mailer: git-send-email 2.32.0.432.gabb21c7263-goog Subject: [PATCH net-next 1/2] tcp: more accurately detect spurious TLP probes From: Neal Cardwell To: David Miller Cc: netdev@vger.kernel.org, Eric Dumazet , Yuchung Cheng , Neal Cardwell , Priyaranjan Jha Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: Yuchung Cheng Previously TLP is considered spurious if the sender receives any DSACK during a TLP episode. This patch further checks the DSACK sequences match the TLP's to improve accuracy. Signed-off-by: Yuchung Cheng Acked-by: Neal Cardwell Acked-by: Priyaranjan Jha --- net/ipv4/tcp_input.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 501d8d4d4ba4..98408d520c32 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c @@ -100,6 +100,7 @@ int sysctl_tcp_max_orphans __read_mostly = NR_FILE; #define FLAG_UPDATE_TS_RECENT 0x4000 /* tcp_replace_ts_recent() */ #define FLAG_NO_CHALLENGE_ACK 0x8000 /* do not call tcp_send_challenge_ack() */ #define FLAG_ACK_MAYBE_DELAYED 0x10000 /* Likely a delayed ACK */ +#define FLAG_DSACK_TLP 0x20000 /* DSACK for tail loss probe */ #define FLAG_ACKED (FLAG_DATA_ACKED|FLAG_SYN_ACKED) #define FLAG_NOT_DUP (FLAG_DATA|FLAG_WIN_UPDATE|FLAG_ACKED) @@ -991,6 +992,8 @@ static u32 tcp_dsack_seen(struct tcp_sock *tp, u32 start_seq, return 0; if (seq_len > tp->mss_cache) dup_segs = DIV_ROUND_UP(seq_len, tp->mss_cache); + else if (tp->tlp_high_seq && tp->tlp_high_seq == end_seq) + state->flag |= FLAG_DSACK_TLP; tp->dsack_dups += dup_segs; /* Skip the DSACK if dup segs weren't retransmitted by sender */ @@ -3650,7 +3653,7 @@ static void tcp_process_tlp_ack(struct sock *sk, u32 ack, int flag) if (!tp->tlp_retrans) { /* TLP of new data has been acknowledged */ tp->tlp_high_seq = 0; - } else if (flag & FLAG_DSACKING_ACK) { + } else if (flag & FLAG_DSACK_TLP) { /* This DSACK means original and TLP probe arrived; no loss */ tp->tlp_high_seq = 0; } else if (after(ack, tp->tlp_high_seq)) { From patchwork Tue Jul 27 14:42:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neal Cardwell X-Patchwork-Id: 12402981 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-26.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT,USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D29BFC4320A for ; Tue, 27 Jul 2021 14:43:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B847561AFB for ; Tue, 27 Jul 2021 14:43:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232344AbhG0OnU (ORCPT ); Tue, 27 Jul 2021 10:43:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51490 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232532AbhG0OnS (ORCPT ); Tue, 27 Jul 2021 10:43:18 -0400 Received: from mail-yb1-xb4a.google.com (mail-yb1-xb4a.google.com [IPv6:2607:f8b0:4864:20::b4a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 41CAEC061765 for ; Tue, 27 Jul 2021 07:43:17 -0700 (PDT) Received: by mail-yb1-xb4a.google.com with SMTP id q15-20020a25820f0000b029055bb0981111so18874915ybk.7 for ; Tue, 27 Jul 2021 07:43:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=X5GzPacoqmWKcqolIjhaSXxM8jBfub27LM1N+/rMMVY=; b=jCKNusFnZu02ZlaDcqBKQ11iF5dMjjeWPe48DHMuVs9+UXsP4aZuS5obbdnCua9bJa D08EoS3VvrVcvSEzm6ZbgTxGYOKpTyaI310Afaku2CqmeTOhVNxNheAqmVnTKLZ/noI4 1E/TJ6ibkVRIvoB+m199ZDh3nc7psvJVyeW3uhEGdv7DqfuH/z60lkEtKWPQ8P9rCysO FuEgCdTtCznmoPY7Osx4GuZLBg+yqAS7bEhbn9trzfJQdq3Q+ZU8E2h58oBH0an89JfH JgYXQhcTPIzVh3XHHwQA5RLM9nrRKOGWGkdyGLU51C9krrDwngr5udzNSSGD8UJexazv Jjxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=X5GzPacoqmWKcqolIjhaSXxM8jBfub27LM1N+/rMMVY=; b=qfr2ibbNpIyagCiAFMONLyTTPAfJhLcgi7xfbuSIA+xl/d/JoHs4IxewepHi9cblOg bU02Z07+CIJx1E2ke6/Y8kKtUyiU42BgSfswh4fTrnuhsMCK8saGzbiwMy+Po6fltuAP DL20FOWvRXhurQZqSYDfoZeF3quj6SGYlddhfVswjA+SEdpCLHJi5J37e13eYvroBc3/ Xsh5Cr4vfnVyj3kxCXLrmeMY6XcVQo5mDi/txWSwB9WAGfScWIjJerQoGpWLSo9NsK80 UwVHMsVCVByHyOHGeGW8vmvoOUNzFrZJFYb54OMeg83MR4q/0xiJ9BEhA94KRbtch2KX pCSg== X-Gm-Message-State: AOAM532rG1pcOaZnBQr2yqv12jofhCUO54Xy02UZuew/ubM8qOd8YDcw IRs+97hDyfdfH1ipUvXEfs0ywOU4e85Ib60= X-Google-Smtp-Source: ABdhPJwYGERG+GvnroqR0NBpl0KX0NHNRSd0jMW4+UTIrvv/a17ZP+qTEOf5E0mD9h18qtSe9d9NtngttLDWLSk= X-Received: from soy.nyc.corp.google.com ([2620:0:1003:312:17c3:cd0f:c07d:756a]) (user=ncardwell job=sendgmr) by 2002:a25:7ec4:: with SMTP id z187mr32046100ybc.136.1627396996434; Tue, 27 Jul 2021 07:43:16 -0700 (PDT) Date: Tue, 27 Jul 2021 10:42:58 -0400 In-Reply-To: <20210727144258.946533-1-ncardwell@google.com> Message-Id: <20210727144258.946533-3-ncardwell@google.com> Mime-Version: 1.0 References: <20210727144258.946533-1-ncardwell@google.com> X-Mailer: git-send-email 2.32.0.432.gabb21c7263-goog Subject: [PATCH net-next 2/2] tcp: more accurately check DSACKs to grow RACK reordering window From: Neal Cardwell To: David Miller Cc: netdev@vger.kernel.org, Eric Dumazet , Neal Cardwell , Yuchung Cheng , Priyaranjan Jha Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org Previously, a DSACK could expand the RACK reordering window when no reordering has been seen, and/or when the DSACK was due to an unnecessary TLP retransmit (rather than a spurious fast recovery due to reordering). This could result in unnecessarily growing the RACK reordering window and thus unnecessarily delaying RACK-based fast recovery episodes. To avoid these issues, this commit tightens the conditions under which a DSACK triggers the RACK reordering window to grow, so that a connection only expands its RACK reordering window if: (a) reordering has been seen in the connection (b) a DSACKed range does not match the most recent TLP retransmit Signed-off-by: Neal Cardwell Acked-by: Yuchung Cheng Acked-by: Priyaranjan Jha --- net/ipv4/tcp_input.c | 9 ++++++++- net/ipv4/tcp_recovery.c | 3 ++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 98408d520c32..3f7bd7ae7d7a 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c @@ -1001,7 +1001,14 @@ static u32 tcp_dsack_seen(struct tcp_sock *tp, u32 start_seq, return 0; tp->rx_opt.sack_ok |= TCP_DSACK_SEEN; - tp->rack.dsack_seen = 1; + /* We increase the RACK ordering window in rounds where we receive + * DSACKs that may have been due to reordering causing RACK to trigger + * a spurious fast recovery. Thus RACK ignores DSACKs that happen + * without having seen reordering, or that match TLP probes (TLP + * is timer-driven, not triggered by RACK). + */ + if (tp->reord_seen && !(state->flag & FLAG_DSACK_TLP)) + tp->rack.dsack_seen = 1; state->flag |= FLAG_DSACKING_ACK; /* A spurious retransmission is delivered */ diff --git a/net/ipv4/tcp_recovery.c b/net/ipv4/tcp_recovery.c index 6f1b4ac7fe99..fd113f6226ef 100644 --- a/net/ipv4/tcp_recovery.c +++ b/net/ipv4/tcp_recovery.c @@ -172,7 +172,8 @@ void tcp_rack_reo_timeout(struct sock *sk) /* Updates the RACK's reo_wnd based on DSACK and no. of recoveries. * - * If DSACK is received, increment reo_wnd by min_rtt/4 (upper bounded + * If a DSACK is received that seems like it may have been due to reordering + * triggering fast recovery, increment reo_wnd by min_rtt/4 (upper bounded * by srtt), since there is possibility that spurious retransmission was * due to reordering delay longer than reo_wnd. *