diff options
author | Gerrit Renker <gerrit@erg.abdn.ac.uk> | 2006-11-27 17:29:27 -0500 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-12-03 00:30:50 -0500 |
commit | 48e03eee715b9e19df03153f2bcce6413632afcb (patch) | |
tree | 7a2995b3ac6bad9cac4309e97690dc0aa63a2868 | |
parent | b798a9ede2b2434b9cbf0f3aee3e8598586fa89c (diff) |
[DCCP] ccid3: Consolidate timer resets
This patch concerns updating the value of the nofeedback timer when no feedback
has been received so far.
Since in this case the value of R is still undefined according to [RFC 3448,
4.2], we can not perform step (3) of [RFC 3448, 4.3]. A clarification is
provided in [RFC 4342, sec. 5], which states that in these cases the nofeedback
timer (still) expires "after two seconds".
Many thanks to Ian McDonald for pointing this out and providing the
clarification.
The patch
* implements [RFC 4342, sec. 5] with regard to the above case
* consolidates handling timer restart by
- adding an appropriate jump label and
- initialising the timeout value
Acked-by: Ian McDonald <ian.mcdonald@jandi.co.nz>
Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>
Signed-off-by: Arnaldo Carvalho de Melo <acme@mandriva.com>
-rw-r--r-- | net/dccp/ccids/ccid3.c | 18 | ||||
-rw-r--r-- | net/dccp/ccids/ccid3.h | 2 |
2 files changed, 10 insertions, 10 deletions
diff --git a/net/dccp/ccids/ccid3.c b/net/dccp/ccids/ccid3.c index 6777a7f33a9a..9297fca78683 100644 --- a/net/dccp/ccids/ccid3.c +++ b/net/dccp/ccids/ccid3.c | |||
@@ -154,16 +154,14 @@ static void ccid3_hc_tx_update_x(struct sock *sk) | |||
154 | static void ccid3_hc_tx_no_feedback_timer(unsigned long data) | 154 | static void ccid3_hc_tx_no_feedback_timer(unsigned long data) |
155 | { | 155 | { |
156 | struct sock *sk = (struct sock *)data; | 156 | struct sock *sk = (struct sock *)data; |
157 | unsigned long next_tmout = 0; | ||
158 | struct ccid3_hc_tx_sock *hctx = ccid3_hc_tx_sk(sk); | 157 | struct ccid3_hc_tx_sock *hctx = ccid3_hc_tx_sk(sk); |
158 | unsigned long next_tmout = USEC_PER_SEC / 5; | ||
159 | 159 | ||
160 | bh_lock_sock(sk); | 160 | bh_lock_sock(sk); |
161 | if (sock_owned_by_user(sk)) { | 161 | if (sock_owned_by_user(sk)) { |
162 | /* Try again later. */ | 162 | /* Try again later. */ |
163 | /* XXX: set some sensible MIB */ | 163 | /* XXX: set some sensible MIB */ |
164 | sk_reset_timer(sk, &hctx->ccid3hctx_no_feedback_timer, | 164 | goto restart_timer; |
165 | jiffies + HZ / 5); | ||
166 | goto out; | ||
167 | } | 165 | } |
168 | 166 | ||
169 | ccid3_pr_debug("%s, sk=%p, state=%s\n", dccp_role(sk), sk, | 167 | ccid3_pr_debug("%s, sk=%p, state=%s\n", dccp_role(sk), sk, |
@@ -183,9 +181,9 @@ static void ccid3_hc_tx_no_feedback_timer(unsigned long data) | |||
183 | dccp_role(sk), sk, | 181 | dccp_role(sk), sk, |
184 | ccid3_tx_state_name(hctx->ccid3hctx_state), | 182 | ccid3_tx_state_name(hctx->ccid3hctx_state), |
185 | hctx->ccid3hctx_x); | 183 | hctx->ccid3hctx_x); |
186 | next_tmout = max_t(u32, 2 * usecs_div(hctx->ccid3hctx_s, | 184 | /* The value of R is still undefined and so we can not recompute |
187 | hctx->ccid3hctx_x), | 185 | * the timout value. Keep initial value as per [RFC 4342, 5]. */ |
188 | TFRC_INITIAL_TIMEOUT); | 186 | next_tmout = TFRC_INITIAL_TIMEOUT; |
189 | /* | 187 | /* |
190 | * FIXME - not sure above calculation is correct. See section | 188 | * FIXME - not sure above calculation is correct. See section |
191 | * 5 of CCID3 11 should adjust tx_t_ipi and double that to | 189 | * 5 of CCID3 11 should adjust tx_t_ipi and double that to |
@@ -239,9 +237,11 @@ static void ccid3_hc_tx_no_feedback_timer(unsigned long data) | |||
239 | goto out; | 237 | goto out; |
240 | } | 238 | } |
241 | 239 | ||
242 | sk_reset_timer(sk, &hctx->ccid3hctx_no_feedback_timer, | ||
243 | jiffies + max_t(u32, 1, usecs_to_jiffies(next_tmout))); | ||
244 | hctx->ccid3hctx_idle = 1; | 240 | hctx->ccid3hctx_idle = 1; |
241 | |||
242 | restart_timer: | ||
243 | sk_reset_timer(sk, &hctx->ccid3hctx_no_feedback_timer, | ||
244 | jiffies + usecs_to_jiffies(next_tmout)); | ||
245 | out: | 245 | out: |
246 | bh_unlock_sock(sk); | 246 | bh_unlock_sock(sk); |
247 | sock_put(sk); | 247 | sock_put(sk); |
diff --git a/net/dccp/ccids/ccid3.h b/net/dccp/ccids/ccid3.h index 462165234ff6..970921700ce3 100644 --- a/net/dccp/ccids/ccid3.h +++ b/net/dccp/ccids/ccid3.h | |||
@@ -46,7 +46,7 @@ | |||
46 | #define TFRC_STD_PACKET_SIZE 256 | 46 | #define TFRC_STD_PACKET_SIZE 256 |
47 | #define TFRC_MAX_PACKET_SIZE 65535 | 47 | #define TFRC_MAX_PACKET_SIZE 65535 |
48 | 48 | ||
49 | /* Two seconds as per CCID3 spec */ | 49 | /* Two seconds as per RFC 3448 4.2 */ |
50 | #define TFRC_INITIAL_TIMEOUT (2 * USEC_PER_SEC) | 50 | #define TFRC_INITIAL_TIMEOUT (2 * USEC_PER_SEC) |
51 | 51 | ||
52 | /* In usecs - half the scheduling granularity as per RFC3448 4.6 */ | 52 | /* In usecs - half the scheduling granularity as per RFC3448 4.6 */ |