diff options
Diffstat (limited to 'net/ipv4/tcp_output.c')
-rw-r--r-- | net/ipv4/tcp_output.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index c5dc4c4fdadd..e4c1e51b18c1 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c | |||
@@ -233,16 +233,14 @@ void tcp_select_initial_window(const struct sock *sk, int __space, __u32 mss, | |||
233 | if (init_rcv_wnd) | 233 | if (init_rcv_wnd) |
234 | *rcv_wnd = min(*rcv_wnd, init_rcv_wnd * mss); | 234 | *rcv_wnd = min(*rcv_wnd, init_rcv_wnd * mss); |
235 | 235 | ||
236 | (*rcv_wscale) = 0; | 236 | *rcv_wscale = 0; |
237 | if (wscale_ok) { | 237 | if (wscale_ok) { |
238 | /* Set window scaling on max possible window */ | 238 | /* Set window scaling on max possible window */ |
239 | space = max_t(u32, space, sock_net(sk)->ipv4.sysctl_tcp_rmem[2]); | 239 | space = max_t(u32, space, sock_net(sk)->ipv4.sysctl_tcp_rmem[2]); |
240 | space = max_t(u32, space, sysctl_rmem_max); | 240 | space = max_t(u32, space, sysctl_rmem_max); |
241 | space = min_t(u32, space, *window_clamp); | 241 | space = min_t(u32, space, *window_clamp); |
242 | while (space > U16_MAX && (*rcv_wscale) < TCP_MAX_WSCALE) { | 242 | *rcv_wscale = clamp_t(int, ilog2(space) - 15, |
243 | space >>= 1; | 243 | 0, TCP_MAX_WSCALE); |
244 | (*rcv_wscale)++; | ||
245 | } | ||
246 | } | 244 | } |
247 | /* Set the clamp no higher than max representable value */ | 245 | /* Set the clamp no higher than max representable value */ |
248 | (*window_clamp) = min_t(__u32, U16_MAX << (*rcv_wscale), *window_clamp); | 246 | (*window_clamp) = min_t(__u32, U16_MAX << (*rcv_wscale), *window_clamp); |