diff options
Diffstat (limited to 'net/ipv4/tcp_cubic.c')
-rw-r--r-- | net/ipv4/tcp_cubic.c | 68 |
1 files changed, 34 insertions, 34 deletions
diff --git a/net/ipv4/tcp_cubic.c b/net/ipv4/tcp_cubic.c index 6ad184802266..9a582fb4ef9f 100644 --- a/net/ipv4/tcp_cubic.c +++ b/net/ipv4/tcp_cubic.c @@ -26,16 +26,16 @@ */ #define BICTCP_HZ 10 /* BIC HZ 2^10 = 1024 */ -static int fast_convergence = 1; -static int max_increment = 16; -static int beta = 819; /* = 819/1024 (BICTCP_BETA_SCALE) */ -static int initial_ssthresh = 100; -static int bic_scale = 41; -static int tcp_friendliness = 1; +static int fast_convergence __read_mostly = 1; +static int max_increment __read_mostly = 16; +static int beta __read_mostly = 819; /* = 819/1024 (BICTCP_BETA_SCALE) */ +static int initial_ssthresh __read_mostly = 100; +static int bic_scale __read_mostly = 41; +static int tcp_friendliness __read_mostly = 1; -static u32 cube_rtt_scale; -static u32 beta_scale; -static u64 cube_factor; +static u32 cube_rtt_scale __read_mostly; +static u32 beta_scale __read_mostly; +static u64 cube_factor __read_mostly; /* Note parameters that are used for precomputing scale factors are read-only */ module_param(fast_convergence, int, 0644); @@ -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 */ |