diff options
Diffstat (limited to 'net/ipv4/tcp_cong.c')
-rw-r--r-- | net/ipv4/tcp_cong.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/net/ipv4/tcp_cong.c b/net/ipv4/tcp_cong.c index 27ead0dd16bc..6826017c12d1 100644 --- a/net/ipv4/tcp_cong.c +++ b/net/ipv4/tcp_cong.c | |||
@@ -291,25 +291,28 @@ int tcp_set_congestion_control(struct sock *sk, const char *name) | |||
291 | * ABC caps N to 2. Slow start exits when cwnd grows over ssthresh and | 291 | * ABC caps N to 2. Slow start exits when cwnd grows over ssthresh and |
292 | * returns the leftover acks to adjust cwnd in congestion avoidance mode. | 292 | * returns the leftover acks to adjust cwnd in congestion avoidance mode. |
293 | */ | 293 | */ |
294 | void tcp_slow_start(struct tcp_sock *tp, u32 acked) | 294 | u32 tcp_slow_start(struct tcp_sock *tp, u32 acked) |
295 | { | 295 | { |
296 | u32 cwnd = tp->snd_cwnd + acked; | 296 | u32 cwnd = tp->snd_cwnd + acked; |
297 | 297 | ||
298 | if (cwnd > tp->snd_ssthresh) | 298 | if (cwnd > tp->snd_ssthresh) |
299 | cwnd = tp->snd_ssthresh + 1; | 299 | cwnd = tp->snd_ssthresh + 1; |
300 | acked -= cwnd - tp->snd_cwnd; | ||
300 | tp->snd_cwnd = min(cwnd, tp->snd_cwnd_clamp); | 301 | tp->snd_cwnd = min(cwnd, tp->snd_cwnd_clamp); |
302 | |||
303 | return acked; | ||
301 | } | 304 | } |
302 | EXPORT_SYMBOL_GPL(tcp_slow_start); | 305 | EXPORT_SYMBOL_GPL(tcp_slow_start); |
303 | 306 | ||
304 | /* In theory this is tp->snd_cwnd += 1 / tp->snd_cwnd (or alternative w) */ | 307 | /* In theory this is tp->snd_cwnd += 1 / tp->snd_cwnd (or alternative w) */ |
305 | void tcp_cong_avoid_ai(struct tcp_sock *tp, u32 w) | 308 | void tcp_cong_avoid_ai(struct tcp_sock *tp, u32 w, u32 acked) |
306 | { | 309 | { |
307 | if (tp->snd_cwnd_cnt >= w) { | 310 | if (tp->snd_cwnd_cnt >= w) { |
308 | if (tp->snd_cwnd < tp->snd_cwnd_clamp) | 311 | if (tp->snd_cwnd < tp->snd_cwnd_clamp) |
309 | tp->snd_cwnd++; | 312 | tp->snd_cwnd++; |
310 | tp->snd_cwnd_cnt = 0; | 313 | tp->snd_cwnd_cnt = 0; |
311 | } else { | 314 | } else { |
312 | tp->snd_cwnd_cnt++; | 315 | tp->snd_cwnd_cnt += acked; |
313 | } | 316 | } |
314 | } | 317 | } |
315 | EXPORT_SYMBOL_GPL(tcp_cong_avoid_ai); | 318 | EXPORT_SYMBOL_GPL(tcp_cong_avoid_ai); |
@@ -333,7 +336,7 @@ void tcp_reno_cong_avoid(struct sock *sk, u32 ack, u32 acked) | |||
333 | tcp_slow_start(tp, acked); | 336 | tcp_slow_start(tp, acked); |
334 | /* In dangerous area, increase slowly. */ | 337 | /* In dangerous area, increase slowly. */ |
335 | else | 338 | else |
336 | tcp_cong_avoid_ai(tp, tp->snd_cwnd); | 339 | tcp_cong_avoid_ai(tp, tp->snd_cwnd, 1); |
337 | } | 340 | } |
338 | EXPORT_SYMBOL_GPL(tcp_reno_cong_avoid); | 341 | EXPORT_SYMBOL_GPL(tcp_reno_cong_avoid); |
339 | 342 | ||