Commit 48e03eee authored by Gerrit Renker's avatar Gerrit Renker Committed by David S. Miller

[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: default avatarIan McDonald <ian.mcdonald@jandi.co.nz>
Signed-off-by: default avatarGerrit Renker <gerrit@erg.abdn.ac.uk>
Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@mandriva.com>
parent b798a9ed
...@@ -154,16 +154,14 @@ static void ccid3_hc_tx_update_x(struct sock *sk) ...@@ -154,16 +154,14 @@ static void ccid3_hc_tx_update_x(struct sock *sk)
static void ccid3_hc_tx_no_feedback_timer(unsigned long data) static void ccid3_hc_tx_no_feedback_timer(unsigned long data)
{ {
struct sock *sk = (struct sock *)data; struct sock *sk = (struct sock *)data;
unsigned long next_tmout = 0;
struct ccid3_hc_tx_sock *hctx = ccid3_hc_tx_sk(sk); struct ccid3_hc_tx_sock *hctx = ccid3_hc_tx_sk(sk);
unsigned long next_tmout = USEC_PER_SEC / 5;
bh_lock_sock(sk); bh_lock_sock(sk);
if (sock_owned_by_user(sk)) { if (sock_owned_by_user(sk)) {
/* Try again later. */ /* Try again later. */
/* XXX: set some sensible MIB */ /* XXX: set some sensible MIB */
sk_reset_timer(sk, &hctx->ccid3hctx_no_feedback_timer, goto restart_timer;
jiffies + HZ / 5);
goto out;
} }
ccid3_pr_debug("%s, sk=%p, state=%s\n", dccp_role(sk), sk, 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,9 +181,9 @@ static void ccid3_hc_tx_no_feedback_timer(unsigned long data)
dccp_role(sk), sk, dccp_role(sk), sk,
ccid3_tx_state_name(hctx->ccid3hctx_state), ccid3_tx_state_name(hctx->ccid3hctx_state),
hctx->ccid3hctx_x); hctx->ccid3hctx_x);
next_tmout = max_t(u32, 2 * usecs_div(hctx->ccid3hctx_s, /* The value of R is still undefined and so we can not recompute
hctx->ccid3hctx_x), * the timout value. Keep initial value as per [RFC 4342, 5]. */
TFRC_INITIAL_TIMEOUT); next_tmout = TFRC_INITIAL_TIMEOUT;
/* /*
* FIXME - not sure above calculation is correct. See section * FIXME - not sure above calculation is correct. See section
* 5 of CCID3 11 should adjust tx_t_ipi and double that to * 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,9 +237,11 @@ static void ccid3_hc_tx_no_feedback_timer(unsigned long data)
goto out; goto out;
} }
sk_reset_timer(sk, &hctx->ccid3hctx_no_feedback_timer,
jiffies + max_t(u32, 1, usecs_to_jiffies(next_tmout)));
hctx->ccid3hctx_idle = 1; hctx->ccid3hctx_idle = 1;
restart_timer:
sk_reset_timer(sk, &hctx->ccid3hctx_no_feedback_timer,
jiffies + usecs_to_jiffies(next_tmout));
out: out:
bh_unlock_sock(sk); bh_unlock_sock(sk);
sock_put(sk); sock_put(sk);
......
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
#define TFRC_STD_PACKET_SIZE 256 #define TFRC_STD_PACKET_SIZE 256
#define TFRC_MAX_PACKET_SIZE 65535 #define TFRC_MAX_PACKET_SIZE 65535
/* Two seconds as per CCID3 spec */ /* Two seconds as per RFC 3448 4.2 */
#define TFRC_INITIAL_TIMEOUT (2 * USEC_PER_SEC) #define TFRC_INITIAL_TIMEOUT (2 * USEC_PER_SEC)
/* In usecs - half the scheduling granularity as per RFC3448 4.6 */ /* In usecs - half the scheduling granularity as per RFC3448 4.6 */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment