aboutsummaryrefslogtreecommitdiffstats
path: root/net/dccp/input.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@ghostprotocols.net>2007-08-19 20:16:35 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-10 19:48:13 -0400
commit9823b7b5542858afe5b6a1e2df83b3847c28f3d6 (patch)
tree14be62612143fbcec66cd1b28a1d76564c578453 /net/dccp/input.c
parenta272378d1128d1c60a463a315646c86d174ff74c (diff)
[DCCP]: Convert dccp_sample_rtt to ktime_t
Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/dccp/input.c')
-rw-r--r--net/dccp/input.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/net/dccp/input.c b/net/dccp/input.c
index da6ec185ed5b..782cdb7292fa 100644
--- a/net/dccp/input.c
+++ b/net/dccp/input.c
@@ -301,12 +301,10 @@ static int dccp_rcv_request_sent_state_process(struct sock *sk,
301 goto out_invalid_packet; 301 goto out_invalid_packet;
302 302
303 /* Obtain RTT sample from SYN exchange (used by CCID 3) */ 303 /* Obtain RTT sample from SYN exchange (used by CCID 3) */
304 if (dp->dccps_options_received.dccpor_timestamp_echo) { 304 if (dp->dccps_options_received.dccpor_timestamp_echo)
305 struct timeval now; 305 dp->dccps_syn_rtt = dccp_sample_rtt(sk,
306 306 ktime_get_real(),
307 dccp_timestamp(sk, &now); 307 NULL);
308 dp->dccps_syn_rtt = dccp_sample_rtt(sk, &now, NULL);
309 }
310 308
311 if (dccp_msk(sk)->dccpms_send_ack_vector && 309 if (dccp_msk(sk)->dccpms_send_ack_vector &&
312 dccp_ackvec_add(dp->dccps_hc_rx_ackvec, sk, 310 dccp_ackvec_add(dp->dccps_hc_rx_ackvec, sk,
@@ -593,22 +591,21 @@ EXPORT_SYMBOL_GPL(dccp_rcv_state_process);
593 * @t_recv: receive timestamp of packet with timestamp echo 591 * @t_recv: receive timestamp of packet with timestamp echo
594 * @t_hist: packet history timestamp or NULL 592 * @t_hist: packet history timestamp or NULL
595 */ 593 */
596u32 dccp_sample_rtt(struct sock *sk, struct timeval *t_recv, 594u32 dccp_sample_rtt(struct sock *sk, ktime_t t_recv, ktime_t *t_hist)
597 struct timeval *t_hist)
598{ 595{
599 struct dccp_sock *dp = dccp_sk(sk); 596 struct dccp_sock *dp = dccp_sk(sk);
600 struct dccp_options_received *or = &dp->dccps_options_received; 597 struct dccp_options_received *or = &dp->dccps_options_received;
601 suseconds_t delta; 598 s64 delta;
602 599
603 if (t_hist == NULL) { 600 if (t_hist == NULL) {
604 if (!or->dccpor_timestamp_echo) { 601 if (!or->dccpor_timestamp_echo) {
605 DCCP_WARN("packet without timestamp echo\n"); 602 DCCP_WARN("packet without timestamp echo\n");
606 return DCCP_SANE_RTT_MAX; 603 return DCCP_SANE_RTT_MAX;
607 } 604 }
608 timeval_sub_usecs(t_recv, or->dccpor_timestamp_echo * 10); 605 ktime_sub_us(t_recv, or->dccpor_timestamp_echo * 10);
609 delta = timeval_usecs(t_recv); 606 delta = ktime_to_us(t_recv);
610 } else 607 } else
611 delta = timeval_delta(t_recv, t_hist); 608 delta = ktime_us_delta(t_recv, *t_hist);
612 609
613 delta -= or->dccpor_elapsed_time * 10; /* either set or 0 */ 610 delta -= or->dccpor_elapsed_time * 10; /* either set or 0 */
614 611
@@ -616,7 +613,7 @@ u32 dccp_sample_rtt(struct sock *sk, struct timeval *t_recv,
616 DCCP_WARN("unusable RTT sample %ld, using min\n", (long)delta); 613 DCCP_WARN("unusable RTT sample %ld, using min\n", (long)delta);
617 return DCCP_SANE_RTT_MIN; 614 return DCCP_SANE_RTT_MIN;
618 } 615 }
619 if (unlikely(delta - (suseconds_t)DCCP_SANE_RTT_MAX > 0)) { 616 if (unlikely(delta - (s64)DCCP_SANE_RTT_MAX > 0)) {
620 DCCP_WARN("RTT sample %ld too large, using max\n", (long)delta); 617 DCCP_WARN("RTT sample %ld too large, using max\n", (long)delta);
621 return DCCP_SANE_RTT_MAX; 618 return DCCP_SANE_RTT_MAX;
622 } 619 }