Skip to content

Commit

Permalink
sctp: use time_before or time_after for comparing jiffies
Browse files Browse the repository at this point in the history
The functions time_before or time_after are more robust
for comparing jiffies against other values.

Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com>
Signed-off-by: Vlad Yasevich <vladislav.yasevich@hp.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Wei Yongjun authored and David S. Miller committed Mar 3, 2009
1 parent c6db93a commit f61f6f8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion net/sctp/outqueue.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 4 additions & 3 deletions net/sctp/transport.c
Original file line number Diff line number Diff line change
Expand Up @@ -543,8 +543,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;
Expand All @@ -561,7 +561,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;
Expand Down

0 comments on commit f61f6f8

Please sign in to comment.