tcp: tcp_grow_window() needs to respect tcp_space()
authorEric Dumazet <edumazet@google.com>
Tue, 16 Apr 2019 17:55:20 +0000 (10:55 -0700)
committerJason Liu <jason.hui.liu@nxp.com>
Fri, 6 Sep 2019 03:11:35 +0000 (11:11 +0800)
commita6c94ce019ff093184cf73b02859d4e5090e2b40
tree542910fda39164ebd3ca2c51d03c4b4bcb0c8c5f
parent8cf084d26f541f33b85e31f47152093e712f8ea9
tcp: tcp_grow_window() needs to respect tcp_space()

[ Upstream commit 50ce163a72d817a99e8974222dcf2886d5deb1ae ]

For some reason, tcp_grow_window() correctly tests if enough room
is present before attempting to increase tp->rcv_ssthresh,
but does not prevent it to grow past tcp_space()

This is causing hard to debug issues, like failing
the (__tcp_select_window(sk) >= tp->rcv_wnd) test
in __tcp_ack_snd_check(), causing ACK delays and possibly
slow flows.

Depending on tcp_rmem[2], MTU, skb->len/skb->truesize ratio,
we can see the problem happening on "netperf -t TCP_RR -- -r 2000,2000"
after about 60 round trips, when the active side no longer sends
immediate acks.

This bug predates git history.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Acked-by: Soheil Hassas Yeganeh <soheil@google.com>
Acked-by: Neal Cardwell <ncardwell@google.com>
Acked-by: Wei Wang <weiwan@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 6728c6174a47b8a04ceec89aca9e1195dee7ff6b)
net/ipv4/tcp_input.c