Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1603547pxu; Sat, 12 Dec 2020 19:52:08 -0800 (PST) X-Google-Smtp-Source: ABdhPJwHVMLebRgvBzwq+UqJ6IwN9lc4t3bXrC6I2JINyz9MocjrsjxNfYMf3WdDEL4g3HoyFy+r X-Received: by 2002:aa7:dc0d:: with SMTP id b13mr19229881edu.170.1607831528247; Sat, 12 Dec 2020 19:52:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607831528; cv=none; d=google.com; s=arc-20160816; b=UubobA4n5iwpYKqaTD9QrBV/ydGb1JyE5CldPatoMr5o8qhpnKijXuYxWweWSf/COZ ymsPZhbn48mjxibsC8gqNfHgvpXEol4RqhJGw6WXR6m/03u6+iy2Y7q7vZD7N6T4HV8L LnQVOmTqkuUehee3fyU+LaidlCAKEtKaKhHPSuaR4GXS0xRvhrZEhWVzxQ/XCCy+Omp3 qNaWm3uH7nkeKrJmca2D/EzamnKIwsLtwsGkmG78wBh453yvQBLyNvnMBwKNeqiilmHS Qckg9yaq5473CB55x2JhCfdxwyxeQHGmQ4Aoprx5BFZ7xOGx1hp3tS1oYvGGWDvT4otu dSfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=2qTMCUhI0/YQewF/VCItkzyJf+kYlqXC/vL1LYH/k5U=; b=ptMPeeKMAvupGZBk4sMgcF3HTbhc0Dah2fMLj//8XUVmvTwAUDswEyLR/cRa7UGl0n hPXvOI2PLOeYGWKp11+i4o0RpzJsbAT7wsXdK3uzWNE82FU7ye7ySacMLH352OF8v3PC jxZAL8Orf+/QTYFz7rhSGWlbAo/jWyo/bUIChpy9SqTWJ+M2lOFhxxx4AQTmvGXj5J6t UCxwQ3/911djX4Cv9WBO8IaWuxUGQMBJOhCR3KZw7W9crAf58Cdn8zBsAler4utngslJ UdZxnDtD9THjt3Fbvp7gvHiAckXbPP3tN+MlQNnCf6iKN9M0RxUOg+shUdfjSb/cnr4s kgBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=dDjJSvtL; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gb5si6923448ejc.585.2020.12.12.19.51.46; Sat, 12 Dec 2020 19:52:08 -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=@gmail.com header.s=20161025 header.b=dDjJSvtL; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2406443AbgLKVws (ORCPT + 99 others); Fri, 11 Dec 2020 16:52:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56344 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391893AbgLKVwN (ORCPT ); Fri, 11 Dec 2020 16:52:13 -0500 Received: from mail-il1-x143.google.com (mail-il1-x143.google.com [IPv6:2607:f8b0:4864:20::143]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 01579C0613CF; Fri, 11 Dec 2020 13:51:13 -0800 (PST) Received: by mail-il1-x143.google.com with SMTP id b8so10138895ila.13; Fri, 11 Dec 2020 13:51:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=2qTMCUhI0/YQewF/VCItkzyJf+kYlqXC/vL1LYH/k5U=; b=dDjJSvtLvuPChscPzyykjt7oV+4SFcMZTb7XeGwm0A+zISNUv62r2+uxjZVEojFVGE rDJxX8r7nyJQ+HOnMrOxvP96myLBn7KeTf8pKYsEjHJC+vwZkUdDlp33AezFLEIYpoey FDZSwg/hM0tnK+hoJOSKe1/Da5zFQSq1zwSwokSa18Yp1NPr66RtUNXyMREgXg+pFmcB WVmJwde5mYI/dJUDhSOuQLDY2bbcA4cd9fTmquVBMRgBQnai6KaogjDlbmrDi3YnEP++ BTcncwBTXBq2fepO1ENQBKavvAtQscUFaSiQXR2rVmfKWMQoegJI+ts616EQJjH1e14r k43A== 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=2qTMCUhI0/YQewF/VCItkzyJf+kYlqXC/vL1LYH/k5U=; b=RRmrvDRP9dRxKaGYRUI+WUYQW5ahgBfmr3uXiju2xtJkYJmC44kswZ+7dYN9YdjhLj JZwGeuGVZeGZlVhcicp6JCwQ/sbx0VSy6ZfCrz5SxdmTk+entk0BT+iO90fdto25y4yE k3EzRyGFd2Dp+uwSIlzvM7TgG/u5pRVwYkxccigLl2bD+DL0s0jxVdn+Al3aJYQZ1s7A o2qSUN6gR0llMAVzcFNzwL68XRqKVvluWnJUYbmzrzSTV4xMElIj6qF1H5LfSSkniJtK 2z8RjmsHBSOMq0a6wMmJ0apNACvU/mlp3Ll5ay6O7KP9tYD/m3FvbCM7iCW0lGAv+Ezz SJ4g== X-Gm-Message-State: AOAM531Yo9dIjLBM6Apzmk5szCbVefr0e5ujn2v28/MlkDal7HoWli5K B6bQ1xif82EjmsB+JR5aJJ0dxY2su0h1fXblfNw= X-Received: by 2002:a92:730d:: with SMTP id o13mr17783084ilc.95.1607723472280; Fri, 11 Dec 2020 13:51:12 -0800 (PST) MIME-Version: 1.0 References: <160765171921.6905.7897898635812579754.stgit@localhost.localdomain> In-Reply-To: From: Alexander Duyck Date: Fri, 11 Dec 2020 13:51:01 -0800 Message-ID: Subject: Re: [net PATCH] tcp: Mark fastopen SYN packet as lost when receiving ICMP_TOOBIG/ICMP_FRAG_NEEDED To: Eric Dumazet Cc: Yuchung Cheng , David Miller , Jakub Kicinski , Alexey Kuznetsov , Hideaki YOSHIFUJI , netdev , LKML , Martin KaFai Lau , kernel-team Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Dec 11, 2020 at 11:18 AM Eric Dumazet wrote: > > On Fri, Dec 11, 2020 at 6:15 PM Alexander Duyck > wrote: > > > > On Fri, Dec 11, 2020 at 8:22 AM Eric Dumazet wrote: > > > > > > On Fri, Dec 11, 2020 at 5:03 PM Alexander Duyck > > > wrote: > > > > > > > That's fine. I can target this for net-next. I had just selected net > > > > since I had considered it a fix, but I suppose it could be considered > > > > a behavioral change. > > > > > > We are very late in the 5.10 cycle, and we never handled ICMP in this > > > state, so net-next is definitely better. > > > > > > Note that RFC 7413 states in 4.1.3 : > > > > > > The client MUST cache cookies from servers for later Fast Open > > > connections. For a multihomed client, the cookies are dependent on > > > the client and server IP addresses. Hence, the client should cache > > > at most one (most recently received) cookie per client and server IP > > > address pair. > > > > > > When caching cookies, we recommend that the client also cache the > > > Maximum Segment Size (MSS) advertised by the server. The client can > > > cache the MSS advertised by the server in order to determine the > > > maximum amount of data that the client can fit in the SYN packet in > > > subsequent TFO connections. Caching the server MSS is useful > > > because, with Fast Open, a client sends data in the SYN packet before > > > the server announces its MSS in the SYN-ACK packet. If the client > > > sends more data in the SYN packet than the server will accept, this > > > will likely require the client to retransmit some or all of the data. > > > Hence, caching the server MSS can enhance performance. > > > > > > Without a cached server MSS, the amount of data in the SYN packet is > > > limited to the default MSS of 536 bytes for IPv4 [RFC1122] and 1220 > > > bytes for IPv6 [RFC2460]. Even if the client complies with this > > > limit when sending the SYN, it is known that an IPv4 receiver > > > advertising an MSS less than 536 bytes can receive a segment larger > > > than it is expecting. > > > > > > If the cached MSS is larger than the typical size (1460 bytes for > > > IPv4 or 1440 bytes for IPv6), then the excess data in the SYN packet > > > may cause problems that offset the performance benefit of Fast Open. > > > For example, the unusually large SYN may trigger IP fragmentation and > > > may confuse firewalls or middleboxes, causing SYN retransmission and > > > other side effects. Therefore, the client MAY limit the cached MSS > > > to 1460 bytes for IPv4 or 1440 for IPv6. > > > > > > > > > Relying on ICMP is fragile, since they can be filtered in some way. > > > > In this case I am not relying on the ICMP, but thought that since I > > have it I should make use of it. WIthout the ICMP we would still just > > be waiting on the retransmit timer. > > > > The problem case has a v6-in-v6 tunnel between the client and the > > endpoint so both ends assume an MTU 1500 and advertise a 1440 MSS > > which works fine until they actually go to send a large packet between > > the two. At that point the tunnel is triggering an ICMP_TOOBIG and the > > endpoint is stalling since the MSS is dropped to 1400, but the SYN and > > data payload were already smaller than that so no retransmits are > > being triggered. This results in TFO being 1s slower than non-TFO > > because of the failure to trigger the retransmit for the frame that > > violated the PMTU. The patch is meant to get the two back into > > comparable times. > > Okay... Have you studied why tcp_v4_mtu_reduced() (and IPv6 equivalent) > code does not yet handle the retransmit in TCP_SYN_SENT state ? The problem lies in tcp_simple_retransmit(). Specifically the loop at the start of the function goes to check the retransmit queue to see if there are any packets larger than MSS and finds none since we don't place the SYN w/ data in there and instead have a separate SYN and data packet. I'm debating if I should take an alternative approach and modify the loop at the start of tcp_simple_transmit to add a check for a SYN packet, tp->syn_data being set, and then comparing the next frame length + MAX_TCP_HEADER_OPTIONS versus mss.