aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ixgbevf/ethtool.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/ixgbevf/ethtool.c')
-rw-r--r--drivers/net/ixgbevf/ethtool.c43
1 files changed, 29 insertions, 14 deletions
diff --git a/drivers/net/ixgbevf/ethtool.c b/drivers/net/ixgbevf/ethtool.c
index 399be0c34c36..4680b069b84f 100644
--- a/drivers/net/ixgbevf/ethtool.c
+++ b/drivers/net/ixgbevf/ethtool.c
@@ -29,6 +29,7 @@
29 29
30#include <linux/types.h> 30#include <linux/types.h>
31#include <linux/module.h> 31#include <linux/module.h>
32#include <linux/slab.h>
32#include <linux/pci.h> 33#include <linux/pci.h>
33#include <linux/netdevice.h> 34#include <linux/netdevice.h>
34#include <linux/ethtool.h> 35#include <linux/ethtool.h>
@@ -46,22 +47,32 @@ struct ixgbe_stats {
46 int sizeof_stat; 47 int sizeof_stat;
47 int stat_offset; 48 int stat_offset;
48 int base_stat_offset; 49 int base_stat_offset;
50 int saved_reset_offset;
49}; 51};
50 52
51#define IXGBEVF_STAT(m, b) sizeof(((struct ixgbevf_adapter *)0)->m), \ 53#define IXGBEVF_STAT(m, b, r) sizeof(((struct ixgbevf_adapter *)0)->m), \
52 offsetof(struct ixgbevf_adapter, m), \ 54 offsetof(struct ixgbevf_adapter, m), \
53 offsetof(struct ixgbevf_adapter, b) 55 offsetof(struct ixgbevf_adapter, b), \
56 offsetof(struct ixgbevf_adapter, r)
54static struct ixgbe_stats ixgbe_gstrings_stats[] = { 57static struct ixgbe_stats ixgbe_gstrings_stats[] = {
55 {"rx_packets", IXGBEVF_STAT(stats.vfgprc, stats.base_vfgprc)}, 58 {"rx_packets", IXGBEVF_STAT(stats.vfgprc, stats.base_vfgprc,
56 {"tx_packets", IXGBEVF_STAT(stats.vfgptc, stats.base_vfgptc)}, 59 stats.saved_reset_vfgprc)},
57 {"rx_bytes", IXGBEVF_STAT(stats.vfgorc, stats.base_vfgorc)}, 60 {"tx_packets", IXGBEVF_STAT(stats.vfgptc, stats.base_vfgptc,
58 {"tx_bytes", IXGBEVF_STAT(stats.vfgotc, stats.base_vfgotc)}, 61 stats.saved_reset_vfgptc)},
59 {"tx_busy", IXGBEVF_STAT(tx_busy, zero_base)}, 62 {"rx_bytes", IXGBEVF_STAT(stats.vfgorc, stats.base_vfgorc,
60 {"multicast", IXGBEVF_STAT(stats.vfmprc, stats.base_vfmprc)}, 63 stats.saved_reset_vfgorc)},
61 {"rx_csum_offload_good", IXGBEVF_STAT(hw_csum_rx_good, zero_base)}, 64 {"tx_bytes", IXGBEVF_STAT(stats.vfgotc, stats.base_vfgotc,
62 {"rx_csum_offload_errors", IXGBEVF_STAT(hw_csum_rx_error, zero_base)}, 65 stats.saved_reset_vfgotc)},
63 {"tx_csum_offload_ctxt", IXGBEVF_STAT(hw_csum_tx_good, zero_base)}, 66 {"tx_busy", IXGBEVF_STAT(tx_busy, zero_base, zero_base)},
64 {"rx_header_split", IXGBEVF_STAT(rx_hdr_split, zero_base)}, 67 {"multicast", IXGBEVF_STAT(stats.vfmprc, stats.base_vfmprc,
68 stats.saved_reset_vfmprc)},
69 {"rx_csum_offload_good", IXGBEVF_STAT(hw_csum_rx_good, zero_base,
70 zero_base)},
71 {"rx_csum_offload_errors", IXGBEVF_STAT(hw_csum_rx_error, zero_base,
72 zero_base)},
73 {"tx_csum_offload_ctxt", IXGBEVF_STAT(hw_csum_tx_good, zero_base,
74 zero_base)},
75 {"rx_header_split", IXGBEVF_STAT(rx_hdr_split, zero_base, zero_base)},
65}; 76};
66 77
67#define IXGBE_QUEUE_STATS_LEN 0 78#define IXGBE_QUEUE_STATS_LEN 0
@@ -455,10 +466,14 @@ static void ixgbevf_get_ethtool_stats(struct net_device *netdev,
455 ixgbe_gstrings_stats[i].stat_offset; 466 ixgbe_gstrings_stats[i].stat_offset;
456 char *b = (char *)adapter + 467 char *b = (char *)adapter +
457 ixgbe_gstrings_stats[i].base_stat_offset; 468 ixgbe_gstrings_stats[i].base_stat_offset;
469 char *r = (char *)adapter +
470 ixgbe_gstrings_stats[i].saved_reset_offset;
458 data[i] = ((ixgbe_gstrings_stats[i].sizeof_stat == 471 data[i] = ((ixgbe_gstrings_stats[i].sizeof_stat ==
459 sizeof(u64)) ? *(u64 *)p : *(u32 *)p) - 472 sizeof(u64)) ? *(u64 *)p : *(u32 *)p) -
460 ((ixgbe_gstrings_stats[i].sizeof_stat == 473 ((ixgbe_gstrings_stats[i].sizeof_stat ==
461 sizeof(u64)) ? *(u64 *)b : *(u32 *)b); 474 sizeof(u64)) ? *(u64 *)b : *(u32 *)b) +
475 ((ixgbe_gstrings_stats[i].sizeof_stat ==
476 sizeof(u64)) ? *(u64 *)r : *(u32 *)r);
462 } 477 }
463} 478}
464 479