Commit 84299b3b authored by YOSHIFUJI Hideaki's avatar YOSHIFUJI Hideaki Committed by David S. Miller

[TCP]: Fix linkage errors on i386.

To avoid raw division, use ktime_to_timeval() to get usec.
Signed-off-by: default avatarYOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 1f9eda7e
...@@ -259,6 +259,12 @@ static inline s64 ktime_to_ns(const ktime_t kt) ...@@ -259,6 +259,12 @@ static inline s64 ktime_to_ns(const ktime_t kt)
#endif #endif
static inline s64 ktime_to_us(const ktime_t kt)
{
struct timeval tv = ktime_to_timeval(kt);
return (s64) tv.tv_sec * USEC_PER_SEC + tv.tv_usec;
}
/* /*
* The resolution of the clocks. The resolution value is returned in * The resolution of the clocks. The resolution value is returned in
* the clock_getres() system call to give application programmers an * the clock_getres() system call to give application programmers an
......
...@@ -90,7 +90,7 @@ static void tcp_illinois_acked(struct sock *sk, u32 pkts_acked, ktime_t last) ...@@ -90,7 +90,7 @@ static void tcp_illinois_acked(struct sock *sk, u32 pkts_acked, ktime_t last)
ca->acked = pkts_acked; ca->acked = pkts_acked;
rtt = ktime_to_ns(net_timedelta(last)) / NSEC_PER_USEC; rtt = ktime_to_us(net_timedelta(last));
/* ignore bogus values, this prevents wraparound in alpha math */ /* ignore bogus values, this prevents wraparound in alpha math */
if (rtt > RTT_MAX) if (rtt > RTT_MAX)
......
...@@ -266,7 +266,7 @@ static void tcp_lp_pkts_acked(struct sock *sk, u32 num_acked, ktime_t last) ...@@ -266,7 +266,7 @@ static void tcp_lp_pkts_acked(struct sock *sk, u32 num_acked, ktime_t last)
struct tcp_sock *tp = tcp_sk(sk); struct tcp_sock *tp = tcp_sk(sk);
struct lp *lp = inet_csk_ca(sk); struct lp *lp = inet_csk_ca(sk);
tcp_lp_rtt_sample(sk, ktime_to_ns(net_timedelta(last)) / NSEC_PER_USEC); tcp_lp_rtt_sample(sk, ktime_to_us(net_timedelta(last)));
/* calc inference */ /* calc inference */
if (tcp_time_stamp > tp->rx_opt.rcv_tsecr) if (tcp_time_stamp > tp->rx_opt.rcv_tsecr)
......
...@@ -118,7 +118,7 @@ void tcp_vegas_pkts_acked(struct sock *sk, u32 cnt, ktime_t last) ...@@ -118,7 +118,7 @@ void tcp_vegas_pkts_acked(struct sock *sk, u32 cnt, ktime_t last)
u32 vrtt; u32 vrtt;
/* Never allow zero rtt or baseRTT */ /* Never allow zero rtt or baseRTT */
vrtt = (ktime_to_ns(net_timedelta(last)) / NSEC_PER_USEC) + 1; vrtt = ktime_to_us(net_timedelta(last)) + 1;
/* Filter to find propagation delay: */ /* Filter to find propagation delay: */
if (vrtt < vegas->baseRTT) if (vrtt < vegas->baseRTT)
......
...@@ -75,7 +75,7 @@ static void tcp_veno_pkts_acked(struct sock *sk, u32 cnt, ktime_t last) ...@@ -75,7 +75,7 @@ static void tcp_veno_pkts_acked(struct sock *sk, u32 cnt, ktime_t last)
u32 vrtt; u32 vrtt;
/* Never allow zero rtt or baseRTT */ /* Never allow zero rtt or baseRTT */
vrtt = (ktime_to_ns(net_timedelta(last)) / NSEC_PER_USEC) + 1; vrtt = ktime_to_us(net_timedelta(last)) + 1;
/* Filter to find propagation delay: */ /* Filter to find propagation delay: */
if (vrtt < veno->basertt) if (vrtt < veno->basertt)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment