diff options
author | Ajit Khaparde <ajitkhaparde@gmail.com> | 2009-10-06 22:43:49 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-10-08 01:00:26 -0400 |
commit | 2d86f1393c62f9c3bae5c1207408ed6559aa3cc4 (patch) | |
tree | 631563e972a39da405eb9c3cae59296bb93e8750 /drivers/net/ixgbe | |
parent | 6dc3494183db0b93f49b193ac115073b72453b9c (diff) |
ixgbe: 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>
Acked-by: Peter P Waskiewicz Jr <peter.p.waskiewicz.jr@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ixgbe')
-rw-r--r-- | drivers/net/ixgbe/ixgbe.h | 1 | ||||
-rw-r--r-- | drivers/net/ixgbe/ixgbe_ethtool.c | 40 | ||||
-rw-r--r-- | drivers/net/ixgbe/ixgbe_main.c | 26 |
3 files changed, 34 insertions, 33 deletions
diff --git a/drivers/net/ixgbe/ixgbe.h b/drivers/net/ixgbe/ixgbe.h index 28f32da794dd..2b854161c61b 100644 --- a/drivers/net/ixgbe/ixgbe.h +++ b/drivers/net/ixgbe/ixgbe.h | |||
@@ -340,7 +340,6 @@ struct ixgbe_adapter { | |||
340 | /* OS defined structs */ | 340 | /* OS defined structs */ |
341 | struct net_device *netdev; | 341 | struct net_device *netdev; |
342 | struct pci_dev *pdev; | 342 | struct pci_dev *pdev; |
343 | struct net_device_stats net_stats; | ||
344 | 343 | ||
345 | u32 test_icr; | 344 | u32 test_icr; |
346 | struct ixgbe_ring test_tx_ring; | 345 | struct ixgbe_ring test_tx_ring; |
diff --git a/drivers/net/ixgbe/ixgbe_ethtool.c b/drivers/net/ixgbe/ixgbe_ethtool.c index fa314cb005a4..987b41c8eb48 100644 --- a/drivers/net/ixgbe/ixgbe_ethtool.c +++ b/drivers/net/ixgbe/ixgbe_ethtool.c | |||
@@ -48,11 +48,13 @@ struct ixgbe_stats { | |||
48 | 48 | ||
49 | #define IXGBE_STAT(m) sizeof(((struct ixgbe_adapter *)0)->m), \ | 49 | #define IXGBE_STAT(m) sizeof(((struct ixgbe_adapter *)0)->m), \ |
50 | offsetof(struct ixgbe_adapter, m) | 50 | offsetof(struct ixgbe_adapter, m) |
51 | #define IXGBE_NETDEV_STAT(m) sizeof(((struct net_device *)0)->m), \ | ||
52 | offsetof(struct net_device, m) | ||
51 | static struct ixgbe_stats ixgbe_gstrings_stats[] = { | 53 | static struct ixgbe_stats ixgbe_gstrings_stats[] = { |
52 | {"rx_packets", IXGBE_STAT(net_stats.rx_packets)}, | 54 | {"rx_packets", IXGBE_NETDEV_STAT(stats.rx_packets)}, |
53 | {"tx_packets", IXGBE_STAT(net_stats.tx_packets)}, | 55 | {"tx_packets", IXGBE_NETDEV_STAT(stats.tx_packets)}, |
54 | {"rx_bytes", IXGBE_STAT(net_stats.rx_bytes)}, | 56 | {"rx_bytes", IXGBE_NETDEV_STAT(stats.rx_bytes)}, |
55 | {"tx_bytes", IXGBE_STAT(net_stats.tx_bytes)}, | 57 | {"tx_bytes", IXGBE_NETDEV_STAT(stats.tx_bytes)}, |
56 | {"rx_pkts_nic", IXGBE_STAT(stats.gprc)}, | 58 | {"rx_pkts_nic", IXGBE_STAT(stats.gprc)}, |
57 | {"tx_pkts_nic", IXGBE_STAT(stats.gptc)}, | 59 | {"tx_pkts_nic", IXGBE_STAT(stats.gptc)}, |
58 | {"rx_bytes_nic", IXGBE_STAT(stats.gorc)}, | 60 | {"rx_bytes_nic", IXGBE_STAT(stats.gorc)}, |
@@ -60,26 +62,26 @@ static struct ixgbe_stats ixgbe_gstrings_stats[] = { | |||
60 | {"lsc_int", IXGBE_STAT(lsc_int)}, | 62 | {"lsc_int", IXGBE_STAT(lsc_int)}, |
61 | {"tx_busy", IXGBE_STAT(tx_busy)}, | 63 | {"tx_busy", IXGBE_STAT(tx_busy)}, |
62 | {"non_eop_descs", IXGBE_STAT(non_eop_descs)}, | 64 | {"non_eop_descs", IXGBE_STAT(non_eop_descs)}, |
63 | {"rx_errors", IXGBE_STAT(net_stats.rx_errors)}, | 65 | {"rx_errors", IXGBE_NETDEV_STAT(stats.rx_errors)}, |
64 | {"tx_errors", IXGBE_STAT(net_stats.tx_errors)}, | 66 | {"tx_errors", IXGBE_NETDEV_STAT(stats.tx_errors)}, |
65 | {"rx_dropped", IXGBE_STAT(net_stats.rx_dropped)}, | 67 | {"rx_dropped", IXGBE_NETDEV_STAT(stats.rx_dropped)}, |
66 | {"tx_dropped", IXGBE_STAT(net_stats.tx_dropped)}, | 68 | {"tx_dropped", IXGBE_NETDEV_STAT(stats.tx_dropped)}, |
67 | {"multicast", IXGBE_STAT(net_stats.multicast)}, | 69 | {"multicast", IXGBE_NETDEV_STAT(stats.multicast)}, |
68 | {"broadcast", IXGBE_STAT(stats.bprc)}, | 70 | {"broadcast", IXGBE_STAT(stats.bprc)}, |
69 | {"rx_no_buffer_count", IXGBE_STAT(stats.rnbc[0]) }, | 71 | {"rx_no_buffer_count", IXGBE_STAT(stats.rnbc[0]) }, |
70 | {"collisions", IXGBE_STAT(net_stats.collisions)}, | 72 | {"collisions", IXGBE_NETDEV_STAT(stats.collisions)}, |
71 | {"rx_over_errors", IXGBE_STAT(net_stats.rx_over_errors)}, | 73 | {"rx_over_errors", IXGBE_NETDEV_STAT(stats.rx_over_errors)}, |
72 | {"rx_crc_errors", IXGBE_STAT(net_stats.rx_crc_errors)}, | 74 | {"rx_crc_errors", IXGBE_NETDEV_STAT(stats.rx_crc_errors)}, |
73 | {"rx_frame_errors", IXGBE_STAT(net_stats.rx_frame_errors)}, | 75 | {"rx_frame_errors", IXGBE_NETDEV_STAT(stats.rx_frame_errors)}, |
74 | {"hw_rsc_count", IXGBE_STAT(rsc_count)}, | 76 | {"hw_rsc_count", IXGBE_STAT(rsc_count)}, |
75 | {"fdir_match", IXGBE_STAT(stats.fdirmatch)}, | 77 | {"fdir_match", IXGBE_STAT(stats.fdirmatch)}, |
76 | {"fdir_miss", IXGBE_STAT(stats.fdirmiss)}, | 78 | {"fdir_miss", IXGBE_STAT(stats.fdirmiss)}, |
77 | {"rx_fifo_errors", IXGBE_STAT(net_stats.rx_fifo_errors)}, | 79 | {"rx_fifo_errors", IXGBE_NETDEV_STAT(stats.rx_fifo_errors)}, |
78 | {"rx_missed_errors", IXGBE_STAT(net_stats.rx_missed_errors)}, | 80 | {"rx_missed_errors", IXGBE_NETDEV_STAT(stats.rx_missed_errors)}, |
79 | {"tx_aborted_errors", IXGBE_STAT(net_stats.tx_aborted_errors)}, | 81 | {"tx_aborted_errors", IXGBE_NETDEV_STAT(stats.tx_aborted_errors)}, |
80 | {"tx_carrier_errors", IXGBE_STAT(net_stats.tx_carrier_errors)}, | 82 | {"tx_carrier_errors", IXGBE_NETDEV_STAT(stats.tx_carrier_errors)}, |
81 | {"tx_fifo_errors", IXGBE_STAT(net_stats.tx_fifo_errors)}, | 83 | {"tx_fifo_errors", IXGBE_NETDEV_STAT(stats.tx_fifo_errors)}, |
82 | {"tx_heartbeat_errors", IXGBE_STAT(net_stats.tx_heartbeat_errors)}, | 84 | {"tx_heartbeat_errors", IXGBE_NETDEV_STAT(stats.tx_heartbeat_errors)}, |
83 | {"tx_timeout_count", IXGBE_STAT(tx_timeout_count)}, | 85 | {"tx_timeout_count", IXGBE_STAT(tx_timeout_count)}, |
84 | {"tx_restart_queue", IXGBE_STAT(restart_queue)}, | 86 | {"tx_restart_queue", IXGBE_STAT(restart_queue)}, |
85 | {"rx_long_length_errors", IXGBE_STAT(stats.roc)}, | 87 | {"rx_long_length_errors", IXGBE_STAT(stats.roc)}, |
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c index cbb143ca1eb8..c91d50e54427 100644 --- a/drivers/net/ixgbe/ixgbe_main.c +++ b/drivers/net/ixgbe/ixgbe_main.c | |||
@@ -372,8 +372,8 @@ static bool ixgbe_clean_tx_irq(struct ixgbe_q_vector *q_vector, | |||
372 | tx_ring->total_packets += total_packets; | 372 | tx_ring->total_packets += total_packets; |
373 | tx_ring->stats.packets += total_packets; | 373 | tx_ring->stats.packets += total_packets; |
374 | tx_ring->stats.bytes += total_bytes; | 374 | tx_ring->stats.bytes += total_bytes; |
375 | adapter->net_stats.tx_bytes += total_bytes; | 375 | netdev->stats.tx_bytes += total_bytes; |
376 | adapter->net_stats.tx_packets += total_packets; | 376 | netdev->stats.tx_packets += total_packets; |
377 | return (count < tx_ring->work_limit); | 377 | return (count < tx_ring->work_limit); |
378 | } | 378 | } |
379 | 379 | ||
@@ -709,6 +709,7 @@ static bool ixgbe_clean_rx_irq(struct ixgbe_q_vector *q_vector, | |||
709 | int *work_done, int work_to_do) | 709 | int *work_done, int work_to_do) |
710 | { | 710 | { |
711 | struct ixgbe_adapter *adapter = q_vector->adapter; | 711 | struct ixgbe_adapter *adapter = q_vector->adapter; |
712 | struct net_device *netdev = adapter->netdev; | ||
712 | struct pci_dev *pdev = adapter->pdev; | 713 | struct pci_dev *pdev = adapter->pdev; |
713 | union ixgbe_adv_rx_desc *rx_desc, *next_rxd; | 714 | union ixgbe_adv_rx_desc *rx_desc, *next_rxd; |
714 | struct ixgbe_rx_buffer *rx_buffer_info, *next_buffer; | 715 | struct ixgbe_rx_buffer *rx_buffer_info, *next_buffer; |
@@ -880,8 +881,8 @@ next_desc: | |||
880 | 881 | ||
881 | rx_ring->total_packets += total_rx_packets; | 882 | rx_ring->total_packets += total_rx_packets; |
882 | rx_ring->total_bytes += total_rx_bytes; | 883 | rx_ring->total_bytes += total_rx_bytes; |
883 | adapter->net_stats.rx_bytes += total_rx_bytes; | 884 | netdev->stats.rx_bytes += total_rx_bytes; |
884 | adapter->net_stats.rx_packets += total_rx_packets; | 885 | netdev->stats.rx_packets += total_rx_packets; |
885 | 886 | ||
886 | return cleaned; | 887 | return cleaned; |
887 | } | 888 | } |
@@ -4403,6 +4404,7 @@ static void ixgbe_shutdown(struct pci_dev *pdev) | |||
4403 | **/ | 4404 | **/ |
4404 | void ixgbe_update_stats(struct ixgbe_adapter *adapter) | 4405 | void ixgbe_update_stats(struct ixgbe_adapter *adapter) |
4405 | { | 4406 | { |
4407 | struct net_device *netdev = adapter->netdev; | ||
4406 | struct ixgbe_hw *hw = &adapter->hw; | 4408 | struct ixgbe_hw *hw = &adapter->hw; |
4407 | u64 total_mpc = 0; | 4409 | u64 total_mpc = 0; |
4408 | u32 i, missed_rx = 0, mpc, bprc, lxon, lxoff, xon_off_tot; | 4410 | u32 i, missed_rx = 0, mpc, bprc, lxon, lxoff, xon_off_tot; |
@@ -4522,15 +4524,15 @@ void ixgbe_update_stats(struct ixgbe_adapter *adapter) | |||
4522 | adapter->stats.bptc += IXGBE_READ_REG(hw, IXGBE_BPTC); | 4524 | adapter->stats.bptc += IXGBE_READ_REG(hw, IXGBE_BPTC); |
4523 | 4525 | ||
4524 | /* Fill out the OS statistics structure */ | 4526 | /* Fill out the OS statistics structure */ |
4525 | adapter->net_stats.multicast = adapter->stats.mprc; | 4527 | netdev->stats.multicast = adapter->stats.mprc; |
4526 | 4528 | ||
4527 | /* Rx Errors */ | 4529 | /* Rx Errors */ |
4528 | adapter->net_stats.rx_errors = adapter->stats.crcerrs + | 4530 | netdev->stats.rx_errors = adapter->stats.crcerrs + |
4529 | adapter->stats.rlec; | 4531 | adapter->stats.rlec; |
4530 | adapter->net_stats.rx_dropped = 0; | 4532 | netdev->stats.rx_dropped = 0; |
4531 | adapter->net_stats.rx_length_errors = adapter->stats.rlec; | 4533 | netdev->stats.rx_length_errors = adapter->stats.rlec; |
4532 | adapter->net_stats.rx_crc_errors = adapter->stats.crcerrs; | 4534 | netdev->stats.rx_crc_errors = adapter->stats.crcerrs; |
4533 | adapter->net_stats.rx_missed_errors = total_mpc; | 4535 | netdev->stats.rx_missed_errors = total_mpc; |
4534 | } | 4536 | } |
4535 | 4537 | ||
4536 | /** | 4538 | /** |
@@ -5300,10 +5302,8 @@ static netdev_tx_t ixgbe_xmit_frame(struct sk_buff *skb, | |||
5300 | **/ | 5302 | **/ |
5301 | static struct net_device_stats *ixgbe_get_stats(struct net_device *netdev) | 5303 | static struct net_device_stats *ixgbe_get_stats(struct net_device *netdev) |
5302 | { | 5304 | { |
5303 | struct ixgbe_adapter *adapter = netdev_priv(netdev); | ||
5304 | |||
5305 | /* only return the current stats */ | 5305 | /* only return the current stats */ |
5306 | return &adapter->net_stats; | 5306 | return &netdev->stats; |
5307 | } | 5307 | } |
5308 | 5308 | ||
5309 | /** | 5309 | /** |