summaryrefslogtreecommitdiff
path: root/net/sctp/associola.c
diff options
context:
space:
mode:
authorDaniel Borkmann <dborkman@redhat.com>2014-06-11 16:19:30 (GMT)
committerDavid S. Miller <davem@davemloft.net>2014-06-11 19:23:17 (GMT)
commite575235fc6026bb75e166ff68f84118c62d73f94 (patch)
tree299131847e629caa9201f9ba8066302864e0f22d /net/sctp/associola.c
parentb82e8f31acc7d799638692e65ff017f3e1b6a43d (diff)
downloadlinux-e575235fc6026bb75e166ff68f84118c62d73f94.tar.xz
net: sctp: migrate most recently used transport to ktime
Be more precise in transport path selection and use ktime helpers instead of jiffies to compare and pick the better primary and secondary recently used transports. This also avoids any side-effects during a possible roll-over, and could lead to better path decision-making. Signed-off-by: Daniel Borkmann <dborkman@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sctp/associola.c')
-rw-r--r--net/sctp/associola.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/net/sctp/associola.c b/net/sctp/associola.c
index 9f1cc6f..620c99e 100644
--- a/net/sctp/associola.c
+++ b/net/sctp/associola.c
@@ -1036,7 +1036,7 @@ static void sctp_assoc_bh_rcv(struct work_struct *work)
}
if (chunk->transport)
- chunk->transport->last_time_heard = jiffies;
+ chunk->transport->last_time_heard = ktime_get();
/* Run through the state machine. */
error = sctp_do_sm(net, SCTP_EVENT_T_CHUNK, subtype,
@@ -1283,11 +1283,13 @@ static void sctp_select_active_and_retran_path(struct sctp_association *asoc)
trans->state == SCTP_PF)
continue;
if (trans_pri == NULL ||
- trans->last_time_heard > trans_pri->last_time_heard) {
+ ktime_after(trans->last_time_heard,
+ trans_pri->last_time_heard)) {
trans_sec = trans_pri;
trans_pri = trans;
} else if (trans_sec == NULL ||
- trans->last_time_heard > trans_sec->last_time_heard) {
+ ktime_after(trans->last_time_heard,
+ trans_sec->last_time_heard)) {
trans_sec = trans;
}
}