aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAjit Khaparde <ajitk@serverengines.com>2009-10-12 21:47:33 -0400
committerDavid S. Miller <davem@davemloft.net>2009-10-13 14:48:26 -0400
commit29c3a050f83c524218b1baa4e43aedd21501b338 (patch)
tree8ed7d65427171884413d40f84f5d377657adee66
parent70f9cf8951e5253cfef821f8dcb92f6fc3af50c6 (diff)
ixgbe: Fix erroneous display of stats by ethtool -S
Commit 59aa3cc4 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/ixgbe/ixgbe_ethtool.c27
1 files changed, 22 insertions, 5 deletions
diff --git a/drivers/net/ixgbe/ixgbe_ethtool.c b/drivers/net/ixgbe/ixgbe_ethtool.c
index 987b41c8eb48..08eccf418c67 100644
--- a/drivers/net/ixgbe/ixgbe_ethtool.c
+++ b/drivers/net/ixgbe/ixgbe_ethtool.c
@@ -40,16 +40,22 @@
40 40
41#define IXGBE_ALL_RAR_ENTRIES 16 41#define IXGBE_ALL_RAR_ENTRIES 16
42 42
43enum {NETDEV_STATS, IXGBE_STATS};
44
43struct ixgbe_stats { 45struct ixgbe_stats {
44 char stat_string[ETH_GSTRING_LEN]; 46 char stat_string[ETH_GSTRING_LEN];
47 int type;
45 int sizeof_stat; 48 int sizeof_stat;
46 int stat_offset; 49 int stat_offset;
47}; 50};
48 51
49#define IXGBE_STAT(m) sizeof(((struct ixgbe_adapter *)0)->m), \ 52#define IXGBE_STAT(m) IXGBE_STATS, \
50 offsetof(struct ixgbe_adapter, m) 53 sizeof(((struct ixgbe_adapter *)0)->m), \
51#define IXGBE_NETDEV_STAT(m) sizeof(((struct net_device *)0)->m), \ 54 offsetof(struct ixgbe_adapter, m)
52 offsetof(struct net_device, m) 55#define IXGBE_NETDEV_STAT(m) NETDEV_STATS, \
56 sizeof(((struct net_device *)0)->m), \
57 offsetof(struct net_device, m)
58
53static struct ixgbe_stats ixgbe_gstrings_stats[] = { 59static struct ixgbe_stats ixgbe_gstrings_stats[] = {
54 {"rx_packets", IXGBE_NETDEV_STAT(stats.rx_packets)}, 60 {"rx_packets", IXGBE_NETDEV_STAT(stats.rx_packets)},
55 {"tx_packets", IXGBE_NETDEV_STAT(stats.tx_packets)}, 61 {"tx_packets", IXGBE_NETDEV_STAT(stats.tx_packets)},
@@ -931,10 +937,21 @@ static void ixgbe_get_ethtool_stats(struct net_device *netdev,
931 int stat_count = sizeof(struct ixgbe_queue_stats) / sizeof(u64); 937 int stat_count = sizeof(struct ixgbe_queue_stats) / sizeof(u64);
932 int j, k; 938 int j, k;
933 int i; 939 int i;
940 char *p = NULL;
934 941
935 ixgbe_update_stats(adapter); 942 ixgbe_update_stats(adapter);
936 for (i = 0; i < IXGBE_GLOBAL_STATS_LEN; i++) { 943 for (i = 0; i < IXGBE_GLOBAL_STATS_LEN; i++) {
937 char *p = (char *)adapter + ixgbe_gstrings_stats[i].stat_offset; 944 switch (ixgbe_gstrings_stats[i].type) {
945 case NETDEV_STATS:
946 p = (char *) netdev +
947 ixgbe_gstrings_stats[i].stat_offset;
948 break;
949 case IXGBE_STATS:
950 p = (char *) adapter +
951 ixgbe_gstrings_stats[i].stat_offset;
952 break;
953 }
954
938 data[i] = (ixgbe_gstrings_stats[i].sizeof_stat == 955 data[i] = (ixgbe_gstrings_stats[i].sizeof_stat ==
939 sizeof(u64)) ? *(u64 *)p : *(u32 *)p; 956 sizeof(u64)) ? *(u64 *)p : *(u32 *)p;
940 } 957 }