netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] tcp: /proc/net/tcp rto,ato values not scaled properly
@ 2008-06-20 18:56 Stephen Hemminger
  2008-06-20 19:05 ` David Miller
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Stephen Hemminger @ 2008-06-20 18:56 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

I found another case where we are sending information to userspace
in the wrong HZ scale.  This should have been fixed back in 2.5 :-(

This means an ABI change but as it stands there is no way for an application
like ss to get the right value.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

--- a/net/ipv4/tcp_ipv4.c	2008-06-20 11:44:10.000000000 -0700
+++ b/net/ipv4/tcp_ipv4.c	2008-06-20 11:46:35.000000000 -0700
@@ -2201,8 +2201,8 @@ static void get_tcp4_sock(struct sock *s
 		icsk->icsk_probes_out,
 		sock_i_ino(sk),
 		atomic_read(&sk->sk_refcnt), sk,
-		icsk->icsk_rto,
-		icsk->icsk_ack.ato,
+		jiffies_to_clock_t(icsk->icsk_rto),
+		jiffies_to_clock_t(icsk->icsk_ack.ato),
 		(icsk->icsk_ack.quick << 1) | icsk->icsk_ack.pingpong,
 		tp->snd_cwnd,
 		tp->snd_ssthresh >= 0xFFFF ? -1 : tp->snd_ssthresh,
--- a/net/ipv6/tcp_ipv6.c	2008-06-20 11:46:48.000000000 -0700
+++ b/net/ipv6/tcp_ipv6.c	2008-06-20 11:47:10.000000000 -0700
@@ -1962,8 +1962,8 @@ static void get_tcp6_sock(struct seq_fil
 		   icsk->icsk_probes_out,
 		   sock_i_ino(sp),
 		   atomic_read(&sp->sk_refcnt), sp,
-		   icsk->icsk_rto,
-		   icsk->icsk_ack.ato,
+		   jiffies_to_clock_t(icsk->icsk_rto),
+		   jiffies_to_clock_t(icsk->icsk_ack.ato),
 		   (icsk->icsk_ack.quick << 1 ) | icsk->icsk_ack.pingpong,
 		   tp->snd_cwnd, tp->snd_ssthresh>=0xFFFF?-1:tp->snd_ssthresh
 		   );

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] tcp: /proc/net/tcp rto,ato values not scaled properly
  2008-06-20 18:56 [PATCH] tcp: /proc/net/tcp rto,ato values not scaled properly Stephen Hemminger
@ 2008-06-20 19:05 ` David Miller
  2008-06-20 19:31   ` Stephen Hemminger
  2008-06-21  5:19 ` David Miller
  2008-06-23 18:16 ` [PATCH] tcp: /proc/net/tcp rto,ato values not scaled properly (v2) Stephen Hemminger
  2 siblings, 1 reply; 6+ messages in thread
From: David Miller @ 2008-06-20 19:05 UTC (permalink / raw)
  To: shemminger; +Cc: netdev

From: Stephen Hemminger <shemminger@vyatta.com>
Date: Fri, 20 Jun 2008 11:56:03 -0700

> I found another case where we are sending information to userspace
> in the wrong HZ scale.  This should have been fixed back in 2.5 :-(
> 
> This means an ABI change but as it stands there is no way for an application
> like ss to get the right value.
> 
> Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

Agree with your patch, but 'ss' should be getting this kind of info
from netlink not procfs, right?


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] tcp: /proc/net/tcp rto,ato values not scaled properly
  2008-06-20 19:05 ` David Miller
