Subject: Re: [net-2.6.22] [TCP]: Fix linkage errors.

From: Adrian Bunk <[email-masked]>
Date: Tue, 24 Apr 2007 17:53:24 +0200

On Wed, Apr 25, 2007 at 12:17:43AM +0900, YOSHIFUJI Hideaki / 吉藤英明 wrote:
> Recent ktime_t changes had introduced linkage errors.
> 
> | WARNING: "__divdi3" [net/ipv4/tcp_veno.ko] undefined!
> | WARNING: "__divdi3" [net/ipv4/tcp_vegas.ko] undefined!
> | WARNING: "__divdi3" [net/ipv4/tcp_lp.ko] undefined!
> | WARNING: "__divdi3" [net/ipv4/tcp_illinois.ko] undefined!
> 
> Signed-off-by: YOSHIFUJI Hideaki <[email-masked]>
> 
> ---
> diff --git a/net/ipv4/tcp_illinois.c b/net/ipv4/tcp_illinois.c
> index 8e31659..0cec615 100644
> --- a/net/ipv4/tcp_illinois.c
> +++ b/net/ipv4/tcp_illinois.c
> @@ -87,10 +87,12 @@ static void tcp_illinois_acked(struct sock *sk, u32 pkts_acked, ktime_t last)
>  {
>  	struct illinois *ca = inet_csk_ca(sk);
>  	u32 rtt;
> +	struct timeval tv;
>  
>  	ca->acked = pkts_acked;
>  
> -	rtt = ktime_to_ns(net_timedelta(last)) / NSEC_PER_USEC;
> +	tv = ktime_to_timeval(net_timedelta(last));
> +	rtt = tv.tv_sec * USEC_PER_SEC + tv.tv_usec;
>  
>  	/* ignore bogus values, this prevents wraparound in alpha math */
>  	if (rtt > RTT_MAX)
>...

Couldn't this be better solved by adding something like the following 
to include/linux/ktime.h ?

static inline s64 ktime_to_us(const ktime_t kt)
{
   return (s64) kt.tv.sec * USEC_PER_SEC + kt.tv.nsec / NSEC_PER_USEC;
}

cu
Adrian

-- 

       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed