Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp2874375pxu; Sat, 19 Dec 2020 05:01:19 -0800 (PST) X-Google-Smtp-Source: ABdhPJyW5tuoWnXhe/tZ9gPxC91w4b08xpGWWFSfj8S6oL5hSKqHgHptIN2CEgmq5Z6xJ/HjqqnE X-Received: by 2002:a50:d604:: with SMTP id x4mr8718588edi.64.1608382879209; Sat, 19 Dec 2020 05:01:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608382879; cv=none; d=google.com; s=arc-20160816; b=xQ+4F9u4h8TPHvPZM9dac8MWWMOLuCdQ94KvyEtw8IIVW6crmEQdqB+2jzbLZuIO1h TptZTWRuuQfK6DwCfuDBUZMeO8Ftr8+ve4nZgmBL/bkyR3zSY1F/iN7ngGkdZ3t+VYEz c+Tg5JKo2PXycxvfl2QlXuQQ+MSfdqkezpBwaZnsabUoIOpiTGcJMgCAVIf2qoH0poFz ucaLxVNLY4V6vT9NucpOMJghcGsQ9EQtaVR3mjkETnwXvxzocmqzVI0vGj5zbyhNFREN l1QH5BBEf9bLNm5yze9WOQvd8CvOa6VKKRri1fo7GorAceVKQ+XRqKVOzUoXqot4c7gz rH5Q== 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; bh=BlFLCGBFaD4DgLShSnWA13rfl5XyagEeO5CTt/VLbr4=; b=n1C88Eg5FRUHTyimRp0KEgIVgiIKl4C8M/bVwIiFjp6IEfPoK1xqVnXcdP1qxmz+TP ySkVKl0PNbKt2U28E//T2awhMeed8KWr7haTf1dU4icLM3LAYyZE0QPkalfezYeU3dUf ZaNfSbVWXlSmbytp2Xnu+IX5/OpZLmsjZD6mijKWFHw9o0nNqvGONxyHXKuWAXOczEHA NyQCYiCJjxaZREJPD6L9FRXnicwRj+YsEfwmC3Yzv1eS84kywlhv595Mb1J/JPWrrCZ5 oplR0mDY2XfxRb+g1tXsZRUDBLRLpG/5Imqbx5/KVsjSPgg5vPNsxk24XunXuoG+fIBX qAGg== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (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 f19si5828322eja.89.2020.12.19.05.00.56; Sat, 19 Dec 2020 05:01:19 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728008AbgLSM7K (ORCPT + 99 others); Sat, 19 Dec 2020 07:59:10 -0500 Received: from mail.kernel.org ([198.145.29.99]:45422 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727803AbgLSM6q (ORCPT ); Sat, 19 Dec 2020 07:58:46 -0500 From: Greg Kroah-Hartman Authentication-Results: mail.kernel.org; dkim=permerror (bad message/signature format) To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hazem Mohamed Abuelfotoh , Eric Dumazet , Soheil Hassas Yeganeh , "David S. Miller" Subject: [PATCH 5.9 20/49] tcp: select sane initial rcvq_space.space for big MSS Date: Sat, 19 Dec 2020 13:58:24 +0100 Message-Id: <20201219125345.673486911@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201219125344.671832095@linuxfoundation.org> References: <20201219125344.671832095@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: Eric Dumazet [ Upstream commit 72d05c00d7ecda85df29abd046da7e41cc071c17 ] Before commit a337531b942b ("tcp: up initial rmem to 128KB and SYN rwin to around 64KB") small tcp_rmem[1] values were overridden by tcp_fixup_rcvbuf() to accommodate various MSS. This is no longer the case, and Hazem Mohamed Abuelfotoh reported that DRS would not work for MTU 9000 endpoints receiving regular (1500 bytes) frames. Root cause is that tcp_init_buffer_space() uses tp->rcv_wnd for upper limit of rcvq_space.space computation, while it can select later a smaller value for tp->rcv_ssthresh and tp->window_clamp. ss -temoi on receiver would show : skmem:(r0,rb131072,t0,tb46080,f0,w0,o0,bl0,d0) rcv_space:62496 rcv_ssthresh:56596 This means that TCP can not increase its window in tcp_grow_window(), and that DRS can never kick. Fix this by making sure that rcvq_space.space is not bigger than number of bytes that can be held in TCP receive queue. People unable/unwilling to change their kernel can work around this issue by selecting a bigger tcp_rmem[1] value as in : echo "4096 196608 6291456" >/proc/sys/net/ipv4/tcp_rmem Based on an initial report and patch from Hazem Mohamed Abuelfotoh https://lore.kernel.org/netdev/20201204180622.14285-1-abuehaze@amazon.com/ Fixes: a337531b942b ("tcp: up initial rmem to 128KB and SYN rwin to around 64KB") Fixes: 041a14d26715 ("tcp: start receiver buffer autotuning sooner") Reported-by: Hazem Mohamed Abuelfotoh Signed-off-by: Eric Dumazet Acked-by: Soheil Hassas Yeganeh Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/ipv4/tcp_input.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c @@ -447,7 +447,6 @@ static void tcp_init_buffer_space(struct if (!(sk->sk_userlocks & SOCK_SNDBUF_LOCK)) tcp_sndbuf_expand(sk); - tp->rcvq_space.space = min_t(u32, tp->rcv_wnd, TCP_INIT_CWND * tp->advmss); tcp_mstamp_refresh(tp); tp->rcvq_space.time = tp->tcp_mstamp; tp->rcvq_space.seq = tp->copied_seq; @@ -471,6 +470,8 @@ static void tcp_init_buffer_space(struct tp->rcv_ssthresh = min(tp->rcv_ssthresh, tp->window_clamp); tp->snd_cwnd_stamp = tcp_jiffies32; + tp->rcvq_space.space = min3(tp->rcv_ssthresh, tp->rcv_wnd, + (u32)TCP_INIT_CWND * tp->advmss); } /* 4. Recalculate window clamp after socket hit its memory bounds. */