diff options
-rw-r--r-- | net/ipv4/tcp_cong.c | 40 |
1 files changed, 22 insertions, 18 deletions
diff --git a/net/ipv4/tcp_cong.c b/net/ipv4/tcp_cong.c index 86b26539e54b..1260e52ad772 100644 --- a/net/ipv4/tcp_cong.c +++ b/net/ipv4/tcp_cong.c | |||
@@ -276,30 +276,34 @@ int tcp_set_congestion_control(struct sock *sk, const char *name) | |||
276 | 276 | ||
277 | 277 | ||
278 | /* | 278 | /* |
279 | * Slow start (exponential increase) with | 279 | * Slow start is used when congestion window is less than slow start |
280 | * RFC3742 Limited Slow Start (fast linear increase) support. | 280 | * threshold. This version implements the basic RFC2581 version |
281 | * and optionally supports: | ||
282 | * RFC3742 Limited Slow Start - growth limited to max_ssthresh | ||
283 | * RFC3465 Appropriate Byte Counting - growth limited by bytes acknowledged | ||
281 | */ | 284 | */ |
282 | void tcp_slow_start(struct tcp_sock *tp) | 285 | void tcp_slow_start(struct tcp_sock *tp) |
283 | { | 286 | { |
284 | int cnt = 0; | 287 | int cnt; /* increase in packets */ |
285 | 288 | ||
286 | if (sysctl_tcp_abc) { | 289 | /* RFC3465: ABC Slow start |
287 | /* RFC3465: Slow Start | 290 | * Increase only after a full MSS of bytes is acked |
288 | * TCP sender SHOULD increase cwnd by the number of | 291 | * |
289 | * previously unacknowledged bytes ACKed by each incoming | 292 | * TCP sender SHOULD increase cwnd by the number of |
290 | * acknowledgment, provided the increase is not more than L | 293 | * previously unacknowledged bytes ACKed by each incoming |
291 | */ | 294 | * acknowledgment, provided the increase is not more than L |
292 | if (tp->bytes_acked < tp->mss_cache) | 295 | */ |
293 | return; | 296 | if (sysctl_tcp_abc && tp->bytes_acked < tp->mss_cache) |
294 | } | 297 | return; |
295 | 298 | ||
296 | if (sysctl_tcp_max_ssthresh > 0 && | 299 | if (sysctl_tcp_max_ssthresh > 0 && tp->snd_cwnd > sysctl_tcp_max_ssthresh) |
297 | tp->snd_cwnd > sysctl_tcp_max_ssthresh) | 300 | cnt = sysctl_tcp_max_ssthresh >> 1; /* limited slow start */ |
298 | cnt += sysctl_tcp_max_ssthresh>>1; | ||
299 | else | 301 | else |
300 | cnt += tp->snd_cwnd; | 302 | cnt = tp->snd_cwnd; /* exponential increase */ |
301 | 303 | ||
302 | /* RFC3465: We MAY increase by 2 if discovered delayed ack */ | 304 | /* RFC3465: ABC |
305 | * We MAY increase by 2 if discovered delayed ack | ||
306 | */ | ||
303 | if (sysctl_tcp_abc > 1 && tp->bytes_acked >= 2*tp->mss_cache) | 307 | if (sysctl_tcp_abc > 1 && tp->bytes_acked >= 2*tp->mss_cache) |
304 | cnt <<= 1; | 308 | cnt <<= 1; |
305 | tp->bytes_acked = 0; | 309 | tp->bytes_acked = 0; |