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

2007-04-24 Thread YOSHIFUJI Hideaki / 吉藤英明
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 PROTECTED]>

---
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)
diff --git a/net/ipv4/tcp_lp.c b/net/ipv4/tcp_lp.c
index b4e062a..0b990ea 100644
--- a/net/ipv4/tcp_lp.c
+++ b/net/ipv4/tcp_lp.c
@@ -265,8 +265,10 @@ static void tcp_lp_pkts_acked(struct sock *sk, u32 
num_acked, ktime_t last)
 {
struct tcp_sock *tp = tcp_sk(sk);
struct lp *lp = inet_csk_ca(sk);
+   struct timeval tv;
 
-   tcp_lp_rtt_sample(sk,  ktime_to_ns(net_timedelta(last)) / 
NSEC_PER_USEC);
+   tv = ktime_to_timeval(net_timedelta(last));
+   tcp_lp_rtt_sample(sk, tv.tv_sec * USEC_PER_SEC + tv.tv_usec);
 
/* calc inference */
if (tcp_time_stamp > tp->rx_opt.rcv_tsecr)
diff --git a/net/ipv4/tcp_vegas.c b/net/ipv4/tcp_vegas.c
index 0f0ee7f..c13dc16 100644
--- a/net/ipv4/tcp_vegas.c
+++ b/net/ipv4/tcp_vegas.c
@@ -116,9 +116,11 @@ void tcp_vegas_pkts_acked(struct sock *sk, u32 cnt, 
ktime_t last)
 {
struct vegas *vegas = inet_csk_ca(sk);
u32 vrtt;
+   struct timeval tv;
 
/* Never allow zero rtt or baseRTT */
-   vrtt = (ktime_to_ns(net_timedelta(last)) / NSEC_PER_USEC) + 1;
+   tv = ktime_to_timeval(net_timedelta(last));
+   vrtt = tv.tv_sec * USEC_PER_SEC + tv.tv_usec;
 
/* Filter to find propagation delay: */
if (vrtt < vegas->baseRTT)
diff --git a/net/ipv4/tcp_veno.c b/net/ipv4/tcp_veno.c
index 0b50d06..a439c49 100644
--- a/net/ipv4/tcp_veno.c
+++ b/net/ipv4/tcp_veno.c
@@ -73,9 +73,11 @@ static void tcp_veno_pkts_acked(struct sock *sk, u32 cnt, 
ktime_t last)
 {
struct veno *veno = inet_csk_ca(sk);
u32 vrtt;
+   struct timeval tv;
 
/* Never allow zero rtt or baseRTT */
-   vrtt = (ktime_to_ns(net_timedelta(last)) / NSEC_PER_USEC) + 1;
+   tv = ktime_to_timeval(net_timedelta(last));
+   vrtt = tv.tv_sec * USEC_PER_SEC + tv.tv_usec;
 
/* Filter to find propagation delay: */
if (vrtt < veno->basertt)

-- 
YOSHIFUJI Hideaki @ USAGI Project  <[EMAIL PROTECTED]>
GPG-FP  : 9022 65EB 1ECF 3AD1 0BDF  80D8 4807 F894 E062 0EEA
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


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

2007-04-24 Thread Adrian Bunk
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 PROTECTED]>
> 
> ---
> 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

-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


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

2007-04-24 Thread YOSHIFUJI Hideaki / 吉藤英明
In article <[EMAIL PROTECTED]> (at Tue, 24 Apr 2007 17:53:24 +0200), Adrian 
Bunk <[EMAIL PROTECTED]> says:

> 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 PROTECTED]>
> > 
> > ---
> > 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;
> }
> 

That will introduce same error, won't it?

--yoshfuji
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


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

2007-04-24 Thread Eric Dumazet
On Tue, 24 Apr 2007 17:53:24 +0200
Adrian Bunk <[EMAIL PROTECTED]> wrote:
> 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;
> }
> 

