Patchwork [net-next-2.6] ixgbe: fix ethtool stats

login
register
mail settings
Submitter Eric Dumazet
Date July 20, 2010, 5:28 p.m.
Message ID <1279646906.2498.103.camel@edumazet-laptop>
Download mbox | patch
Permalink /patch/59349/
State Awaiting Upstream
Delegated to: David Miller
Headers show

Comments

Eric Dumazet - July 20, 2010, 5:28 p.m.
Note : I am currently unable to test following patch, could you please
Intel guys test it and Ack (or Nack) it ?

Thanks !

[PATCH net-next-2.6] ixgbe: fix ethtool stats

In latest changes about 64bit stats on 32bit arches,
[commit 28172739f0a276eb8 (net: fix 64 bit counters on 32 bit arches)],
I missed ixgbe uses a bit of magic in its ixgbe_gstrings_stats
definition.

IXGBE_NETDEV_STAT() must now assume offsets relative to
rtnl_link_stats64, not relative do dev->stats.

As a bonus, we also get 64bit stats on ethtool -S

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
---
 drivers/net/ixgbe/ixgbe_ethtool.c |   42 ++++++++++++++--------------
 1 file changed, 21 insertions(+), 21 deletions(-)



--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jeff Kirsher - July 20, 2010, 10:06 p.m.
On Tue, Jul 20, 2010 at 10:28, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> Note : I am currently unable to test following patch, could you please
> Intel guys test it and Ack (or Nack) it ?
>
> Thanks !
>
> [PATCH net-next-2.6] ixgbe: fix ethtool stats
>
> In latest changes about 64bit stats on 32bit arches,
> [commit 28172739f0a276eb8 (net: fix 64 bit counters on 32 bit arches)],
> I missed ixgbe uses a bit of magic in its ixgbe_gstrings_stats
> definition.
>
> IXGBE_NETDEV_STAT() must now assume offsets relative to
> rtnl_link_stats64, not relative do dev->stats.
>
> As a bonus, we also get 64bit stats on ethtool -S
>
> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
> ---
>  drivers/net/ixgbe/ixgbe_ethtool.c |   42 ++++++++++++++--------------
>  1 file changed, 21 insertions(+), 21 deletions(-)
>

Thanks Eric, I have added it to my queue.
Eric Dumazet - July 21, 2010, 2:38 a.m.
Le mardi 20 juillet 2010 à 15:06 -0700, Jeff Kirsher a écrit :
> On Tue, Jul 20, 2010 at 10:28, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> > Note : I am currently unable to test following patch, could you please
> > Intel guys test it and Ack (or Nack) it ?
> >
> > Thanks !
> >
> > [PATCH net-next-2.6] ixgbe: fix ethtool stats
> >
> > In latest changes about 64bit stats on 32bit arches,
> > [commit 28172739f0a276eb8 (net: fix 64 bit counters on 32 bit arches)],
> > I missed ixgbe uses a bit of magic in its ixgbe_gstrings_stats
> > definition.
> >
> > IXGBE_NETDEV_STAT() must now assume offsets relative to
> > rtnl_link_stats64, not relative do dev->stats.
> >
> > As a bonus, we also get 64bit stats on ethtool -S
> >
> > Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
> > ---
> >  drivers/net/ixgbe/ixgbe_ethtool.c |   42 ++++++++++++++--------------
> >  1 file changed, 21 insertions(+), 21 deletions(-)
> >
> 
> Thanks Eric, I have added it to my queue.
> 

Thanks !

By the way, my ixgbe conf doesnt like net-next-2.6 at all.
(No link is established in my fiber loop configuration)

current linux-2.6 git runs correctly, link at 10Gb, so there is a
regression somewhere.

As this machine is quite slow (I dont have anymore my Nehalem dev
machine, had to use an old setup), a bisection would take one month...



--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jeff Kirsher - July 21, 2010, 8:17 p.m.
On Tue, Jul 20, 2010 at 19:38, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> Le mardi 20 juillet 2010 à 15:06 -0700, Jeff Kirsher a écrit :
>> On Tue, Jul 20, 2010 at 10:28, Eric Dumazet <eric.dumazet@gmail.com> wrote:
>> > Note : I am currently unable to test following patch, could you please
>> > Intel guys test it and Ack (or Nack) it ?
>> >
>> > Thanks !
>> >
>> > [PATCH net-next-2.6] ixgbe: fix ethtool stats
>> >
>> > In latest changes about 64bit stats on 32bit arches,
>> > [commit 28172739f0a276eb8 (net: fix 64 bit counters on 32 bit arches)],
>> > I missed ixgbe uses a bit of magic in its ixgbe_gstrings_stats
>> > definition.
>> >
>> > IXGBE_NETDEV_STAT() must now assume offsets relative to
>> > rtnl_link_stats64, not relative do dev->stats.
>> >
>> > As a bonus, we also get 64bit stats on ethtool -S
>> >
>> > Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
>> > ---
>> >  drivers/net/ixgbe/ixgbe_ethtool.c |   42 ++++++++++++++--------------
>> >  1 file changed, 21 insertions(+), 21 deletions(-)
>> >
>>
>> Thanks Eric, I have added it to my queue.
>>
>
> Thanks !
>
> By the way, my ixgbe conf doesnt like net-next-2.6 at all.
> (No link is established in my fiber loop configuration)
>
> current linux-2.6 git runs correctly, link at 10Gb, so there is a
> regression somewhere.
>
> As this machine is quite slow (I dont have anymore my Nehalem dev
> machine, had to use an old setup), a bisection would take one month...
>
>

