tcp: Update window clamping condition
authorSubash Abhinov Kasiviswanathan <quic_subashab@quicinc.com>
Thu, 8 Aug 2024 23:06:40 +0000 (16:06 -0700)
committerDavid S. Miller <davem@davemloft.net>
Wed, 14 Aug 2024 09:50:49 +0000 (10:50 +0100)
commita2cbb1603943281a604f5adc48079a148db5cb0d
tree2522cc4fb9a1a30976347af2b912195b365de7d9
parent655111b838cdabdb604f3625a9ff08c5eedb11da
tcp: Update window clamping condition

This patch is based on the discussions between Neal Cardwell and
Eric Dumazet in the link
https://lore.kernel.org/netdev/20240726204105.1466841-1-quic_subashab@quicinc.com/

It was correctly pointed out that tp->window_clamp would not be
updated in cases where net.ipv4.tcp_moderate_rcvbuf=0 or if
(copied <= tp->rcvq_space.space). While it is expected for most
setups to leave the sysctl enabled, the latter condition may
not end up hitting depending on the TCP receive queue size and
the pattern of arriving data.

The updated check should be hit only on initial MSS update from
TCP_MIN_MSS to measured MSS value and subsequently if there was
an update to a larger value.

Fixes: 05f76b2d634e ("tcp: Adjust clamping window for applications specifying SO_RCVBUF")
Signed-off-by: Sean Tranchetti <quic_stranche@quicinc.com>
Signed-off-by: Subash Abhinov Kasiviswanathan <quic_subashab@quicinc.com>
Acked-by: Neal Cardwell <ncardwell@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/tcp_input.c