diff options
author | Arnaldo Carvalho de Melo <acme@ghostprotocols.net> | 2007-08-19 20:14:27 -0400 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2007-10-10 19:48:10 -0400 |
commit | ac198ea8d94a46830080372a539420cf4a8de4a3 (patch) | |
tree | c7d78474bf451d63c93f155f4d145b69f3b4371c /net/dccp/ccids | |
parent | 4d93df0abd50b9c9e2d4561439a1a1d21ec5e68f (diff) |
[DCCP]: Make ccid3_hc_tx_update_x get a timestamp if needed
The code was too complicated, if p > 0 in ccid3_hc_tx_no_feedback_timer the
timestamp was being obtained to be passed to ccid3_hc_tx_update_x, where only
if p > 0 the timestamp was needed, so just leave it to ccid3_hc_tx_update_x to
obtain the timestamp if needed.
This will help in the upcoming changesets where we'll convert t_ld to ktime_t.
We'll eventually try to reuse ktime_get_real() calls again.
Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/dccp/ccids')
-rw-r--r-- | net/dccp/ccids/ccid3.c | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/net/dccp/ccids/ccid3.c b/net/dccp/ccids/ccid3.c index e91c2b9dc27b..d0763adbce26 100644 --- a/net/dccp/ccids/ccid3.c +++ b/net/dccp/ccids/ccid3.c | |||
@@ -128,7 +128,7 @@ static inline void ccid3_update_send_interval(struct ccid3_hc_tx_sock *hctx) | |||
128 | * throughout the code. Only X_calc is unscaled (in bytes/second). | 128 | * throughout the code. Only X_calc is unscaled (in bytes/second). |
129 | * | 129 | * |
130 | */ | 130 | */ |
131 | static void ccid3_hc_tx_update_x(struct sock *sk, struct timeval *now) | 131 | static void ccid3_hc_tx_update_x(struct sock *sk) |
132 | 132 | ||
133 | { | 133 | { |
134 | struct ccid3_hc_tx_sock *hctx = ccid3_hc_tx_sk(sk); | 134 | struct ccid3_hc_tx_sock *hctx = ccid3_hc_tx_sk(sk); |
@@ -153,14 +153,20 @@ static void ccid3_hc_tx_update_x(struct sock *sk, struct timeval *now) | |||
153 | (((__u64)hctx->ccid3hctx_s) << 6) / | 153 | (((__u64)hctx->ccid3hctx_s) << 6) / |
154 | TFRC_T_MBI); | 154 | TFRC_T_MBI); |
155 | 155 | ||
156 | } else if (timeval_delta(now, &hctx->ccid3hctx_t_ld) - | 156 | } else { |
157 | (suseconds_t)hctx->ccid3hctx_rtt >= 0) { | 157 | struct timeval now; |
158 | 158 | ||
159 | hctx->ccid3hctx_x = | 159 | dccp_timestamp(sk, &now); |
160 | max(min(2 * hctx->ccid3hctx_x, min_rate), | 160 | |
161 | scaled_div(((__u64)hctx->ccid3hctx_s) << 6, | 161 | if ((timeval_delta(&now, &hctx->ccid3hctx_t_ld) - |
162 | hctx->ccid3hctx_rtt)); | 162 | (suseconds_t)hctx->ccid3hctx_rtt) >= 0) { |
163 | hctx->ccid3hctx_t_ld = *now; | 163 | |
164 | hctx->ccid3hctx_x = | ||
165 | max(min(2 * hctx->ccid3hctx_x, min_rate), | ||
166 | scaled_div(((__u64)hctx->ccid3hctx_s) << 6, | ||
167 | hctx->ccid3hctx_rtt)); | ||
168 | hctx->ccid3hctx_t_ld = now; | ||
169 | } | ||
164 | } | 170 | } |
165 | 171 | ||
166 | if (hctx->ccid3hctx_x != old_x) { | 172 | if (hctx->ccid3hctx_x != old_x) { |
@@ -214,7 +220,6 @@ static void ccid3_hc_tx_no_feedback_timer(unsigned long data) | |||
214 | { | 220 | { |
215 | struct sock *sk = (struct sock *)data; | 221 | struct sock *sk = (struct sock *)data; |
216 | struct ccid3_hc_tx_sock *hctx = ccid3_hc_tx_sk(sk); | 222 | struct ccid3_hc_tx_sock *hctx = ccid3_hc_tx_sk(sk); |
217 | struct timeval now; | ||
218 | unsigned long t_nfb = USEC_PER_SEC / 5; | 223 | unsigned long t_nfb = USEC_PER_SEC / 5; |
219 | 224 | ||
220 | bh_lock_sock(sk); | 225 | bh_lock_sock(sk); |
@@ -265,15 +270,12 @@ static void ccid3_hc_tx_no_feedback_timer(unsigned long data) | |||
265 | max(hctx->ccid3hctx_x_recv / 2, | 270 | max(hctx->ccid3hctx_x_recv / 2, |
266 | (((__u64)hctx->ccid3hctx_s) << 6) / | 271 | (((__u64)hctx->ccid3hctx_s) << 6) / |
267 | (2 * TFRC_T_MBI)); | 272 | (2 * TFRC_T_MBI)); |
268 | |||
269 | if (hctx->ccid3hctx_p == 0) | ||
270 | dccp_timestamp(sk, &now); | ||
271 | } else { | 273 | } else { |
272 | hctx->ccid3hctx_x_recv = hctx->ccid3hctx_x_calc; | 274 | hctx->ccid3hctx_x_recv = hctx->ccid3hctx_x_calc; |
273 | hctx->ccid3hctx_x_recv <<= 4; | 275 | hctx->ccid3hctx_x_recv <<= 4; |
274 | } | 276 | } |
275 | /* Now recalculate X [RFC 3448, 4.3, step (4)] */ | 277 | /* Now recalculate X [RFC 3448, 4.3, step (4)] */ |
276 | ccid3_hc_tx_update_x(sk, &now); | 278 | ccid3_hc_tx_update_x(sk); |
277 | /* | 279 | /* |
278 | * Schedule no feedback timer to expire in | 280 | * Schedule no feedback timer to expire in |
279 | * max(t_RTO, 2 * s/X) = max(t_RTO, 2 * t_ipi) | 281 | * max(t_RTO, 2 * s/X) = max(t_RTO, 2 * t_ipi) |
@@ -496,7 +498,7 @@ static void ccid3_hc_tx_packet_recv(struct sock *sk, struct sk_buff *skb) | |||
496 | tfrc_calc_x(hctx->ccid3hctx_s, | 498 | tfrc_calc_x(hctx->ccid3hctx_s, |
497 | hctx->ccid3hctx_rtt, | 499 | hctx->ccid3hctx_rtt, |
498 | hctx->ccid3hctx_p); | 500 | hctx->ccid3hctx_p); |
499 | ccid3_hc_tx_update_x(sk, &now); | 501 | ccid3_hc_tx_update_x(sk); |
500 | 502 | ||
501 | ccid3_pr_debug("%s(%p), RTT=%uus (sample=%uus), s=%u, " | 503 | ccid3_pr_debug("%s(%p), RTT=%uus (sample=%uus), s=%u, " |
502 | "p=%u, X_calc=%u, X_recv=%u, X=%u\n", | 504 | "p=%u, X_calc=%u, X_recv=%u, X=%u\n", |