Eric - can you send your setup and .config so that we can take a look
at why your not getting a link?
Eric Dumazet - July 21, 2010, 8:47 p.m.
Le mercredi 21 juillet 2010 à 13:17 -0700, Jeff Kirsher a écrit :
> On Tue, Jul 20, 2010 at 19:38, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> > Le mardi 20 juillet 2010 à 15:06 -0700, Jeff Kirsher a écrit :
> >> On Tue, Jul 20, 2010 at 10:28, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> >> > Note : I am currently unable to test following patch, could you please
> >> > Intel guys test it and Ack (or Nack) it ?
> >> >
> >> > Thanks !
> >> >
> >> > [PATCH net-next-2.6] ixgbe: fix ethtool stats
> >> >
> >> > In latest changes about 64bit stats on 32bit arches,
> >> > [commit 28172739f0a276eb8 (net: fix 64 bit counters on 32 bit arches)],
> >> > I missed ixgbe uses a bit of magic in its ixgbe_gstrings_stats
> >> > definition.
> >> >
> >> > IXGBE_NETDEV_STAT() must now assume offsets relative to
> >> > rtnl_link_stats64, not relative do dev->stats.
> >> >
> >> > As a bonus, we also get 64bit stats on ethtool -S
> >> >
> >> > Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
> >> > ---
> >> >  drivers/net/ixgbe/ixgbe_ethtool.c |   42 ++++++++++++++--------------
> >> >  1 file changed, 21 insertions(+), 21 deletions(-)
> >> >
> >>
> >> Thanks Eric, I have added it to my queue.
> >>
> >
> > Thanks !
> >
> > By the way, my ixgbe conf doesnt like net-next-2.6 at all.
> > (No link is established in my fiber loop configuration)
> >
> > current linux-2.6 git runs correctly, link at 10Gb, so there is a
> > regression somewhere.
> >
> > As this machine is quite slow (I dont have anymore my Nehalem dev
> > machine, had to use an old setup), a bisection would take one month...
> >
> >
> 
> Eric - can you send your setup and .config so that we can take a look
> at why your not getting a link?
> 

It seems trying to use two ports of same card in back to back is
problematic.

Finally, I tested this patch, with two machines and two dual port cards
[82599EB 10-Gigabit Network Connection (rev 01)]
(courtesy from Intel), and everything is fine.

Tested-by: Eric Dumazet <eric.dumazet@gmail.com>

# ethtool -S eth1
NIC statistics:
     rx_packets: 2750925
     tx_packets: 2747612
     rx_bytes: 1668189088
     tx_bytes: 1667871060
     rx_pkts_nic: 2750926
     tx_pkts_nic: 2747612
     rx_bytes_nic: 1679192890
     tx_bytes_nic: 1678861724

I'll submit another patch because this driver updates
netdev->stats.rx_bytes/rx_packets in a racy way (several cpus can do
these updates concurrently)

Implementing a get_stats() method to fold rx_ring counters will solve
this and brings 64bit counters as well for RX side.
(TX counters are already 64bit enabled)



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

Patch