Please check again include/linux/ktime.h

tv struct is defined inside 'ktime_t' only if BITS_PER_LONG != 64 && 
!defined(CONFIG_KTIME_SCALAR)

-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


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

2007-04-24 Thread YOSHIFUJI Hideaki / 吉藤英明
In article <[EMAIL PROTECTED]> (at Wed, 25 Apr 2007 00:58:45 +0900 (JST)), 
YOSHIFUJI Hideaki / 吉藤英明 <[EMAIL PROTECTED]> says:

> In article <[EMAIL PROTECTED]> (at Tue, 24 Apr 2007 17:53:24 +0200), Adrian 
> Bunk <[EMAIL PROTECTED]> says:
> 
> > 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 PROTECTED]>
> > > 
> > > ---
> > > 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;
> > }
> > 
> 
> That will introduce same error, won't it?

How about this?

Singed-off-by: YOSHIFUJI Hideaki <[EMAIL PROTECTED]>

diff --git a/include/linux/ktime.h b/include/linux/ktime.h
index 248305b..601a74e 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)
 
 #endif
 
+static inline s64 ktime_to_us(const ktime_t kt)
+{
+   struct timeval tv = ktime_to_timeval(kt);
+   return tv.tv_sec * USEC_PER_SEC + tv.tv_usec;
+}
+
 /*
  * The resolution of the clocks. The resolution value is returned in
  * 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 8e31659..4adc47c 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)
 
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 */
if (rtt > RTT_MAX)
diff --git a/net/ipv4/tcp_lp.c b/net/ipv4/tcp_lp.c
index b4e062a..43294ad 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)
struct tcp_sock *tp = tcp_sk(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 */
if (tcp_time_stamp > tp->rx_opt.rcv_tsecr)
diff --git a/net/ipv4/tcp_vegas.c b/net/ipv4/tcp_vegas.c
index 0f0ee7f..73e19cf 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)
u32 vrtt;
 
/* 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: */
if (vrtt < vegas->baseRTT)
diff --git a/net/ipv4/tcp_veno.c b/net/ipv4/tcp_veno.c
index 0b50d06..9edb340 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)
u32 vrtt;
 
/* 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: */
if (vrtt < veno->basertt)

-- 
YOSHIFUJI Hideaki @ USAGI Project  <[EMAIL PROTECTED]>
GPG-FP  : 9022 65EB 1ECF 3AD1 0BDF  80D8 4807 F894 E062 0EEA
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


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

2007-04-24 Thread Eric Dumazet
On Wed, 25 Apr 2007 01:10:28 +0900 (JST)
YOSHIFUJI Hideaki  <[EMAIL PROTECTED]> wrote:

> How about this?
> 
>  
> +static inline s64 ktime_to_us(const ktime_t kt)
> +{
> + struct timeval tv = ktime_to_timeval(kt);
> + return tv.tv_sec * USEC_PER_SEC + tv.tv_usec;
> +}
> +

Well, I am afraid it's not 100% correct.

If you really want to return s64 you should do

return (s64) tv.tv_sec * USEC_PER_SEC + tv.tv_usec;

But then it might be overkill to compute a full s64 for TCP use, since we use 
u32 vrtt

-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html


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

2007-04-24 Thread Adrian Bunk
On Tue, Apr 24, 2007 at 06:03:48PM +0200, Eric Dumazet wrote:
> On Tue, 24 Apr 2007 17:53:24 +0200
> Adrian Bunk <[EMAIL PROTECTED]> wrote:
> > 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;
> > }
> > 
> 
> Please check again include/linux/ktime.h
> 
> tv struct is defined inside 'ktime_t' only if BITS_PER_LONG != 64 && 
> !defined(CONFIG_KTIME_SCALAR)

That's the difference between a "what about" suggestion and an actual 
patch...

I was merely suggesting solvin it through a ktime_to_us(), not 
presenting a complete and tested patch.

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

-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html