Skip to contentSkip to conversation

CCID2: Fix jiffie wrap issues

PATCH In review Andrea Bittau 1 participant 1 message Jun 22, 2006 Networking

lore
Share & tools
lore
#0 lore raw

PATCH 4/11 CCID2: Fix jiffie wrap issues

Jiffies are now handled correctly (I hope) in CCID2. If they wrap, no problem.

---

net/dccp/ccids/ccid2.c +4 -4
index 6fe9cb9..f953016 100644
@@ -27,7 +27,6 @@
  *
  * BUGS:
  * - sequence number wrapping
- * - jiffies wrapping
  */
 
 #include <linux/config.h>
@@ -72,7 +71,8 @@ static void ccid2_hc_tx_check_sanity(con
 
 			/* packets are sent sequentially */
 			BUG_ON(seqp->ccid2s_seq <= prev->ccid2s_seq);
-			BUG_ON(seqp->ccid2s_sent < prev->ccid2s_sent);
+			BUG_ON(time_before(seqp->ccid2s_sent,
+					   prev->ccid2s_sent));
 			BUG_ON(len > ccid2_seq_len);
 
 			seqp = prev;
@@ -419,8 +419,9 @@ static inline void ccid2_new_ack(struct 
 
 	/* update RTO */
 	if (hctx->ccid2hctx_srtt = -1 ||
-	    (jiffies - hctx->ccid2hctx_lastrtt) >= hctx->ccid2hctx_srtt) {
-		unsigned long r = jiffies - seqp->ccid2s_sent;
+	    ((long)jiffies - (long)hctx->ccid2hctx_lastrtt) >+	     hctx->ccid2hctx_srtt) {
+		unsigned long r = (long)jiffies - (long)seqp->ccid2s_sent;
 		int s;
 
 		/* first measurement */