aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAjit Khaparde <ajitk@serverengines.com>2009-10-12 21:46:56 -0400
committerDavid S. Miller <davem@davemloft.net>2009-10-13 14:48:29 -0400
commitd189a7e85835dbfb22b1d04eb7f3ab575ccacb96 (patch)
tree9013f68edbde3dd07f090235a3c11248e8433a41
parent231835e4163cf14c90e295f1729004f571ee1cc7 (diff)
ixgb: Fix erroneous display of stats by ethtool -S
Commit 5675f221 overlooked the way offsets for netdev stats were considered. Because of this some of the stats shown by ethtool -S were wrong. This patch fixes it. Signed-off-by: Ajit Khaparde <ajitk@serverengines.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ixgb/ixgb_ethtool.c27
1 files changed, 22 insertions, 5 deletions
diff --git a/drivers/net/ixgb/ixgb_ethtool.c b/drivers/net/ixgb/ixgb_ethtool.c
index deeb25da0702..a4ed96caae69 100644
--- a/drivers/net/ixgb/ixgb_ethtool.c
+++ b/drivers/net/ixgb/ixgb_ethtool.c
@@ -34,16 +34,22 @@
34 34
35#define IXGB_ALL_RAR_ENTRIES 16 35#define IXGB_ALL_RAR_ENTRIES 16
36 36
37enum {NETDEV_STATS, IXGB_STATS};
38
37struct ixgb_stats { 39struct ixgb_stats {
38 char stat_string[ETH_GSTRING_LEN]; 40 char stat_string[ETH_GSTRING_LEN];
41 int type;
39 int sizeof_stat; 42 int sizeof_stat;
40 int stat_offset; 43 int stat_offset;
41}; 44};
42 45
43#define IXGB_STAT(m) FIELD_SIZEOF(struct ixgb_adapter, m), \ 46#define IXGB_STAT(m) IXGB_STATS, \
44 offsetof(struct ixgb_adapter, m) 47 FIELD_SIZEOF(struct ixgb_adapter, m), \
45#define IXGB_NETDEV_STAT(m) FIELD_SIZEOF(struct net_device, m), \ 48 offsetof(struct ixgb_adapter, m)
46 offsetof(struct net_device, m) 49#define IXGB_NETDEV_STAT(m) NETDEV_STATS, \
50 FIELD_SIZEOF(struct net_device, m), \
51 offsetof(struct net_device, m)
52
47static struct ixgb_stats ixgb_gstrings_stats[] = { 53static struct ixgb_stats ixgb_gstrings_stats[] = {
48 {"rx_packets", IXGB_NETDEV_STAT(stats.rx_packets)}, 54 {"rx_packets", IXGB_NETDEV_STAT(stats.rx_packets)},
49 {"tx_packets", IXGB_NETDEV_STAT(stats.tx_packets)}, 55 {"tx_packets", IXGB_NETDEV_STAT(stats.tx_packets)},
@@ -664,10 +670,21 @@ ixgb_get_ethtool_stats(struct net_device *netdev,
664{ 670{
665 struct ixgb_adapter *adapter = netdev_priv(netdev); 671 struct ixgb_adapter *adapter = netdev_priv(netdev);
666 int i; 672 int i;
673 char *p = NULL;
667 674
668 ixgb_update_stats(adapter); 675 ixgb_update_stats(adapter);
669 for (i = 0; i < IXGB_STATS_LEN; i++) { 676 for (i = 0; i < IXGB_STATS_LEN; i++) {
670 char *p = (char *)adapter+ixgb_gstrings_stats[i].stat_offset; 677 switch (ixgb_gstrings_stats[i].type) {
678 case NETDEV_STATS:
679 p = (char *) netdev +
680 ixgb_gstrings_stats[i].stat_offset;
681 break;
682 case IXGB_STATS:
683 p = (char *) adapter +
684 ixgb_gstrings_stats[i].stat_offset;
685 break;
686 }
687
671 data[i] = (ixgb_gstrings_stats[i].sizeof_stat == 688 data[i] = (ixgb_gstrings_stats[i].sizeof_stat ==
672 sizeof(u64)) ? *(u64 *)p : *(u32 *)p; 689 sizeof(u64)) ? *(u64 *)p : *(u32 *)p;
673 } 690 }