@ 2008-06-20 19:31   ` Stephen Hemminger
  0 siblings, 0 replies; 6+ messages in thread
From: Stephen Hemminger @ 2008-06-20 19:31 UTC (permalink / raw)
  To: David Miller; +Cc: netdev

On Fri, 20 Jun 2008 12:05:26 -0700 (PDT)
David Miller <davem@davemloft.net> wrote:

> From: Stephen Hemminger <shemminger@vyatta.com>
> Date: Fri, 20 Jun 2008 11:56:03 -0700
> 
> > I found another case where we are sending information to userspace
> > in the wrong HZ scale.  This should have been fixed back in 2.5 :-(
> > 
> > This means an ABI change but as it stands there is no way for an application
> > like ss to get the right value.
> > 
> > Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
> 
> Agree with your patch, but 'ss' should be getting this kind of info
> from netlink not procfs, right?
> 

Yes, ss tries netlink first and fallsback to /proc.

I am in process of making sure all usages of HZ in iproute utilities
are correct.  The old user code assumed that the hz value used by tc (psched)
was also correct for lots of other places. That is where I keep finding
these turds.

Soon all uses of get_hz() in iproute will be replaced with 
either get_psched_hz() for tc; get_user_hz for clock
values, or just use ms or us.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] tcp: /proc/net/tcp rto,ato values not scaled properly
  2008-06-20 18:56 [PATCH] tcp: /proc/net/tcp rto,ato values not scaled properly Stephen Hemminger
  2008-06-20 19:05 ` David Miller
@ 2008-06-21  5:19 ` David Miller
  2008-06-23 18:16 ` [PATCH] tcp: /proc/net/tcp rto,ato values not scaled properly (v2) Stephen Hemminger
  2 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2008-06-21  5:19 UTC (permalink / raw)
  To: shemminger; +Cc: netdev

From: Stephen Hemminger <shemminger@vyatta.com>
Date: Fri, 20 Jun 2008 11:56:03 -0700

> I found another case where we are sending information to userspace
> in the wrong HZ scale.  This should have been fixed back in 2.5 :-(
> 
> This means an ABI change but as it stands there is no way for an application
> like ss to get the right value.
> 
> Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

Please fix these warnings and resubmit:

net/ipv4/tcp_ipv4.c: In function 'get_tcp4_sock':
net/ipv4/tcp_ipv4.c:2311: warning: format '%u' expects type 'unsigned int', but argument 19 has type 'clock_t'
net/ipv4/tcp_ipv4.c:2311: warning: format '%u' expects type 'unsigned int', but argument 20 has type 'clock_t'
net/ipv6/tcp_ipv6.c: In function 'get_tcp6_sock':
net/ipv6/tcp_ipv6.c:2059: warning: format '%u' expects type 'unsigned int', but argument 25 has type 'clock_t'
net/ipv6/tcp_ipv6.c:2059: warning: format '%u' expects type 'unsigned int', but argument 26 has type 'clock_t'

Thanks!

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH] tcp: /proc/net/tcp rto,ato values not scaled properly (v2)
  2008-06-20 18:56 [PATCH] tcp: /proc/net/tcp rto,ato values not scaled properly Stephen Hemminger
  2008-06-20 19:05 ` David Miller
  2008-06-21  5:19 ` David Miller
@ 2008-06-23 18:16 ` Stephen Hemminger
  2008-06-28  3:00   ` David Miller
  2 siblings, 1 reply; 6+ messages in thread
From: Stephen Hemminger @ 2008-06-23 18:16 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: David Miller, netdev

