Message ID | 20210111222411.232916-4-hcaldwel@akamai.com (mailing list archive) |
---|---|
State | Changes Requested |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | Fix receive window restriction | expand |
Context | Check | Description |
---|---|---|
netdev/cover_letter | success | Link |
netdev/fixes_present | success | Link |
netdev/patch_count | success | Link |
netdev/tree_selection | success | Clearly marked for net-next |
netdev/subject_prefix | success | Link |
netdev/cc_maintainers | warning | 4 maintainers not CCed: kuba@kernel.org davem@davemloft.net kuznet@ms2.inr.ac.ru yoshfuji@linux-ipv6.org |
netdev/source_inline | success | Was 0 now: 0 |
netdev/verify_signedoff | success | Link |
netdev/module_param | success | Was 0 now: 0 |
netdev/build_32bit | success | Errors and warnings before: 1 this patch: 1 |
netdev/kdoc | success | Errors and warnings before: 0 this patch: 0 |
netdev/verify_fixes | success | Link |
netdev/checkpatch | fail | CHECK: Lines should not end with a '(' ERROR: code indent should use tabs where possible |
netdev/build_allmodconfig_warn | success | Errors and warnings before: 1 this patch: 1 |
netdev/header_inline | success | Link |
netdev/stable | success | Stable not CCed |
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index f322e798a351..1d2773cd02c8 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c @@ -240,8 +240,12 @@ void tcp_select_initial_window(const struct sock *sk, int __space, __u32 mss, *rcv_wscale = 0; if (wscale_ok) { /* Set window scaling on max possible window */ - space = max_t(u32, space, sock_net(sk)->ipv4.sysctl_tcp_rmem[2]); - space = max_t(u32, space, sysctl_rmem_max); + space = max_t(u32, space, + tcp_win_from_space( + sk, + sock_net(sk)->ipv4.sysctl_tcp_rmem[2])); + space = max_t(u32, space, + tcp_win_from_space(sk, sysctl_rmem_max)); space = min_t(u32, space, *window_clamp); *rcv_wscale = clamp_t(int, ilog2(space) - 15, 0, TCP_MAX_WSCALE);
When calculating the window scale to use for the advertised window for a TCP connection, adjust the size values used to extend the maximum possible window value so that overhead is properly accounted. In other words: convert the maximum value candidates from buffer size space into advertised window space. This adjustment keeps the scale of the maximum value consistent - that is, keeps it in window space. Without this adjustment, the window scale used could be larger than necessary, reducing granularity for the advertised window. Signed-off-by: Heath Caldwell <hcaldwel@akamai.com> --- net/ipv4/tcp_output.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)