From 2ad8e60c880be55417160cf220a1439e7c07bbdb Mon Sep 17 00:00:00 2001 From: Yuchung Cheng Date: Mon, 1 Oct 2018 15:42:32 -0700 Subject: [PATCH] UPSTREAM: tcp: start receiver buffer autotuning sooner Previously receiver buffer auto-tuning starts after receiving one advertised window amount of data. After the initial receiver buffer was raised by patch a337531b942b ("tcp: up initial rmem to 128KB and SYN rwin to around 64KB"), the reciver buffer may take too long to start raising. To address this issue, this patch lowers the initial bytes expected to receive roughly the expected sender's initial window. Fixes: a337531b942b ("tcp: up initial rmem to 128KB and SYN rwin to around 64KB") Signed-off-by: Yuchung Cheng Signed-off-by: Wei Wang Signed-off-by: Neal Cardwell Signed-off-by: Eric Dumazet Reviewed-by: Soheil Hassas Yeganeh Signed-off-by: David S. Miller (cherry picked from commit 041a14d2671573611ffd6412bc16e2f64469f7fb) Signed-off-by: Chenbo Feng This patch is backported from 4.20 to allow us to drop "ANDROID: net: ipv4: tcp: add a sysctl to config the tcp_default_init_rwnd" Bug: 118591209 Test: net_test sock_diag_test.py Change-Id: Ifff58b0b86a816a66d5a0bd77b57d6eedeaafa3b --- net/ipv4/tcp_input.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index 1d6b67c655fc..90dc482d5a9d 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c @@ -438,7 +438,7 @@ void tcp_init_buffer_space(struct sock *sk) if (!(sk->sk_userlocks & SOCK_SNDBUF_LOCK)) tcp_sndbuf_expand(sk); - tp->rcvq_space.space = tp->rcv_wnd; + 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;