diff --git a/drivers/net/ixgbe/ixgbe_ethtool.c b/drivers/net/ixgbe/ixgbe_ethtool.c
index da54b38..dcebc82 100644
--- a/drivers/net/ixgbe/ixgbe_ethtool.c
+++ b/drivers/net/ixgbe/ixgbe_ethtool.c
@@ -54,14 +54,14 @@  struct ixgbe_stats {
 				sizeof(((struct ixgbe_adapter *)0)->m), \
 				offsetof(struct ixgbe_adapter, m)
 #define IXGBE_NETDEV_STAT(m)	NETDEV_STATS, \
-				sizeof(((struct net_device *)0)->m), \
-				offsetof(struct net_device, m) - offsetof(struct net_device, stats)
+				sizeof(((struct rtnl_link_stats64 *)0)->m), \
+				offsetof(struct rtnl_link_stats64, m)
 
 static struct ixgbe_stats ixgbe_gstrings_stats[] = {
-	{"rx_packets", IXGBE_NETDEV_STAT(stats.rx_packets)},
-	{"tx_packets", IXGBE_NETDEV_STAT(stats.tx_packets)},
-	{"rx_bytes", IXGBE_NETDEV_STAT(stats.rx_bytes)},
-	{"tx_bytes", IXGBE_NETDEV_STAT(stats.tx_bytes)},
+	{"rx_packets", IXGBE_NETDEV_STAT(rx_packets)},
+	{"tx_packets", IXGBE_NETDEV_STAT(tx_packets)},
+	{"rx_bytes", IXGBE_NETDEV_STAT(rx_bytes)},
+	{"tx_bytes", IXGBE_NETDEV_STAT(tx_bytes)},
 	{"rx_pkts_nic", IXGBE_STAT(stats.gprc)},
 	{"tx_pkts_nic", IXGBE_STAT(stats.gptc)},
 	{"rx_bytes_nic", IXGBE_STAT(stats.gorc)},
@@ -69,27 +69,27 @@  static struct ixgbe_stats ixgbe_gstrings_stats[] = {
 	{"lsc_int", IXGBE_STAT(lsc_int)},
 	{"tx_busy", IXGBE_STAT(tx_busy)},
 	{"non_eop_descs", IXGBE_STAT(non_eop_descs)},
-	{"rx_errors", IXGBE_NETDEV_STAT(stats.rx_errors)},
-	{"tx_errors", IXGBE_NETDEV_STAT(stats.tx_errors)},
-	{"rx_dropped", IXGBE_NETDEV_STAT(stats.rx_dropped)},
-	{"tx_dropped", IXGBE_NETDEV_STAT(stats.tx_dropped)},
-	{"multicast", IXGBE_NETDEV_STAT(stats.multicast)},
+	{"rx_errors", IXGBE_NETDEV_STAT(rx_errors)},
+	{"tx_errors", IXGBE_NETDEV_STAT(tx_errors)},
+	{"rx_dropped", IXGBE_NETDEV_STAT(rx_dropped)},
+	{"tx_dropped", IXGBE_NETDEV_STAT(tx_dropped)},
+	{"multicast", IXGBE_NETDEV_STAT(multicast)},
 	{"broadcast", IXGBE_STAT(stats.bprc)},
 	{"rx_no_buffer_count", IXGBE_STAT(stats.rnbc[0]) },
-	{"collisions", IXGBE_NETDEV_STAT(stats.collisions)},
-	{"rx_over_errors", IXGBE_NETDEV_STAT(stats.rx_over_errors)},
-	{"rx_crc_errors", IXGBE_NETDEV_STAT(stats.rx_crc_errors)},
-	{"rx_frame_errors", IXGBE_NETDEV_STAT(stats.rx_frame_errors)},
+	{"collisions", IXGBE_NETDEV_STAT(collisions)},
+	{"rx_over_errors", IXGBE_NETDEV_STAT(rx_over_errors)},
+	{"rx_crc_errors", IXGBE_NETDEV_STAT(rx_crc_errors)},
+	{"rx_frame_errors", IXGBE_NETDEV_STAT(rx_frame_errors)},
 	{"hw_rsc_aggregated", IXGBE_STAT(rsc_total_count)},
 	{"hw_rsc_flushed", IXGBE_STAT(rsc_total_flush)},
 	{"fdir_match", IXGBE_STAT(stats.fdirmatch)},
 	{"fdir_miss", IXGBE_STAT(stats.fdirmiss)},
-	{"rx_fifo_errors", IXGBE_NETDEV_STAT(stats.rx_fifo_errors)},
-	{"rx_missed_errors", IXGBE_NETDEV_STAT(stats.rx_missed_errors)},
-	{"tx_aborted_errors", IXGBE_NETDEV_STAT(stats.tx_aborted_errors)},
-	{"tx_carrier_errors", IXGBE_NETDEV_STAT(stats.tx_carrier_errors)},
-	{"tx_fifo_errors", IXGBE_NETDEV_STAT(stats.tx_fifo_errors)},
-	{"tx_heartbeat_errors", IXGBE_NETDEV_STAT(stats.tx_heartbeat_errors)},
+	{"rx_fifo_errors", IXGBE_NETDEV_STAT(rx_fifo_errors)},
+	{"rx_missed_errors", IXGBE_NETDEV_STAT(rx_missed_errors)},
+	{"tx_aborted_errors", IXGBE_NETDEV_STAT(tx_aborted_errors)},
+	{"tx_carrier_errors", IXGBE_NETDEV_STAT(tx_carrier_errors)},
+	{"tx_fifo_errors", IXGBE_NETDEV_STAT(tx_fifo_errors)},
+	{"tx_heartbeat_errors", IXGBE_NETDEV_STAT(tx_heartbeat_errors)},
 	{"tx_timeout_count", IXGBE_STAT(tx_timeout_count)},
 	{"tx_restart_queue", IXGBE_STAT(restart_queue)},
 	{"rx_long_length_errors", IXGBE_STAT(stats.roc)},