Skip to contentSkip to conversation

sctp: used time_before or time_after for comparing jiffies

PATCH New Wei Yongjun 1 participant 1 message Feb 20, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sctp: used time_before or time_after for comparing jiffies

The functions time_before or time_after are more robust for comparing jiffies against other values.

---
 net/sctp/outqueue.c  |    3 ++-
 net/sctp/transport.c |    7 ++++---
 2 files changed, 6 insertions(+), 4 deletions(-)
net/sctp/outqueue.c +2 -1
index bc411c8..a367d15 100644
@@ -428,7 +428,8 @@ void sctp_retransmit_mark(struct sctp_outq *q,
 			 * retransmitting due to T3 timeout.
 			 */
 			if (reason = SCTP_RTXR_T3_RTX &&
-			    (jiffies - chunk->sent_at) < transport->last_rto)
+			    time_before(jiffies, chunk->sent_at +
+						 transport->last_rto))
 				continue;
 
 			/* RFC 2960 6.2.1 Processing a Received SACK
net/sctp/transport.c +4 -3
index e745c11..e197b76 100644
@@ -542,8 +542,8 @@ void sctp_transport_lower_cwnd(struct sctp_transport *transport,
 		 * congestion indications more than once every window of
 		 * data (or more loosely more than once every round-trip time).
 		 */
-		if ((jiffies - transport->last_time_ecne_reduced) >
-		    transport->rtt) {
+		if (time_after(jiffies, transport->last_time_ecne_reduced +
+					transport->rtt)) {
 			transport->ssthresh = max(transport->cwnd/2,
 						  4*transport->asoc->pathmtu);
 			transport->cwnd = transport->ssthresh;
@@ -560,7 +560,8 @@ void sctp_transport_lower_cwnd(struct sctp_transport *transport,
 		 * to be done every RTO interval, we do it every hearbeat
 		 * interval.
 		 */
-		if ((jiffies - transport->last_time_used) > transport->rto)
+		if (time_after(jiffies, transport->last_time_used +
+					transport->rto))
 			transport->cwnd = max(transport->cwnd/2,
 						 4*transport->asoc->pathmtu);
 		break;
Signature · 1 line
1.5.3.8