diff options
Diffstat (limited to 'net/ipv4/tcp_cong.c')
-rw-r--r-- | net/ipv4/tcp_cong.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/net/ipv4/tcp_cong.c b/net/ipv4/tcp_cong.c index 291f2ed7cc31..cdf2e707bb10 100644 --- a/net/ipv4/tcp_cong.c +++ b/net/ipv4/tcp_cong.c | |||
@@ -310,6 +310,12 @@ void tcp_slow_start(struct tcp_sock *tp) | |||
310 | { | 310 | { |
311 | int cnt; /* increase in packets */ | 311 | int cnt; /* increase in packets */ |
312 | unsigned int delta = 0; | 312 | unsigned int delta = 0; |
313 | u32 snd_cwnd = tp->snd_cwnd; | ||
314 | |||
315 | if (unlikely(!snd_cwnd)) { | ||
316 | pr_err_once("snd_cwnd is nul, please report this bug.\n"); | ||
317 | snd_cwnd = 1U; | ||
318 | } | ||
313 | 319 | ||
314 | /* RFC3465: ABC Slow start | 320 | /* RFC3465: ABC Slow start |
315 | * Increase only after a full MSS of bytes is acked | 321 | * Increase only after a full MSS of bytes is acked |
@@ -324,7 +330,7 @@ void tcp_slow_start(struct tcp_sock *tp) | |||
324 | if (sysctl_tcp_max_ssthresh > 0 && tp->snd_cwnd > sysctl_tcp_max_ssthresh) | 330 | if (sysctl_tcp_max_ssthresh > 0 && tp->snd_cwnd > sysctl_tcp_max_ssthresh) |
325 | cnt = sysctl_tcp_max_ssthresh >> 1; /* limited slow start */ | 331 | cnt = sysctl_tcp_max_ssthresh >> 1; /* limited slow start */ |
326 | else | 332 | else |
327 | cnt = tp->snd_cwnd; /* exponential increase */ | 333 | cnt = snd_cwnd; /* exponential increase */ |
328 | 334 | ||
329 | /* RFC3465: ABC | 335 | /* RFC3465: ABC |
330 | * We MAY increase by 2 if discovered delayed ack | 336 | * We MAY increase by 2 if discovered delayed ack |
@@ -334,11 +340,11 @@ void tcp_slow_start(struct tcp_sock *tp) | |||
334 | tp->bytes_acked = 0; | 340 | tp->bytes_acked = 0; |
335 | 341 | ||
336 | tp->snd_cwnd_cnt += cnt; | 342 | tp->snd_cwnd_cnt += cnt; |
337 | while (tp->snd_cwnd_cnt >= tp->snd_cwnd) { | 343 | while (tp->snd_cwnd_cnt >= snd_cwnd) { |
338 | tp->snd_cwnd_cnt -= tp->snd_cwnd; | 344 | tp->snd_cwnd_cnt -= snd_cwnd; |
339 | delta++; | 345 | delta++; |
340 | } | 346 | } |
341 | tp->snd_cwnd = min(tp->snd_cwnd + delta, tp->snd_cwnd_clamp); | 347 | tp->snd_cwnd = min(snd_cwnd + delta, tp->snd_cwnd_clamp); |
342 | } | 348 | } |
343 | EXPORT_SYMBOL_GPL(tcp_slow_start); | 349 | EXPORT_SYMBOL_GPL(tcp_slow_start); |
344 | 350 | ||