diff options
Diffstat (limited to 'net/ipv4/tcp_cubic.c')
-rw-r--r-- | net/ipv4/tcp_cubic.c | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/net/ipv4/tcp_cubic.c b/net/ipv4/tcp_cubic.c index 6ad18480226..5ce6cd85680 100644 --- a/net/ipv4/tcp_cubic.c +++ b/net/ipv4/tcp_cubic.c @@ -175,42 +175,42 @@ static inline void bictcp_update(struct bictcp *ca, u32 cwnd) } } - /* cubic function - calc*/ - /* calculate c * time^3 / rtt, - * while considering overflow in calculation of time^3 + /* cubic function - calc*/ + /* calculate c * time^3 / rtt, + * while considering overflow in calculation of time^3 * (so time^3 is done by using 64 bit) * and without the support of division of 64bit numbers * (so all divisions are done by using 32 bit) - * also NOTE the unit of those veriables - * time = (t - K) / 2^bictcp_HZ - * c = bic_scale >> 10 + * also NOTE the unit of those veriables + * time = (t - K) / 2^bictcp_HZ + * c = bic_scale >> 10 * rtt = (srtt >> 3) / HZ * !!! The following code does not have overflow problems, * if the cwnd < 1 million packets !!! - */ + */ /* change the unit from HZ to bictcp_HZ */ - t = ((tcp_time_stamp + (ca->delay_min>>3) - ca->epoch_start) + t = ((tcp_time_stamp + (ca->delay_min>>3) - ca->epoch_start) << BICTCP_HZ) / HZ; - if (t < ca->bic_K) /* t - K */ + if (t < ca->bic_K) /* t - K */ offs = ca->bic_K - t; - else - offs = t - ca->bic_K; + else + offs = t - ca->bic_K; /* c/rtt * (t-K)^3 */ delta = (cube_rtt_scale * offs * offs * offs) >> (10+3*BICTCP_HZ); - if (t < ca->bic_K) /* below origin*/ - bic_target = ca->bic_origin_point - delta; - else /* above origin*/ - bic_target = ca->bic_origin_point + delta; + if (t < ca->bic_K) /* below origin*/ + bic_target = ca->bic_origin_point - delta; + else /* above origin*/ + bic_target = ca->bic_origin_point + delta; - /* cubic function - calc bictcp_cnt*/ - if (bic_target > cwnd) { + /* cubic function - calc bictcp_cnt*/ + if (bic_target > cwnd) { ca->cnt = cwnd / (bic_target - cwnd); - } else { - ca->cnt = 100 * cwnd; /* very small increment*/ - } + } else { + ca->cnt = 100 * cwnd; /* very small increment*/ + } if (ca->delay_min > 0) { /* max increment = Smax * rtt / 0.1 */ @@ -219,7 +219,7 @@ static inline void bictcp_update(struct bictcp *ca, u32 cwnd) ca->cnt = min_cnt; } - /* slow start and low utilization */ + /* slow start and low utilization */ if (ca->loss_cwnd == 0) /* could be aggressive in slow start */ ca->cnt = 50; @@ -227,9 +227,9 @@ static inline void bictcp_update(struct bictcp *ca, u32 cwnd) if (tcp_friendliness) { u32 scale = beta_scale; delta = (cwnd * scale) >> 3; - while (ca->ack_cnt > delta) { /* update tcp cwnd */ - ca->ack_cnt -= delta; - ca->tcp_cwnd++; + while (ca->ack_cnt > delta) { /* update tcp cwnd */ + ca->ack_cnt -= delta; + ca->tcp_cwnd++; } if (ca->tcp_cwnd > cwnd){ /* if bic is slower than tcp */ @@ -238,7 +238,7 @@ static inline void bictcp_update(struct bictcp *ca, u32 cwnd) if (ca->cnt > max_cnt) ca->cnt = max_cnt; } - } + } ca->cnt = (ca->cnt << ACK_RATIO_SHIFT) / ca->delayed_ack; if (ca->cnt == 0) /* cannot be zero */ |