Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp1143888iob; Wed, 4 May 2022 15:52:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJybQpg9thDmneFiZHyL3/1qoZsMUOg3sUSpiOXdrNc4u7ARqq5OZn3N/Nqzf2SVGssUfX1J X-Received: by 2002:a50:954b:0:b0:41a:c9cb:8778 with SMTP id v11-20020a50954b000000b0041ac9cb8778mr26024366eda.165.1651704721375; Wed, 04 May 2022 15:52:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651704721; cv=none; d=google.com; s=arc-20160816; b=LH4G8Z4KK/vECCM7Yj/NoHfwRcGa4h4FcF4dpNB+LNyj7Su9FDOneQnqw7CrQhmVkM 3cbUhqtM1ldC3i+CL9luWyaSPPZzLz+fn8ivxK4YWi1y5SWAuvCGBj6vEuVxiJQQ5/j0 kO5GPbvUQWnh0hd84Fibupp8M2ry7GiFVzK+isJQ4cBfEM7hCzfTkGO1PwcbqonKXBr+ VzkySUCFpVMZyebTVIabBpqHLeZzyZdBT0p5Rm8CWLgXaEeqNJVPAAZ008yikH2Yj1iH M62HjJYGAixkDCM1aJQmkewP4VH8vRvb552VhcqQzal3oCE2AaLsw7n2gSARpYJGExKK +MpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=CNn6t2qrwTF1Mj2uo20fVFw9b2j+sYUesW+VYP+7Id4=; b=DNgDCpn48qKBiIC3yU7409OwhR8M1kZhJ/kVhOOUZmZIlp6lFhfj/IdvpN9oJs7oqs bhbXmzG0ErSj6WyBroAPTujuU5MbMk1hHj3qffuRiI9Bjf+B7Lv3KVBoqt4OIuEzpK+7 ILBfJPmcnqzUEbhPdUTN0Yu/WXH79G5OwqsRqZHXzRzRAlmC+jWKvPs/oPZVCgzZ3VgE cU9zslkr6mT+pojP3n+6QbsTECuQVzZZeUcbJi5+IjAtARk4S5kYMujo6/xjtfnjEZcL ZOuqAgWT9bizMZ4CJqA4ovwuQQVfmaKSVkkrOHXUQWCW0nzVp4pFFNnSRQ3ZH1Ac+khR kvMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YILkD6aL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nc11-20020a1709071c0b00b006df76385bf9si357228ejc.153.2022.05.04.15.51.38; Wed, 04 May 2022 15:52:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YILkD6aL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353390AbiEDR1f (ORCPT + 99 others); Wed, 4 May 2022 13:27:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51398 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355522AbiEDRHs (ORCPT ); Wed, 4 May 2022 13:07:48 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 70C8A51597; Wed, 4 May 2022 09:54:24 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 93ED7CE2625; Wed, 4 May 2022 16:54:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C41BFC385A5; Wed, 4 May 2022 16:54:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1651683260; bh=J+jBo16iQs/BiLfou3/SFc7FzOVPopt9RazhfTcTP6o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YILkD6aLeVaMEsIkqRHcu8K3UsGcEtF02q5HTWlI/CLtC7pIM6YpAOS8Z7WkyTMe5 rQZF/w4AAmo350ZdyN22JQyOmyHWouLV3swc0BmDI+W9iAWjO9OYA2ip7H26cUDszX h6/sF6mXFgz0qycR7Ri3MCdJa27/oGwP/SDyTLsA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pengcheng Yang , Neal Cardwell , Eric Dumazet , Jakub Kicinski , Sasha Levin Subject: [PATCH 5.15 126/177] tcp: fix F-RTO may not work correctly when receiving DSACK Date: Wed, 4 May 2022 18:45:19 +0200 Message-Id: <20220504153104.380107754@linuxfoundation.org> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20220504153053.873100034@linuxfoundation.org> References: <20220504153053.873100034@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pengcheng Yang [ Upstream commit d9157f6806d1499e173770df1f1b234763de5c79 ] Currently DSACK is regarded as a dupack, which may cause F-RTO to incorrectly enter "loss was real" when receiving DSACK. Packetdrill to demonstrate: // Enable F-RTO and TLP 0 `sysctl -q net.ipv4.tcp_frto=2` 0 `sysctl -q net.ipv4.tcp_early_retrans=3` 0 `sysctl -q net.ipv4.tcp_congestion_control=cubic` // Establish a connection +0 socket(..., SOCK_STREAM, IPPROTO_TCP) = 3 +0 setsockopt(3, SOL_SOCKET, SO_REUSEADDR, [1], 4) = 0 +0 bind(3, ..., ...) = 0 +0 listen(3, 1) = 0 // RTT 10ms, RTO 210ms +.1 < S 0:0(0) win 32792 +0 > S. 0:0(0) ack 1 <...> +.01 < . 1:1(0) ack 1 win 257 +0 accept(3, ..., ...) = 4 // Send 2 data segments +0 write(4, ..., 2000) = 2000 +0 > P. 1:2001(2000) ack 1 // TLP +.022 > P. 1001:2001(1000) ack 1 // Continue to send 8 data segments +0 write(4, ..., 10000) = 10000 +0 > P. 2001:10001(8000) ack 1 // RTO +.188 > . 1:1001(1000) ack 1 // The original data is acked and new data is sent(F-RTO step 2.b) +0 < . 1:1(0) ack 2001 win 257 +0 > P. 10001:12001(2000) ack 1 // D-SACK caused by TLP is regarded as a dupack, this results in // the incorrect judgment of "loss was real"(F-RTO step 3.a) +.022 < . 1:1(0) ack 2001 win 257 // Never-retransmitted data(3001:4001) are acked and // expect to switch to open state(F-RTO step 3.b) +0 < . 1:1(0) ack 4001 win 257 +0 %{ assert tcpi_ca_state == 0, tcpi_ca_state }% Fixes: e33099f96d99 ("tcp: implement RFC5682 F-RTO") Signed-off-by: Pengcheng Yang Acked-by: Neal Cardwell Tested-by: Neal Cardwell Reviewed-by: Eric Dumazet Link: https://lore.kernel.org/r/1650967419-2150-1-git-send-email-yangpc@wangsu.com Signed-off-by: Jakub Kicinski Signed-off-by: Sasha Levin --- net/ipv4/tcp_input.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 6bd283b58bb8..dfd32cd3b95e 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c @@ -3860,7 +3860,8 @@ static int tcp_ack(struct sock *sk, const struct sk_buff *skb, int flag) tcp_process_tlp_ack(sk, ack, flag); if (tcp_ack_is_dubious(sk, flag)) { - if (!(flag & (FLAG_SND_UNA_ADVANCED | FLAG_NOT_DUP))) { + if (!(flag & (FLAG_SND_UNA_ADVANCED | + FLAG_NOT_DUP | FLAG_DSACKING_ACK))) { num_dupack = 1; /* Consider if pure acks were aggregated in tcp_add_backlog() */ if (!(flag & FLAG_DATA)) -- 2.35.1