提交 e575235f 编写于 作者: D Daniel Borkmann 提交者: David S. Miller

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: NDaniel Borkmann <dborkman@redhat.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 b82e8f31
...@@ -838,10 +838,10 @@ struct sctp_transport { ...@@ -838,10 +838,10 @@ struct sctp_transport {
unsigned long sackdelay; unsigned long sackdelay;
__u32 sackfreq; __u32 sackfreq;
/* When was the last time (in jiffies) that we heard from this /* When was the last time that we heard from this transport? We use
* transport? We use this to pick new active and retran paths. * this to pick new active and retran paths.
*/ */
unsigned long last_time_heard; ktime_t last_time_heard;
/* Last time(in jiffies) when cwnd is reduced due to the congestion /* Last time(in jiffies) when cwnd is reduced due to the congestion
* indication based on ECNE chunk. * indication based on ECNE chunk.
......
...@@ -1036,7 +1036,7 @@ static void sctp_assoc_bh_rcv(struct work_struct *work) ...@@ -1036,7 +1036,7 @@ static void sctp_assoc_bh_rcv(struct work_struct *work)
} }
if (chunk->transport) if (chunk->transport)
chunk->transport->last_time_heard = jiffies; chunk->transport->last_time_heard = ktime_get();
/* Run through the state machine. */ /* Run through the state machine. */
error = sctp_do_sm(net, SCTP_EVENT_T_CHUNK, subtype, 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) ...@@ -1283,11 +1283,13 @@ static void sctp_select_active_and_retran_path(struct sctp_association *asoc)
trans->state == SCTP_PF) trans->state == SCTP_PF)
continue; continue;
if (trans_pri == NULL || 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_sec = trans_pri;
trans_pri = trans; trans_pri = trans;
} else if (trans_sec == NULL || } 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; trans_sec = trans;
} }
} }
......
...@@ -481,7 +481,7 @@ static void sctp_endpoint_bh_rcv(struct work_struct *work) ...@@ -481,7 +481,7 @@ static void sctp_endpoint_bh_rcv(struct work_struct *work)
} }
if (chunk->transport) if (chunk->transport)
chunk->transport->last_time_heard = jiffies; chunk->transport->last_time_heard = ktime_get();
error = sctp_do_sm(net, SCTP_EVENT_T_CHUNK, subtype, state, error = sctp_do_sm(net, SCTP_EVENT_T_CHUNK, subtype, state,
ep, asoc, chunk, GFP_ATOMIC); ep, asoc, chunk, GFP_ATOMIC);
......
...@@ -72,7 +72,7 @@ static struct sctp_transport *sctp_transport_init(struct net *net, ...@@ -72,7 +72,7 @@ static struct sctp_transport *sctp_transport_init(struct net *net,
*/ */
peer->rto = msecs_to_jiffies(net->sctp.rto_initial); peer->rto = msecs_to_jiffies(net->sctp.rto_initial);
peer->last_time_heard = jiffies; peer->last_time_heard = ktime_get();
peer->last_time_ecne_reduced = jiffies; peer->last_time_ecne_reduced = jiffies;
peer->param_flags = SPP_HB_DISABLE | peer->param_flags = SPP_HB_DISABLE |
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册