aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@osdl.org>2006-10-26 02:04:12 -0400
committerDavid S. Miller <davem@davemloft.net>2006-10-26 02:04:12 -0400
commit22119240b1c8f64eebb6ffb368c927b2f8be4136 (patch)
tree0cdd861c612941b11ff24d4726cda11fb3e785b1 /net/ipv4
parent291b58d663862c3d42d2e8092f8b0dd3f15a94f8 (diff)
[TCP] cubic: scaling error
Doug Leith observed a discrepancy between the version of CUBIC described in the papers and the version in 2.6.18. A math error related to scaling causes Cubic to grow too slowly. Patch is from "Sangtae Ha" <sha2@ncsu.edu>. I validated that it does fix the problems. See the following to show behavior over 500ms 100 Mbit link. Sender (2.6.19-rc3) --- Bridge (2.6.18-rt7) ------- Receiver (2.6.19-rc3) 1G [netem] 100M http://developer.osdl.org/shemminger/tcp/2.6.19-rc3/cubic-orig.png http://developer.osdl.org/shemminger/tcp/2.6.19-rc3/cubic-fix.png Signed-off-by: Stephen Hemminger <shemminger@osdl.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4')
-rw-r--r--net/ipv4/tcp_cubic.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/net/ipv4/tcp_cubic.c b/net/ipv4/tcp_cubic.c
index a60ef38d75c6..6ad184802266 100644
--- a/net/ipv4/tcp_cubic.c
+++ b/net/ipv4/tcp_cubic.c
@@ -190,7 +190,7 @@ static inline void bictcp_update(struct bictcp *ca, u32 cwnd)
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 - 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 */
@@ -259,7 +259,7 @@ static inline void measure_delay(struct sock *sk)
259 (s32)(tcp_time_stamp - ca->epoch_start) < HZ) 259 (s32)(tcp_time_stamp - ca->epoch_start) < HZ)
260 return; 260 return;
261 261
262 delay = tcp_time_stamp - tp->rx_opt.rcv_tsecr; 262 delay = (tcp_time_stamp - tp->rx_opt.rcv_tsecr)<<3;
263 if (delay == 0) 263 if (delay == 0)
264 delay = 1; 264 delay = 1;
265 265
@@ -366,7 +366,7 @@ static int __init cubictcp_register(void)
366 366
367 beta_scale = 8*(BICTCP_BETA_SCALE+beta)/ 3 / (BICTCP_BETA_SCALE - beta); 367 beta_scale = 8*(BICTCP_BETA_SCALE+beta)/ 3 / (BICTCP_BETA_SCALE - beta);
368 368
369 cube_rtt_scale = (bic_scale << 3) / 10; /* 1024*c/rtt */ 369 cube_rtt_scale = (bic_scale * 10); /* 1024*c/rtt */
370 370
371 /* calculate the "K" for (wmax-cwnd) = c/rtt * K^3 371 /* calculate the "K" for (wmax-cwnd) = c/rtt * K^3
372 * so K = cubic_root( (wmax-cwnd)*rtt/c ) 372 * so K = cubic_root( (wmax-cwnd)*rtt/c )