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 6ad184802266..5ce6cd85680b 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) | |||
175 | } | 175 | } |
176 | } | 176 | } |
177 | 177 | ||
178 | /* cubic function - calc*/ | 178 | /* cubic function - calc*/ |
179 | /* calculate c * time^3 / rtt, | 179 | /* calculate c * time^3 / rtt, |
180 | * while considering overflow in calculation of time^3 | 180 | * while considering overflow in calculation of time^3 |
181 | * (so time^3 is done by using 64 bit) | 181 | * (so time^3 is done by using 64 bit) |
182 | * and without the support of division of 64bit numbers | 182 | * and without the support of division of 64bit numbers |
183 | * (so all divisions are done by using 32 bit) | 183 | * (so all divisions are done by using 32 bit) |
184 | * also NOTE the unit of those veriables | 184 | * also NOTE the unit of those veriables |
185 | * time = (t - K) / 2^bictcp_HZ | 185 | * time = (t - K) / 2^bictcp_HZ |
186 | * c = bic_scale >> 10 | 186 | * c = bic_scale >> 10 |
187 | * rtt = (srtt >> 3) / HZ | 187 | * rtt = (srtt >> 3) / HZ |
188 | * !!! The following code does not have overflow problems, | 188 | * !!! The following code does not have overflow problems, |
189 | * if the cwnd < 1 million packets !!! | 189 | * if the cwnd < 1 million packets !!! |
190 | */ | 190 | */ |
191 | 191 | ||
192 | /* change the unit from HZ to bictcp_HZ */ | 192 | /* change the unit from HZ to bictcp_HZ */ |
193 | t = ((tcp_time_stamp + (ca->delay_min>>3) - ca->epoch_start) | 193 | t = ((tcp_time_stamp + (ca->delay_min>>3) - ca->epoch_start) |
194 | << BICTCP_HZ) / HZ; | 194 | << BICTCP_HZ) / HZ; |
195 | 195 | ||
196 | if (t < ca->bic_K) /* t - K */ | 196 | if (t < ca->bic_K) /* t - K */ |
197 | offs = ca->bic_K - t; | 197 | offs = ca->bic_K - t; |
198 | else | 198 | else |
199 | offs = t - ca->bic_K; | 199 | offs = t - ca->bic_K; |
200 | 200 | ||
201 | /* c/rtt * (t-K)^3 */ | 201 | /* c/rtt * (t-K)^3 */ |
202 | delta = (cube_rtt_scale * offs * offs * offs) >> (10+3*BICTCP_HZ); | 202 | delta = (cube_rtt_scale * offs * offs * offs) >> (10+3*BICTCP_HZ); |
203 | if (t < ca->bic_K) /* below origin*/ | 203 | if (t < ca->bic_K) /* below origin*/ |
204 | bic_target = ca->bic_origin_point - delta; | 204 | bic_target = ca->bic_origin_point - delta; |
205 | else /* above origin*/ | 205 | else /* above origin*/ |
206 | bic_target = ca->bic_origin_point + delta; | 206 | bic_target = ca->bic_origin_point + delta; |
207 | 207 | ||
208 | /* cubic function - calc bictcp_cnt*/ | 208 | /* cubic function - calc bictcp_cnt*/ |
209 | if (bic_target > cwnd) { | 209 | if (bic_target > cwnd) { |
210 | ca->cnt = cwnd / (bic_target - cwnd); | 210 | ca->cnt = cwnd / (bic_target - cwnd); |
211 | } else { | 211 | } else { |
212 | ca->cnt = 100 * cwnd; /* very small increment*/ | 212 | ca->cnt = 100 * cwnd; /* very small increment*/ |
213 | } | 213 | } |
214 | 214 | ||
215 | if (ca->delay_min > 0) { | 215 | if (ca->delay_min > 0) { |
216 | /* max increment = Smax * rtt / 0.1 */ | 216 | /* max increment = Smax * rtt / 0.1 */ |
@@ -219,7 +219,7 @@ static inline void bictcp_update(struct bictcp *ca, u32 cwnd) | |||
219 | ca->cnt = min_cnt; | 219 | ca->cnt = min_cnt; |
220 | } | 220 | } |
221 | 221 | ||
222 | /* slow start and low utilization */ | 222 | /* slow start and low utilization */ |
223 | if (ca->loss_cwnd == 0) /* could be aggressive in slow start */ | 223 | if (ca->loss_cwnd == 0) /* could be aggressive in slow start */ |
224 | ca->cnt = 50; | 224 | ca->cnt = 50; |
225 | 225 | ||
@@ -227,9 +227,9 @@ static inline void bictcp_update(struct bictcp *ca, u32 cwnd) | |||
227 | if (tcp_friendliness) { | 227 | if (tcp_friendliness) { |
228 | u32 scale = beta_scale; | 228 | u32 scale = beta_scale; |
229 | delta = (cwnd * scale) >> 3; | 229 | delta = (cwnd * scale) >> 3; |
230 | while (ca->ack_cnt > delta) { /* update tcp cwnd */ | 230 | while (ca->ack_cnt > delta) { /* update tcp cwnd */ |
231 | ca->ack_cnt -= delta; | 231 | ca->ack_cnt -= delta; |
232 | ca->tcp_cwnd++; | 232 | ca->tcp_cwnd++; |
233 | } | 233 | } |
234 | 234 | ||
235 | if (ca->tcp_cwnd > cwnd){ /* if bic is slower than tcp */ | 235 | 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) | |||
238 | if (ca->cnt > max_cnt) | 238 | if (ca->cnt > max_cnt) |
239 | ca->cnt = max_cnt; | 239 | ca->cnt = max_cnt; |
240 | } | 240 | } |
241 | } | 241 | } |
242 | 242 | ||
243 | ca->cnt = (ca->cnt << ACK_RATIO_SHIFT) / ca->delayed_ack; | 243 | ca->cnt = (ca->cnt << ACK_RATIO_SHIFT) / ca->delayed_ack; |
244 | if (ca->cnt == 0) /* cannot be zero */ | 244 | if (ca->cnt == 0) /* cannot be zero */ |