I found another case where we are sending information to userspace
in the wrong HZ scale.  This should have been fixed back in 2.5 :-(

This means an ABI change but as it stands there is no way for an application
like ss to get the right value.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

---
Fixed printf format warnings in earlier patch

--- a/net/ipv4/tcp_ipv4.c	2008-06-23 10:54:19.000000000 -0700
+++ b/net/ipv4/tcp_ipv4.c	2008-06-23 11:03:43.000000000 -0700
@@ -2189,7 +2189,7 @@ static void get_tcp4_sock(struct sock *s
 	}
 
 	seq_printf(f, "%4d: %08X:%04X %08X:%04X %02X %08X:%08X %02X:%08lX "
-			"%08X %5d %8d %lu %d %p %u %u %u %u %d%n",
+			"%08X %5d %8d %lu %d %p %lu %lu %u %u %d%n",
 		i, src, srcp, dest, destp, sk->sk_state,
 		tp->write_seq - tp->snd_una,
 		sk->sk_state == TCP_LISTEN ? sk->sk_ack_backlog :
@@ -2201,8 +2201,8 @@ static void get_tcp4_sock(struct sock *s
 		icsk->icsk_probes_out,
 		sock_i_ino(sk),
 		atomic_read(&sk->sk_refcnt), sk,
-		icsk->icsk_rto,
-		icsk->icsk_ack.ato,
+		jiffies_to_clock_t(icsk->icsk_rto),
+		jiffies_to_clock_t(icsk->icsk_ack.ato),
 		(icsk->icsk_ack.quick << 1) | icsk->icsk_ack.pingpong,
 		tp->snd_cwnd,
 		tp->snd_ssthresh >= 0xFFFF ? -1 : tp->snd_ssthresh,
--- a/net/ipv6/tcp_ipv6.c	2008-06-23 10:54:19.000000000 -0700
+++ b/net/ipv6/tcp_ipv6.c	2008-06-23 11:04:25.000000000 -0700
@@ -1946,7 +1946,7 @@ static void get_tcp6_sock(struct seq_fil
 
 	seq_printf(seq,
 		   "%4d: %08X%08X%08X%08X:%04X %08X%08X%08X%08X:%04X "
-		   "%02X %08X:%08X %02X:%08lX %08X %5d %8d %lu %d %p %u %u %u %u %d\n",
+		   "%02X %08X:%08X %02X:%08lX %08X %5d %8d %lu %d %p %lu %lu %u %u %d\n",
 		   i,
 		   src->s6_addr32[0], src->s6_addr32[1],
 		   src->s6_addr32[2], src->s6_addr32[3], srcp,
@@ -1962,8 +1962,8 @@ static void get_tcp6_sock(struct seq_fil
 		   icsk->icsk_probes_out,
 		   sock_i_ino(sp),
 		   atomic_read(&sp->sk_refcnt), sp,
-		   icsk->icsk_rto,
-		   icsk->icsk_ack.ato,
+		   jiffies_to_clock_t(icsk->icsk_rto),
+		   jiffies_to_clock_t(icsk->icsk_ack.ato),
 		   (icsk->icsk_ack.quick << 1 ) | icsk->icsk_ack.pingpong,
 		   tp->snd_cwnd, tp->snd_ssthresh>=0xFFFF?-1:tp->snd_ssthresh
 		   );

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] tcp: /proc/net/tcp rto,ato values not scaled properly (v2)
  2008-06-23 18:16 ` [PATCH] tcp: /proc/net/tcp rto,ato values not scaled properly (v2) Stephen Hemminger
@ 2008-06-28  3:00   ` David Miller
  0 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2008-06-28  3:00 UTC (permalink / raw)
  To: shemminger; +Cc: netdev

From: Stephen Hemminger <shemminger@vyatta.com>
Date: Mon, 23 Jun 2008 11:16:00 -0700

> I found another case where we are sending information to userspace
> in the wrong HZ scale.  This should have been fixed back in 2.5 :-(
> 
> This means an ABI change but as it stands there is no way for an application
> like ss to get the right value.
> 
> Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

Applied, thanks.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2008-06-28  3:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-20 18:56 [PATCH] tcp: /proc/net/tcp rto,ato values not scaled properly Stephen Hemminger
2008-06-20 19:05 ` David Miller
2008-06-20 19:31   ` Stephen Hemminger
2008-06-21  5:19 ` David Miller
2008-06-23 18:16 ` [PATCH] tcp: /proc/net/tcp rto,ato values not scaled properly (v2) Stephen Hemminger
2008-06-28  3:00   ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).