diff options
-rw-r--r-- | include/linux/ktime.h | 6 | ||||
-rw-r--r-- | net/ipv4/tcp_illinois.c | 2 | ||||
-rw-r--r-- | net/ipv4/tcp_lp.c | 2 | ||||
-rw-r--r-- | net/ipv4/tcp_vegas.c | 2 | ||||
-rw-r--r-- | net/ipv4/tcp_veno.c | 2 |
5 files changed, 10 insertions, 4 deletions
diff --git a/include/linux/ktime.h b/include/linux/ktime.h index 248305bb9a18..81bb9c7a4eb3 100644 --- a/include/linux/ktime.h +++ b/include/linux/ktime.h | |||
@@ -259,6 +259,12 @@ static inline s64 ktime_to_ns(const ktime_t kt) | |||
259 | 259 | ||
260 | #endif | 260 | #endif |
261 | 261 | ||
262 | static inline s64 ktime_to_us(const ktime_t kt) | ||
263 | { | ||
264 | struct timeval tv = ktime_to_timeval(kt); | ||
265 | return (s64) tv.tv_sec * USEC_PER_SEC + tv.tv_usec; | ||
266 | } | ||
267 | |||
262 | /* | 268 | /* |
263 | * The resolution of the clocks. The resolution value is returned in | 269 | * The resolution of the clocks. The resolution value is returned in |
264 | * the clock_getres() system call to give application programmers an | 270 | * the clock_getres() system call to give application programmers an |
diff --git a/net/ipv4/tcp_illinois.c b/net/ipv4/tcp_illinois.c index 8e3165917f72..4adc47c55351 100644 --- a/net/ipv4/tcp_illinois.c +++ b/net/ipv4/tcp_illinois.c | |||
@@ -90,7 +90,7 @@ static void tcp_illinois_acked(struct sock *sk, u32 pkts_acked, ktime_t last) | |||
90 | 90 | ||
91 | ca->acked = pkts_acked; | 91 | ca->acked = pkts_acked; |
92 | 92 | ||
93 | rtt = ktime_to_ns(net_timedelta(last)) / NSEC_PER_USEC; | 93 | rtt = ktime_to_us(net_timedelta(last)); |
94 | 94 | ||
95 | /* ignore bogus values, this prevents wraparound in alpha math */ | 95 | /* ignore bogus values, this prevents wraparound in alpha math */ |
96 | if (rtt > RTT_MAX) | 96 | if (rtt > RTT_MAX) |
diff --git a/net/ipv4/tcp_lp.c b/net/ipv4/tcp_lp.c index b4e062ab24a1..43294ad9f63e 100644 --- a/net/ipv4/tcp_lp.c +++ b/net/ipv4/tcp_lp.c | |||
@@ -266,7 +266,7 @@ static void tcp_lp_pkts_acked(struct sock *sk, u32 num_acked, ktime_t last) | |||
266 | struct tcp_sock *tp = tcp_sk(sk); | 266 | struct tcp_sock *tp = tcp_sk(sk); |
267 | struct lp *lp = inet_csk_ca(sk); | 267 | struct lp *lp = inet_csk_ca(sk); |
268 | 268 | ||
269 | tcp_lp_rtt_sample(sk, ktime_to_ns(net_timedelta(last)) / NSEC_PER_USEC); | 269 | tcp_lp_rtt_sample(sk, ktime_to_us(net_timedelta(last))); |
270 | 270 | ||
271 | /* calc inference */ | 271 | /* calc inference */ |
272 | if (tcp_time_stamp > tp->rx_opt.rcv_tsecr) | 272 | if (tcp_time_stamp > tp->rx_opt.rcv_tsecr) |
diff --git a/net/ipv4/tcp_vegas.c b/net/ipv4/tcp_vegas.c index 0f0ee7f732c3..73e19cf7df21 100644 --- a/net/ipv4/tcp_vegas.c +++ b/net/ipv4/tcp_vegas.c | |||
@@ -118,7 +118,7 @@ void tcp_vegas_pkts_acked(struct sock *sk, u32 cnt, ktime_t last) | |||
118 | u32 vrtt; | 118 | u32 vrtt; |
119 | 119 | ||
120 | /* Never allow zero rtt or baseRTT */ | 120 | /* Never allow zero rtt or baseRTT */ |
121 | vrtt = (ktime_to_ns(net_timedelta(last)) / NSEC_PER_USEC) + 1; | 121 | vrtt = ktime_to_us(net_timedelta(last)) + 1; |
122 | 122 | ||
123 | /* Filter to find propagation delay: */ | 123 | /* Filter to find propagation delay: */ |
124 | if (vrtt < vegas->baseRTT) | 124 | if (vrtt < vegas->baseRTT) |
diff --git a/net/ipv4/tcp_veno.c b/net/ipv4/tcp_veno.c index 0b50d0607a0e..9edb340f2f95 100644 --- a/net/ipv4/tcp_veno.c +++ b/net/ipv4/tcp_veno.c | |||
@@ -75,7 +75,7 @@ static void tcp_veno_pkts_acked(struct sock *sk, u32 cnt, ktime_t last) | |||
75 | u32 vrtt; | 75 | u32 vrtt; |
76 | 76 | ||
77 | /* Never allow zero rtt or baseRTT */ | 77 | /* Never allow zero rtt or baseRTT */ |
78 | vrtt = (ktime_to_ns(net_timedelta(last)) / NSEC_PER_USEC) + 1; | 78 | vrtt = ktime_to_us(net_timedelta(last)) + 1; |
79 | 79 | ||
80 | /* Filter to find propagation delay: */ | 80 | /* Filter to find propagation delay: */ |
81 | if (vrtt < veno->basertt) | 81 | if (vrtt < veno->basertt) |