diff options
author | Gerrit Renker <gerrit@erg.abdn.ac.uk> | 2006-12-09 21:00:14 -0500 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-12-11 17:34:40 -0500 |
commit | ff58629824c068e2a75402b5b83f12af0b36d394 (patch) | |
tree | 0d8f4a64dbe4e52879cac33174df406adf77da44 /net | |
parent | 45393a66a2c30fc8ed86e6c79a63a3cd5231c69f (diff) |
[DCCP] ccid3: Two optimisations for sending rate recomputation
This performs two optimisations for the recomputation of the sending rate.
1) Currently the target sending rate X_calc is recalculated whenever
a) the nofeedback timer expires, or
b) a feedback packet is received.
In the (a) case, recomputing X_calc is redundant, since
* the parameters p and RTT do not change in between the
reception of feedback packets;
* the parameter X_recv is either modified from received
feedback or via the nofeedback timer;
* a test (`p == 0') in the nofeedback timer avoids using
a stale/undefined value of X_calc if p was previously 0.
2) The nofeedback timer now only recomputes a timestamp when p == 0.
This is according to step (4) of [RFC 3448, 4.3] and avoids
unnecessarily determining a timestamp.
A debug statement about not updating X is also removed - it helps very
little in debugging and just clutters the logs.
Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>
Acked-by: Ian McDonald <ian.mcdonald@jandi.co.nz>
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/dccp/ccids/ccid3.c | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/net/dccp/ccids/ccid3.c b/net/dccp/ccids/ccid3.c index f1b745ee9cb6..92e893ee77c2 100644 --- a/net/dccp/ccids/ccid3.c +++ b/net/dccp/ccids/ccid3.c | |||
@@ -138,9 +138,6 @@ static void ccid3_hc_tx_update_x(struct sock *sk, struct timeval *now) | |||
138 | const __u32 old_x = hctx->ccid3hctx_x; | 138 | const __u32 old_x = hctx->ccid3hctx_x; |
139 | 139 | ||
140 | if (hctx->ccid3hctx_p > 0) { | 140 | if (hctx->ccid3hctx_p > 0) { |
141 | hctx->ccid3hctx_x_calc = tfrc_calc_x(hctx->ccid3hctx_s, | ||
142 | hctx->ccid3hctx_rtt, | ||
143 | hctx->ccid3hctx_p); | ||
144 | hctx->ccid3hctx_x = max_t(u32, min(hctx->ccid3hctx_x_calc, | 141 | hctx->ccid3hctx_x = max_t(u32, min(hctx->ccid3hctx_x_calc, |
145 | hctx->ccid3hctx_x_recv * 2), | 142 | hctx->ccid3hctx_x_recv * 2), |
146 | hctx->ccid3hctx_s / TFRC_T_MBI); | 143 | hctx->ccid3hctx_s / TFRC_T_MBI); |
@@ -152,8 +149,7 @@ static void ccid3_hc_tx_update_x(struct sock *sk, struct timeval *now) | |||
152 | usecs_div(hctx->ccid3hctx_s, | 149 | usecs_div(hctx->ccid3hctx_s, |
153 | hctx->ccid3hctx_rtt) ); | 150 | hctx->ccid3hctx_rtt) ); |
154 | hctx->ccid3hctx_t_ld = *now; | 151 | hctx->ccid3hctx_t_ld = *now; |
155 | } else | 152 | } |
156 | ccid3_pr_debug("Not changing X\n"); | ||
157 | 153 | ||
158 | if (hctx->ccid3hctx_x != old_x) | 154 | if (hctx->ccid3hctx_x != old_x) |
159 | ccid3_update_send_time(hctx); | 155 | ccid3_update_send_time(hctx); |
@@ -223,9 +219,11 @@ static void ccid3_hc_tx_no_feedback_timer(unsigned long data) | |||
223 | ccid3_pr_debug("%s, sk=%p, state=%s, not idle\n", | 219 | ccid3_pr_debug("%s, sk=%p, state=%s, not idle\n", |
224 | dccp_role(sk), sk, | 220 | dccp_role(sk), sk, |
225 | ccid3_tx_state_name(hctx->ccid3hctx_state)); | 221 | ccid3_tx_state_name(hctx->ccid3hctx_state)); |
226 | /* Halve sending rate */ | ||
227 | 222 | ||
228 | /* If (p == 0 || X_calc > 2 * X_recv) | 223 | /* |
224 | * Modify the cached value of X_recv [RFC 3448, 4.4] | ||
225 | * | ||
226 | * If (p == 0 || X_calc > 2 * X_recv) | ||
229 | * X_recv = max(X_recv / 2, s / (2 * t_mbi)); | 227 | * X_recv = max(X_recv / 2, s / (2 * t_mbi)); |
230 | * Else | 228 | * Else |
231 | * X_recv = X_calc / 4; | 229 | * X_recv = X_calc / 4; |
@@ -233,14 +231,15 @@ static void ccid3_hc_tx_no_feedback_timer(unsigned long data) | |||
233 | BUG_ON(hctx->ccid3hctx_p && !hctx->ccid3hctx_x_calc); | 231 | BUG_ON(hctx->ccid3hctx_p && !hctx->ccid3hctx_x_calc); |
234 | 232 | ||
235 | if (hctx->ccid3hctx_p == 0 || | 233 | if (hctx->ccid3hctx_p == 0 || |
236 | hctx->ccid3hctx_x_calc > 2 * hctx->ccid3hctx_x_recv) | 234 | hctx->ccid3hctx_x_calc > 2 * hctx->ccid3hctx_x_recv) { |
237 | hctx->ccid3hctx_x_recv = max_t(u32, hctx->ccid3hctx_x_recv / 2, | 235 | hctx->ccid3hctx_x_recv = max_t(u32, hctx->ccid3hctx_x_recv / 2, |
238 | hctx->ccid3hctx_s / (2 * TFRC_T_MBI)); | 236 | hctx->ccid3hctx_s / (2 * TFRC_T_MBI)); |
239 | else | 237 | if (hctx->ccid3hctx_p == 0) |
238 | dccp_timestamp(sk, &now); | ||
239 | } else | ||
240 | hctx->ccid3hctx_x_recv = hctx->ccid3hctx_x_calc / 4; | 240 | hctx->ccid3hctx_x_recv = hctx->ccid3hctx_x_calc / 4; |
241 | 241 | ||
242 | /* Update sending rate */ | 242 | /* Now recalculate X [RFC 3448, 4.3, step (4)] */ |
243 | dccp_timestamp(sk, &now); | ||
244 | ccid3_hc_tx_update_x(sk, &now); | 243 | ccid3_hc_tx_update_x(sk, &now); |
245 | } | 244 | } |
246 | /* | 245 | /* |
@@ -496,6 +495,12 @@ static void ccid3_hc_tx_packet_recv(struct sock *sk, struct sk_buff *skb) | |||
496 | hctx->ccid3hctx_rtt = (9 * hctx->ccid3hctx_rtt + | 495 | hctx->ccid3hctx_rtt = (9 * hctx->ccid3hctx_rtt + |
497 | (u32)r_sample ) / 10; | 496 | (u32)r_sample ) / 10; |
498 | 497 | ||
498 | /* Update sending rate (step 4 of [RFC 3448, 4.3]) */ | ||
499 | if (hctx->ccid3hctx_p > 0) | ||
500 | hctx->ccid3hctx_x_calc = | ||
501 | tfrc_calc_x(hctx->ccid3hctx_s, | ||
502 | hctx->ccid3hctx_rtt, | ||
503 | hctx->ccid3hctx_p); | ||
499 | ccid3_hc_tx_update_x(sk, &now); | 504 | ccid3_hc_tx_update_x(sk, &now); |
500 | 505 | ||
501 | ccid3_pr_debug("%s(%p), RTT=%uus (sample=%ldus), s=%u, " | 506 | ccid3_pr_debug("%s(%p), RTT=%uus (sample=%ldus), s=%u, " |