Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp649136pxb; Tue, 2 Feb 2021 14:19:45 -0800 (PST) X-Google-Smtp-Source: ABdhPJynCxMkxiaobic3EsNbaMxjgRuPjvTkB+zYU1/Kcok/YaRSiyoncGuf+3/CH6QTSXc4yFGX X-Received: by 2002:a17:907:f81:: with SMTP id kb1mr147241ejc.466.1612304385764; Tue, 02 Feb 2021 14:19:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612304385; cv=none; d=google.com; s=arc-20160816; b=tpgCtfS2RolMmz4rO7h17QPNEMfaxBraPX5h6eVNYQzfp7Mmj5EnzgM0SijCRD8YBI 5t6S71H1m9gl4pw0LxiAbQWIEv12dg5j2msvWCeobf+OHchSRn/83g8+jq5gMa7P0We6 x7hRgkKwfxhO65CX6ppDdVMBwYDwQ6KLkO0hHtNe4/ojRRYnYoOzogGnhf0PecL0we00 APO5iq7akZmsf3CvVVOEadXjpT7KiwjB0UxMW4NwJ918g+mD+Pb5wq9aW3QQ5+ElkQMt 5EoJt94CuGZGraI4KBGcCKZ1unjOqSk3xfgN/NHCFuQwHKC/N0P5n7Svf7A8NwzHHCgT IcUQ== 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=2n+6TFuOhhyyqBgUG2YHB1TNSy3vqL2TIFWhvKmtNys=; b=uLyZeC6kg0v8THabc63fbNoS1iMtyc8JEigUOyzP93DJkwT8Pi96ejSyTgsRsXGg7e zy+v6cIScn5T7593Uxd+dRaPveEqQhG6gMLKowwMwr+m4492Xp2I/QBJkEmKHrBPKLZy +2+TNWJKpLp2HYZsx1CdATja8zk3a6a3at7do1meMRAn7MPuplUC/RoZOVNHWwdi/oN5 CgeWPt/KYA0mX3nm93x1HFUuWEEkvCs+QQ4SS/fJUJU8yN4VsnRQeSKrlslQPtsuUHC8 f50151s+Q6ChWCmt0Gxwz8QwyaK7WmnIH0H9JA8UrGsrwzyBPwSJz9R2ZzDBYA0HQOZK 1l8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Bz7UyD0y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t11si46833edy.360.2021.02.02.14.19.15; Tue, 02 Feb 2021 14:19:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Bz7UyD0y; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S233799AbhBBOEy (ORCPT + 99 others); Tue, 2 Feb 2021 09:04:54 -0500 Received: from mail.kernel.org ([198.145.29.99]:45176 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233490AbhBBN6H (ORCPT ); Tue, 2 Feb 2021 08:58:07 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 2709B64FEE; Tue, 2 Feb 2021 13:45:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1612273557; bh=l00wV1+YoK7MeAPs/FQBEld8Uj2td0c8JIY+IRsSDsQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Bz7UyD0yw85hQyxRcwfTIZc6tEV8+FXZVuNa1YYPSUWSC5gddPgkmuAqDZ4Fl0BHm IwbMsib0tLv3c97kPMlTiilZSwCt5t9k+ZrCCeQ703e10A5wRvkMMs7f5+bwQ548RO gaea/f4nkYuU8sGo0lMqd9rPKef0s6MWAb2bUHf8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Pengcheng Yang , Neal Cardwell , Yuchung Cheng , Eric Dumazet , Jakub Kicinski Subject: [PATCH 5.10 142/142] tcp: fix TLP timer not set when CA_STATE changes from DISORDER to OPEN Date: Tue, 2 Feb 2021 14:38:25 +0100 Message-Id: <20210202133003.550702426@linuxfoundation.org> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20210202132957.692094111@linuxfoundation.org> References: <20210202132957.692094111@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Pengcheng Yang commit 62d9f1a6945ba69c125e548e72a36d203b30596e upstream. Upon receiving a cumulative ACK that changes the congestion state from Disorder to Open, the TLP timer is not set. If the sender is app-limited, it can only wait for the RTO timer to expire and retransmit. The reason for this is that the TLP timer is set before the congestion state changes in tcp_ack(), so we delay the time point of calling tcp_set_xmit_timer() until after tcp_fastretrans_alert() returns and remove the FLAG_SET_XMIT_TIMER from ack_flag when the RACK reorder timer is set. This commit has two additional benefits: 1) Make sure to reset RTO according to RFC6298 when receiving ACK, to avoid spurious RTO caused by RTO timer early expires. 2) Reduce the xmit timer reschedule once per ACK when the RACK reorder timer is set. Fixes: df92c8394e6e ("tcp: fix xmit timer to only be reset if data ACKed/SACKed") Link: https://lore.kernel.org/netdev/1611311242-6675-1-git-send-email-yangpc@wangsu.com Signed-off-by: Pengcheng Yang Acked-by: Neal Cardwell Acked-by: Yuchung Cheng Cc: Eric Dumazet Link: https://lore.kernel.org/r/1611464834-23030-1-git-send-email-yangpc@wangsu.com Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- include/net/tcp.h | 2 +- net/ipv4/tcp_input.c | 10 ++++++---- net/ipv4/tcp_recovery.c | 5 +++-- 3 files changed, 10 insertions(+), 7 deletions(-) --- a/include/net/tcp.h +++ b/include/net/tcp.h @@ -2066,7 +2066,7 @@ void tcp_mark_skb_lost(struct sock *sk, void tcp_newreno_mark_lost(struct sock *sk, bool snd_una_advanced); extern s32 tcp_rack_skb_timeout(struct tcp_sock *tp, struct sk_buff *skb, u32 reo_wnd); -extern void tcp_rack_mark_lost(struct sock *sk); +extern bool tcp_rack_mark_lost(struct sock *sk); extern void tcp_rack_advance(struct tcp_sock *tp, u8 sacked, u32 end_seq, u64 xmit_time); extern void tcp_rack_reo_timeout(struct sock *sk); --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c @@ -2845,7 +2845,8 @@ static void tcp_identify_packet_loss(str } else if (tcp_is_rack(sk)) { u32 prior_retrans = tp->retrans_out; - tcp_rack_mark_lost(sk); + if (tcp_rack_mark_lost(sk)) + *ack_flag &= ~FLAG_SET_XMIT_TIMER; if (prior_retrans > tp->retrans_out) *ack_flag |= FLAG_LOST_RETRANS; } @@ -3802,9 +3803,6 @@ static int tcp_ack(struct sock *sk, cons if (tp->tlp_high_seq) tcp_process_tlp_ack(sk, ack, flag); - /* If needed, reset TLP/RTO timer; RACK may later override this. */ - if (flag & FLAG_SET_XMIT_TIMER) - tcp_set_xmit_timer(sk); if (tcp_ack_is_dubious(sk, flag)) { if (!(flag & (FLAG_SND_UNA_ADVANCED | FLAG_NOT_DUP))) { @@ -3817,6 +3815,10 @@ static int tcp_ack(struct sock *sk, cons &rexmit); } + /* If needed, reset TLP/RTO timer when RACK doesn't set. */ + if (flag & FLAG_SET_XMIT_TIMER) + tcp_set_xmit_timer(sk); + if ((flag & FLAG_FORWARD_PROGRESS) || !(flag & FLAG_NOT_DUP)) sk_dst_confirm(sk); --- a/net/ipv4/tcp_recovery.c +++ b/net/ipv4/tcp_recovery.c @@ -96,13 +96,13 @@ static void tcp_rack_detect_loss(struct } } -void tcp_rack_mark_lost(struct sock *sk) +bool tcp_rack_mark_lost(struct sock *sk) { struct tcp_sock *tp = tcp_sk(sk); u32 timeout; if (!tp->rack.advanced) - return; + return false; /* Reset the advanced flag to avoid unnecessary queue scanning */ tp->rack.advanced = 0; @@ -112,6 +112,7 @@ void tcp_rack_mark_lost(struct sock *sk) inet_csk_reset_xmit_timer(sk, ICSK_TIME_REO_TIMEOUT, timeout, inet_csk(sk)->icsk_rto); } + return !!timeout; } /* Record the most recently (re)sent time among the (s)acked packets