aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ixgb
diff options
context:
space:
mode:
authorAjit Khaparde <ajitkhaparde@gmail.com>2009-10-06 22:46:59 -0400
committerDavid S. Miller <davem@davemloft.net>2009-10-08 01:00:29 -0400
commit0cdc03698f2586923ad3b9fca06643ff5675f221 (patch)
treea403607562ecd5588b7735093ddbdb32d61f032a /drivers/net/ixgb
parentbcc90f555b4eb82604436f7ab6a7853c4b5997a3 (diff)
ixgb: Use the instance of net_device_stats from net_device.
Since net_device has an instance of net_device_stats, we can remove the instance of this from the private adapter structure. Signed-off-by: Ajit Khaparde <ajitk@serverengines.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ixgb')
-rw-r--r--drivers/net/ixgb/ixgb.h1
-rw-r--r--drivers/net/ixgb/ixgb_ethtool.c46
-rw-r--r--drivers/net/ixgb/ixgb_main.c44
3 files changed, 45 insertions, 46 deletions
diff --git a/drivers/net/ixgb/ixgb.h b/drivers/net/ixgb/ixgb.h
index d85717e3022a..e95d9b6f1f2d 100644
--- a/drivers/net/ixgb/ixgb.h
+++ b/drivers/net/ixgb/ixgb.h
@@ -183,7 +183,6 @@ struct ixgb_adapter {
183 struct napi_struct napi; 183 struct napi_struct napi;
184 struct net_device *netdev; 184 struct net_device *netdev;
185 struct pci_dev *pdev; 185 struct pci_dev *pdev;
186 struct net_device_stats net_stats;
187 186
188 /* structs defined in ixgb_hw.h */ 187 /* structs defined in ixgb_hw.h */
189 struct ixgb_hw hw; 188 struct ixgb_hw hw;
diff --git a/drivers/net/ixgb/ixgb_ethtool.c b/drivers/net/ixgb/ixgb_ethtool.c
index 288ee1d0f431..deeb25da0702 100644
--- a/drivers/net/ixgb/ixgb_ethtool.c
+++ b/drivers/net/ixgb/ixgb_ethtool.c
@@ -42,30 +42,32 @@ struct ixgb_stats {
42 42
43#define IXGB_STAT(m) FIELD_SIZEOF(struct ixgb_adapter, m), \ 43#define IXGB_STAT(m) FIELD_SIZEOF(struct ixgb_adapter, m), \
44 offsetof(struct ixgb_adapter, m) 44 offsetof(struct ixgb_adapter, m)
45#define IXGB_NETDEV_STAT(m) FIELD_SIZEOF(struct net_device, m), \
46 offsetof(struct net_device, m)
45static struct ixgb_stats ixgb_gstrings_stats[] = { 47static struct ixgb_stats ixgb_gstrings_stats[] = {
46 {"rx_packets", IXGB_STAT(net_stats.rx_packets)}, 48 {"rx_packets", IXGB_NETDEV_STAT(stats.rx_packets)},
47 {"tx_packets", IXGB_STAT(net_stats.tx_packets)}, 49 {"tx_packets", IXGB_NETDEV_STAT(stats.tx_packets)},
48 {"rx_bytes", IXGB_STAT(net_stats.rx_bytes)}, 50 {"rx_bytes", IXGB_NETDEV_STAT(stats.rx_bytes)},
49 {"tx_bytes", IXGB_STAT(net_stats.tx_bytes)}, 51 {"tx_bytes", IXGB_NETDEV_STAT(stats.tx_bytes)},
50 {"rx_errors", IXGB_STAT(net_stats.rx_errors)}, 52 {"rx_errors", IXGB_NETDEV_STAT(stats.rx_errors)},
51 {"tx_errors", IXGB_STAT(net_stats.tx_errors)}, 53 {"tx_errors", IXGB_NETDEV_STAT(stats.tx_errors)},
52 {"rx_dropped", IXGB_STAT(net_stats.rx_dropped)}, 54 {"rx_dropped", IXGB_NETDEV_STAT(stats.rx_dropped)},
53 {"tx_dropped", IXGB_STAT(net_stats.tx_dropped)}, 55 {"tx_dropped", IXGB_NETDEV_STAT(stats.tx_dropped)},
54 {"multicast", IXGB_STAT(net_stats.multicast)}, 56 {"multicast", IXGB_NETDEV_STAT(stats.multicast)},
55 {"collisions", IXGB_STAT(net_stats.collisions)}, 57 {"collisions", IXGB_NETDEV_STAT(stats.collisions)},
56 58
57/* { "rx_length_errors", IXGB_STAT(net_stats.rx_length_errors) }, */ 59/* { "rx_length_errors", IXGB_NETDEV_STAT(stats.rx_length_errors) }, */
58 {"rx_over_errors", IXGB_STAT(net_stats.rx_over_errors)}, 60 {"rx_over_errors", IXGB_NETDEV_STAT(stats.rx_over_errors)},
59 {"rx_crc_errors", IXGB_STAT(net_stats.rx_crc_errors)}, 61 {"rx_crc_errors", IXGB_NETDEV_STAT(stats.rx_crc_errors)},
60 {"rx_frame_errors", IXGB_STAT(net_stats.rx_frame_errors)}, 62 {"rx_frame_errors", IXGB_NETDEV_STAT(stats.rx_frame_errors)},
61 {"rx_no_buffer_count", IXGB_STAT(stats.rnbc)}, 63 {"rx_no_buffer_count", IXGB_STAT(stats.rnbc)},
62 {"rx_fifo_errors", IXGB_STAT(net_stats.rx_fifo_errors)}, 64 {"rx_fifo_errors", IXGB_NETDEV_STAT(stats.rx_fifo_errors)},
63 {"rx_missed_errors", IXGB_STAT(net_stats.rx_missed_errors)}, 65 {"rx_missed_errors", IXGB_NETDEV_STAT(stats.rx_missed_errors)},
64 {"tx_aborted_errors", IXGB_STAT(net_stats.tx_aborted_errors)}, 66 {"tx_aborted_errors", IXGB_NETDEV_STAT(stats.tx_aborted_errors)},
65 {"tx_carrier_errors", IXGB_STAT(net_stats.tx_carrier_errors)}, 67 {"tx_carrier_errors", IXGB_NETDEV_STAT(stats.tx_carrier_errors)},
66 {"tx_fifo_errors", IXGB_STAT(net_stats.tx_fifo_errors)}, 68 {"tx_fifo_errors", IXGB_NETDEV_STAT(stats.tx_fifo_errors)},
67 {"tx_heartbeat_errors", IXGB_STAT(net_stats.tx_heartbeat_errors)}, 69 {"tx_heartbeat_errors", IXGB_NETDEV_STAT(stats.tx_heartbeat_errors)},
68 {"tx_window_errors", IXGB_STAT(net_stats.tx_window_errors)}, 70 {"tx_window_errors", IXGB_NETDEV_STAT(stats.tx_window_errors)},
69 {"tx_deferred_ok", IXGB_STAT(stats.dc)}, 71 {"tx_deferred_ok", IXGB_STAT(stats.dc)},
70 {"tx_timeout_count", IXGB_STAT(tx_timeout_count) }, 72 {"tx_timeout_count", IXGB_STAT(tx_timeout_count) },
71 {"tx_restart_queue", IXGB_STAT(restart_queue) }, 73 {"tx_restart_queue", IXGB_STAT(restart_queue) },
diff --git a/drivers/net/ixgb/ixgb_main.c b/drivers/net/ixgb/ixgb_main.c
index 8aa44dca57eb..f9f633c134bd 100644
--- a/drivers/net/ixgb/ixgb_main.c
+++ b/drivers/net/ixgb/ixgb_main.c
@@ -1537,9 +1537,7 @@ ixgb_tx_timeout_task(struct work_struct *work)
1537static struct net_device_stats * 1537static struct net_device_stats *
1538ixgb_get_stats(struct net_device *netdev) 1538ixgb_get_stats(struct net_device *netdev)
1539{ 1539{
1540 struct ixgb_adapter *adapter = netdev_priv(netdev); 1540 return &netdev->stats;
1541
1542 return &adapter->net_stats;
1543} 1541}
1544 1542
1545/** 1543/**
@@ -1676,16 +1674,16 @@ ixgb_update_stats(struct ixgb_adapter *adapter)
1676 1674
1677 /* Fill out the OS statistics structure */ 1675 /* Fill out the OS statistics structure */
1678 1676
1679 adapter->net_stats.rx_packets = adapter->stats.gprcl; 1677 netdev->stats.rx_packets = adapter->stats.gprcl;
1680 adapter->net_stats.tx_packets = adapter->stats.gptcl; 1678 netdev->stats.tx_packets = adapter->stats.gptcl;
1681 adapter->net_stats.rx_bytes = adapter->stats.gorcl; 1679 netdev->stats.rx_bytes = adapter->stats.gorcl;
1682 adapter->net_stats.tx_bytes = adapter->stats.gotcl; 1680 netdev->stats.tx_bytes = adapter->stats.gotcl;
1683 adapter->net_stats.multicast = adapter->stats.mprcl; 1681 netdev->stats.multicast = adapter->stats.mprcl;
1684 adapter->net_stats.collisions = 0; 1682 netdev->stats.collisions = 0;
1685 1683
1686 /* ignore RLEC as it reports errors for padded (<64bytes) frames 1684 /* ignore RLEC as it reports errors for padded (<64bytes) frames
1687 * with a length in the type/len field */ 1685 * with a length in the type/len field */
1688 adapter->net_stats.rx_errors = 1686 netdev->stats.rx_errors =
1689 /* adapter->stats.rnbc + */ adapter->stats.crcerrs + 1687 /* adapter->stats.rnbc + */ adapter->stats.crcerrs +
1690 adapter->stats.ruc + 1688 adapter->stats.ruc +
1691 adapter->stats.roc /*+ adapter->stats.rlec */ + 1689 adapter->stats.roc /*+ adapter->stats.rlec */ +
@@ -1693,21 +1691,21 @@ ixgb_update_stats(struct ixgb_adapter *adapter)
1693 adapter->stats.ecbc + adapter->stats.mpc; 1691 adapter->stats.ecbc + adapter->stats.mpc;
1694 1692
1695 /* see above 1693 /* see above
1696 * adapter->net_stats.rx_length_errors = adapter->stats.rlec; 1694 * netdev->stats.rx_length_errors = adapter->stats.rlec;
1697 */ 1695 */
1698 1696
1699 adapter->net_stats.rx_crc_errors = adapter->stats.crcerrs; 1697 netdev->stats.rx_crc_errors = adapter->stats.crcerrs;
1700 adapter->net_stats.rx_fifo_errors = adapter->stats.mpc; 1698 netdev->stats.rx_fifo_errors = adapter->stats.mpc;
1701 adapter->net_stats.rx_missed_errors = adapter->stats.mpc; 1699 netdev->stats.rx_missed_errors = adapter->stats.mpc;
1702 adapter->net_stats.rx_over_errors = adapter->stats.mpc; 1700 netdev->stats.rx_over_errors = adapter->stats.mpc;
1703 1701
1704 adapter->net_stats.tx_errors = 0; 1702 netdev->stats.tx_errors = 0;
1705 adapter->net_stats.rx_frame_errors = 0; 1703 netdev->stats.rx_frame_errors = 0;
1706 adapter->net_stats.tx_aborted_errors = 0; 1704 netdev->stats.tx_aborted_errors = 0;
1707 adapter->net_stats.tx_carrier_errors = 0; 1705 netdev->stats.tx_carrier_errors = 0;
1708 adapter->net_stats.tx_fifo_errors = 0; 1706 netdev->stats.tx_fifo_errors = 0;
1709 adapter->net_stats.tx_heartbeat_errors = 0; 1707 netdev->stats.tx_heartbeat_errors = 0;
1710 adapter->net_stats.tx_window_errors = 0; 1708 netdev->stats.tx_window_errors = 0;
1711} 1709}
1712 1710
1713#define IXGB_MAX_INTR 10 1711#define IXGB_MAX_INTR 10