Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp841554ybl; Fri, 31 Jan 2020 08:57:30 -0800 (PST) X-Google-Smtp-Source: APXvYqwZEIx/dg/d9x9DQYyu0ZWmd0KR7yhwZLn1/jNBqaEoohbGSUO9Kfl5uoMzvYaBfeTl1HLe X-Received: by 2002:a9d:68c8:: with SMTP id i8mr8753018oto.34.1580489850563; Fri, 31 Jan 2020 08:57:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580489850; cv=none; d=google.com; s=arc-20160816; b=T6thweWv3CXkz3XyXxaROQ4Dqo1crpSc4dCNu0cbLVJfuwyLFZqMeSTRMMNCThzdko 7cEX9cIvQHzx5eYDyE2/jsKD1v22/l27nXqkOxyHMWeM96h26KFPQf/6I7gf9QLIALoj jZ47XVc7L4jbJkjXsCYTWd4O3cZSGAoQcybEJjvrpd3bVtzGszgXM0W7JqIJd6po0lX2 gAmUKUOOeFAMTO7ngd16ZWlXe+xGWTlL/+Y4d4B/lSRvZkay5yd7jziFH+81ASsdkDIC sIcVXkPEuPL0gKvV6c5cBIuZGAQn53A4HK66Qx1h29kIPsXk9fkkH6G4j9vJAIcjVhRW YdVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=6KhtHImXtz0JOAa4RO8x+lv3CDdZ2tWniHcetxHbNDM=; b=WU0zA062q6wwbuG/eUNzZmqBOYRQU4Q2hghvahiNLYsy7NOpd/BasLkapshj64sJIy x/vGSPyfF0Sq+A7IPmYy9MsYqShv2G3Cxgv3F2vwX2O1q07XM1Z/x3aT7KA6T/hgy2WV 2bDb6c8zPy/829jWBuviurigPi8n2IsQfhb46L+B22MyD+tgWlWg2Fa4yEZ4zqI1rd65 uTXR75+4O4Y+mIojLOvNBWRM+lwL3HaJZaU18GryaPMclgf/8CAQOWW4WBNron2X9izb ho2g3V5OeYVO3R4HqvhKps7V01XF6SLl8uCdbVYS339o3X6ocmaW46AsSDzZxTGcNO32 GUwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="cm0aso3/"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h128si4436182oif.258.2020.01.31.08.57.18; Fri, 31 Jan 2020 08:57:30 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="cm0aso3/"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726990AbgAaQzW (ORCPT + 99 others); Fri, 31 Jan 2020 11:55:22 -0500 Received: from mail-yw1-f68.google.com ([209.85.161.68]:46533 "EHLO mail-yw1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726139AbgAaQzV (ORCPT ); Fri, 31 Jan 2020 11:55:21 -0500 Received: by mail-yw1-f68.google.com with SMTP id z141so4847890ywd.13 for ; Fri, 31 Jan 2020 08:55:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=6KhtHImXtz0JOAa4RO8x+lv3CDdZ2tWniHcetxHbNDM=; b=cm0aso3/Xjvi4skad8txSnRwV2bnnpVCWs5H/1KesxyDUCchgXrPHUKtGgfkVrIzsr RhA/i4SUp2BpBBIijrJ1hq5NlmlUfmutY/imQFb6qcUBrPKcnO6RjnUtUzIRzk0k5eBV EOf/lVdhObbZ7QaFGuZlVmXc1qmLclUXsVXXD+de7m3c3nmLpdS7elL4LXGhgOPjHysz WrFDwnOHRJh8lms8SkByj18vTFjadZmwwNj4/a+RJTgB1qQJfypSpcUKJoOuT6qChWaI H1RwaSeIOjio8RJmhOq88wFsHisugJaCDK/IZaWJQeAc3XB8xxOCCxVrZLlUnZF36wgv 70Ig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=6KhtHImXtz0JOAa4RO8x+lv3CDdZ2tWniHcetxHbNDM=; b=o/sSkCulKB9TZGiUs+AgkreTrgOr+A6TVsj6uHzluf890mm9TvI/52Ey+OXM2ho8Ds mdfl8HcuVQcty1ySzwyh8xz/vrsl8kiqnC0RXv32CaMI+o7cG1Yj/mFunEpcySUL1PHs O3p6fDqGSo8ATFTV3FNE6M52KrbDw6JmTzuFNFw/oIvoODMlc5snCexkjihJ5QfZk/45 /4b9H6uupdhq/YwrGDBCNIYT9E3779ql11BafLWQP1lnyuiodSs/o/7A7dRqSnZhcxnt 00QC9ih7KCmeu9veo6wyVdvY7oPr8RyRUY4PUowWEJ+72ix/BJ2NMxho7Uycj3jsjBvw rnbw== X-Gm-Message-State: APjAAAVDWoK9DW01Y6t7vx7IKM+wBf12h8OB5AvGuAisWm/v7DyXFp7G ll7HdocLyGyW9JQvUXo01OGYBxx2wax/qWFcjCRsiQ== X-Received: by 2002:a81:3845:: with SMTP id f66mr9055421ywa.220.1580489719518; Fri, 31 Jan 2020 08:55:19 -0800 (PST) MIME-Version: 1.0 References: <20200131161200.8852-1-sjpark@amazon.com> In-Reply-To: <20200131161200.8852-1-sjpark@amazon.com> From: Eric Dumazet Date: Fri, 31 Jan 2020 08:55:08 -0800 Message-ID: Subject: Re: Re: [PATCH 2/3] tcp: Reduce SYN resend delay if a suspicous ACK is received To: sjpark@amazon.com Cc: David Miller , Shuah Khan , netdev , "open list:KERNEL SELFTEST FRAMEWORK" , LKML , sj38.park@gmail.com, aams@amazon.com, SeongJae Park Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jan 31, 2020 at 8:12 AM wrote: > > On Fri, 31 Jan 2020 07:01:21 -0800 Eric Dumazet wrote: > > > On Fri, Jan 31, 2020 at 4:25 AM wrote: > > > > > Signed-off-by: SeongJae Park > > > --- > > > net/ipv4/tcp_input.c | 6 +++++- > > > 1 file changed, 5 insertions(+), 1 deletion(-) > > > > > > diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c > > > index 2a976f57f7e7..b168e29e1ad1 100644 > > > --- a/net/ipv4/tcp_input.c > > > +++ b/net/ipv4/tcp_input.c > > > @@ -5893,8 +5893,12 @@ static int tcp_rcv_synsent_state_process(struct sock *sk, struct sk_buff *skb, > > > * the segment and return)" > > > */ > > > if (!after(TCP_SKB_CB(skb)->ack_seq, tp->snd_una) || > > > - after(TCP_SKB_CB(skb)->ack_seq, tp->snd_nxt)) > > > + after(TCP_SKB_CB(skb)->ack_seq, tp->snd_nxt)) { > > > + /* Previous FIN/ACK or RST/ACK might be ignore. */ > > > + inet_csk_reset_xmit_timer(sk, ICSK_TIME_RETRANS, > > > + TCP_ATO_MIN, TCP_RTO_MAX); > > > > This is not what I suggested. > > > > I suggested implementing a strategy where only the _first_ retransmit > > would be done earlier. > > > > So you need to look at the current counter of retransmit attempts, > > then reset the timer if this SYN_SENT > > socket never resent a SYN. > > > > We do not want to trigger packet storms, if for some reason the remote > > peer constantly sends > > us the same packet. > > You're right, I missed the important point, thank you for pointing it. Among > retransmission related fields of 'tcp_sock', I think '->total_retrans' would > fit for this check. How about below change? > > ``` > diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c > index 2a976f57f7e7..29fc0e4da931 100644 > --- a/net/ipv4/tcp_input.c > +++ b/net/ipv4/tcp_input.c > @@ -5893,8 +5893,14 @@ static int tcp_rcv_synsent_state_process(struct sock *sk, struct sk_buff *skb, > * the segment and return)" > */ > if (!after(TCP_SKB_CB(skb)->ack_seq, tp->snd_una) || > - after(TCP_SKB_CB(skb)->ack_seq, tp->snd_nxt)) > + after(TCP_SKB_CB(skb)->ack_seq, tp->snd_nxt)) { > + /* Previous FIN/ACK or RST/ACK might be ignored. */ > + if (tp->total_retrans == 0) canonical fied would be icsk->icsk_retransmits (look in net/ipv4/tcp_timer.c ) AFAIK, it seems we forget to clear tp->total_retrans in tcp_disconnect() I will send a patch for this tp->total_retrans thing. > + inet_csk_reset_xmit_timer(sk, > + ICSK_TIME_RETRANS, TCP_ATO_MIN, > + TCP_RTO_MAX); > goto reset_and_undo; > + } > > if (tp->rx_opt.saw_tstamp && tp->rx_opt.rcv_tsecr && > !between(tp->rx_opt.rcv_tsecr, tp->retrans_stamp, > ``` > > Thanks, > SeongJae Park > > > > > Thanks. > > > > > goto reset_and_undo; > > > + } > > > > > > if (tp->rx_opt.saw_tstamp && tp->rx_opt.rcv_tsecr && > > > !between(tp->rx_opt.rcv_tsecr, tp->retrans_stamp, > > > -- > > > 2.17.1 > > > > >