Skip to contentSkip to conversation

: Consolidate timer resets

PATCH In review Gerrit Renker 3 participants 3 messages Nov 27, 2006 Networking

lore
Share & tools
lore
#0 lore raw

PATCH v2 4/10 : Consolidate timer resets

This corrects the previously send patch in that
* the commit message is corrected with regard to the reference from RFC 4342
* the patch has been updated with regard to this reference

-----------------> Commit Message <---------------------------- [CCID 3]: 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

---
 net/dccp/ccids/ccid3.c |   18 +++++++++---------
 net/dccp/ccids/ccid3.h |    2 +-
 2 files changed, 10 insertions(+), 10 deletions(-)
net/dccp/ccids/ccid3.c +9 -9
@@ -172,16 +172,14 @@ static inline void ccid3_hc_tx_update_s(
 static void ccid3_hc_tx_no_feedback_timer(unsigned long data)
 {
 	struct sock *sk = (struct sock *)data;
-	unsigned long next_tmout = 0;
 	struct ccid3_hc_tx_sock *hctx = ccid3_hc_tx_sk(sk);
+	unsigned long next_tmout = USEC_PER_SEC / 5;
 
 	bh_lock_sock(sk);
 	if (sock_owned_by_user(sk)) {
 		/* Try again later. */
 		/* XXX: set some sensible MIB */
-		sk_reset_timer(sk, &hctx->ccid3hctx_no_feedback_timer,
-			       jiffies + HZ / 5);
-		goto out;
+		goto restart_timer;
 	}
 
 	ccid3_pr_debug("%s, sk=%p, state=%s\n", dccp_role(sk), sk,
@@ -201,9 +199,9 @@ static void ccid3_hc_tx_no_feedback_time
 			       dccp_role(sk), sk,
 			       ccid3_tx_state_name(hctx->ccid3hctx_state),
 			       hctx->ccid3hctx_x);
-		next_tmout = max_t(u32, 2 * usecs_div(hctx->ccid3hctx_s,
-						      hctx->ccid3hctx_x),
-					TFRC_INITIAL_TIMEOUT);
+		/* The value of R is still undefined and so we can not recompute
+		 * the timout value. Keep initial value as per [RFC 4342, 5]. */
+		next_tmout = TFRC_INITIAL_TIMEOUT;
 		/*
 		 * FIXME - not sure above calculation is correct. See section
 		 * 5 of CCID3 11 should adjust tx_t_ipi and double that to
@@ -257,9 +255,11 @@ static void ccid3_hc_tx_no_feedback_time
 		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;
+
+restart_timer:
+	sk_reset_timer(sk, &hctx->ccid3hctx_no_feedback_timer,
+		           jiffies + usecs_to_jiffies(next_tmout));
 out:
 	bh_unlock_sock(sk);
 	sock_put(sk);
net/dccp/ccids/ccid3.h +1 -1
@@ -42,7 +42,7 @@
 #include <linux/tfrc.h>
 #include "../ccid.h"
 
-/* Two seconds as per CCID3 spec */
+/* Two seconds as per RFC 3448 4.2 */
 #define TFRC_INITIAL_TIMEOUT	   (2 * USEC_PER_SEC)
 
 /* In usecs - half the scheduling granularity as per RFC3448 4.6 */
#1 lore raw
Quoted 15 lines · Gerrit Renker

This corrects the previously send patch in that
* the commit message is corrected with regard to the reference from RFC 4342
* the patch has been updated with regard to this reference

-----------------> Commit Message <---------------------------- [CCID 3]: 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".

Quoted 2 lines

Many thanks to Ian McDonald for pointing this out and providing the clarification.

Ian, are you OK with this one?

- Arnaldo

Quoted 76 lines

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

---
 net/dccp/ccids/ccid3.c |   18 +++++++++---------
 net/dccp/ccids/ccid3.h |    2 +-
 2 files changed, 10 insertions(+), 10 deletions(-)
net/dccp/ccids/ccid3.c +9 -9
@@ -172,16 +172,14 @@ static inline void ccid3_hc_tx_update_s(
 static void ccid3_hc_tx_no_feedback_timer(unsigned long data)
 {
        struct sock *sk = (struct sock *)data;
-       unsigned long next_tmout = 0;
        struct ccid3_hc_tx_sock *hctx = ccid3_hc_tx_sk(sk);
+       unsigned long next_tmout = USEC_PER_SEC / 5;
 
        bh_lock_sock(sk);
        if (sock_owned_by_user(sk)) {
                /* Try again later. */
                /* XXX: set some sensible MIB */
-               sk_reset_timer(sk, &hctx->ccid3hctx_no_feedback_timer,
-                              jiffies + HZ / 5);
-               goto out;
+               goto restart_timer;
        }
 
        ccid3_pr_debug("%s, sk=%p, state=%s\n", dccp_role(sk), sk,
@@ -201,9 +199,9 @@ static void ccid3_hc_tx_no_feedback_time
                               dccp_role(sk), sk,
                               ccid3_tx_state_name(hctx->ccid3hctx_state),
                               hctx->ccid3hctx_x);
-               next_tmout = max_t(u32, 2 * usecs_div(hctx->ccid3hctx_s,
-                                                     hctx->ccid3hctx_x),
-                                       TFRC_INITIAL_TIMEOUT);
+               /* The value of R is still undefined and so we can not recompute
+                * the timout value. Keep initial value as per [RFC 4342, 5]. */
+               next_tmout = TFRC_INITIAL_TIMEOUT;
                /*
                 * FIXME - not sure above calculation is correct. See section
                 * 5 of CCID3 11 should adjust tx_t_ipi and double that to
@@ -257,9 +255,11 @@ static void ccid3_hc_tx_no_feedback_time
                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;
+
+restart_timer:
+       sk_reset_timer(sk, &hctx->ccid3hctx_no_feedback_timer,
+                          jiffies + usecs_to_jiffies(next_tmout));
 out:
        bh_unlock_sock(sk);
        sock_put(sk);
net/dccp/ccids/ccid3.h +1 -2
@@ -42,7 +42,7 @@
 #include <linux/tfrc.h>
 #include "../ccid.h"
 
-/* Two seconds as per CCID3 spec */
+/* Two seconds as per RFC 3448 4.2 */
 #define TFRC_INITIAL_TIMEOUT      (2 * USEC_PER_SEC)
 
 /* In usecs - half the scheduling granularity as per RFC3448 4.6 */
-

To unsubscribe from this list: send the line "unsubscribe dccp" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#2 lore raw
In reply to Gerrit Renker
Quoted 2 lines · Arnaldo Carvalho de Melo

Ian, are you OK with this one?

Yes - I think my email with the ack crossed paths with your email!

Will still do full performance testing later this week but all looks OK with these series of patches.

Ian

Signature · 7 lines
Ian McDonald
Web: http://wand.net.nz/~iam4
Blog: http://imcdnzl.blogspot.com
WAND Network Research Group
Department of Computer Science
University of Waikato
New Zealand