diff options
author | stephen hemminger <shemminger@vyatta.com> | 2011-06-08 10:53:57 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-06-09 02:26:32 -0400 |
commit | 95305f6c3b4e8c0bdd5044604c418a8ad2defc4e (patch) | |
tree | a1c31e21427b48b270431660291e714cf1c3477a /drivers/net/vmxnet3 | |
parent | 4b9d9be839fdb7dcd7ce7619a623fd9015a50cda (diff) |
vmxnet3: convert to 64 bit stats interface
Convert vmxnet3 driver to 64 bit statistics interface.
This driver was already counting packet per queue in a 64 bit value so not
a huge change. Eliminate unused old net_device_stats structure.
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: Scott J. Goldman <scottjg@vmware.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/vmxnet3')
-rw-r--r-- | drivers/net/vmxnet3/vmxnet3_drv.c | 2 | ||||
-rw-r--r-- | drivers/net/vmxnet3/vmxnet3_ethtool.c | 44 | ||||
-rw-r--r-- | drivers/net/vmxnet3/vmxnet3_int.h | 5 |
3 files changed, 26 insertions, 25 deletions
diff --git a/drivers/net/vmxnet3/vmxnet3_drv.c b/drivers/net/vmxnet3/vmxnet3_drv.c index fa6e2ac7475a..cea1b3c2953a 100644 --- a/drivers/net/vmxnet3/vmxnet3_drv.c +++ b/drivers/net/vmxnet3/vmxnet3_drv.c | |||
@@ -2864,7 +2864,7 @@ vmxnet3_probe_device(struct pci_dev *pdev, | |||
2864 | .ndo_set_mac_address = vmxnet3_set_mac_addr, | 2864 | .ndo_set_mac_address = vmxnet3_set_mac_addr, |
2865 | .ndo_change_mtu = vmxnet3_change_mtu, | 2865 | .ndo_change_mtu = vmxnet3_change_mtu, |
2866 | .ndo_set_features = vmxnet3_set_features, | 2866 | .ndo_set_features = vmxnet3_set_features, |
2867 | .ndo_get_stats = vmxnet3_get_stats, | 2867 | .ndo_get_stats64 = vmxnet3_get_stats64, |
2868 | .ndo_tx_timeout = vmxnet3_tx_timeout, | 2868 | .ndo_tx_timeout = vmxnet3_tx_timeout, |
2869 | .ndo_set_multicast_list = vmxnet3_set_mc, | 2869 | .ndo_set_multicast_list = vmxnet3_set_mc, |
2870 | .ndo_vlan_rx_register = vmxnet3_vlan_rx_register, | 2870 | .ndo_vlan_rx_register = vmxnet3_vlan_rx_register, |
diff --git a/drivers/net/vmxnet3/vmxnet3_ethtool.c b/drivers/net/vmxnet3/vmxnet3_ethtool.c index dc959fe27aa5..bba7c15de5b6 100644 --- a/drivers/net/vmxnet3/vmxnet3_ethtool.c +++ b/drivers/net/vmxnet3/vmxnet3_ethtool.c | |||
@@ -113,15 +113,15 @@ vmxnet3_global_stats[] = { | |||
113 | }; | 113 | }; |
114 | 114 | ||
115 | 115 | ||
116 | struct net_device_stats * | 116 | struct rtnl_link_stats64 * |
117 | vmxnet3_get_stats(struct net_device *netdev) | 117 | vmxnet3_get_stats64(struct net_device *netdev, |
118 | struct rtnl_link_stats64 *stats) | ||
118 | { | 119 | { |
119 | struct vmxnet3_adapter *adapter; | 120 | struct vmxnet3_adapter *adapter; |
120 | struct vmxnet3_tq_driver_stats *drvTxStats; | 121 | struct vmxnet3_tq_driver_stats *drvTxStats; |
121 | struct vmxnet3_rq_driver_stats *drvRxStats; | 122 | struct vmxnet3_rq_driver_stats *drvRxStats; |
122 | struct UPT1_TxStats *devTxStats; | 123 | struct UPT1_TxStats *devTxStats; |
123 | struct UPT1_RxStats *devRxStats; | 124 | struct UPT1_RxStats *devRxStats; |
124 | struct net_device_stats *net_stats = &netdev->stats; | ||
125 | unsigned long flags; | 125 | unsigned long flags; |
126 | int i; | 126 | int i; |
127 | 127 | ||
@@ -132,36 +132,36 @@ vmxnet3_get_stats(struct net_device *netdev) | |||
132 | VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD, VMXNET3_CMD_GET_STATS); | 132 | VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD, VMXNET3_CMD_GET_STATS); |
133 | spin_unlock_irqrestore(&adapter->cmd_lock, flags); | 133 | spin_unlock_irqrestore(&adapter->cmd_lock, flags); |
134 | 134 | ||
135 | memset(net_stats, 0, sizeof(*net_stats)); | ||
136 | for (i = 0; i < adapter->num_tx_queues; i++) { | 135 | for (i = 0; i < adapter->num_tx_queues; i++) { |
137 | devTxStats = &adapter->tqd_start[i].stats; | 136 | devTxStats = &adapter->tqd_start[i].stats; |
138 | drvTxStats = &adapter->tx_queue[i].stats; | 137 | drvTxStats = &adapter->tx_queue[i].stats; |
139 | net_stats->tx_packets += devTxStats->ucastPktsTxOK + | 138 | stats->tx_packets += devTxStats->ucastPktsTxOK + |
140 | devTxStats->mcastPktsTxOK + | 139 | devTxStats->mcastPktsTxOK + |
141 | devTxStats->bcastPktsTxOK; | 140 | devTxStats->bcastPktsTxOK; |
142 | net_stats->tx_bytes += devTxStats->ucastBytesTxOK + | 141 | stats->tx_bytes += devTxStats->ucastBytesTxOK + |
143 | devTxStats->mcastBytesTxOK + | 142 | devTxStats->mcastBytesTxOK + |
144 | devTxStats->bcastBytesTxOK; | 143 | devTxStats->bcastBytesTxOK; |
145 | net_stats->tx_errors += devTxStats->pktsTxError; | 144 | stats->tx_errors += devTxStats->pktsTxError; |
146 | net_stats->tx_dropped += drvTxStats->drop_total; | 145 | stats->tx_dropped += drvTxStats->drop_total; |
147 | } | 146 | } |
148 | 147 | ||
149 | for (i = 0; i < adapter->num_rx_queues; i++) { | 148 | for (i = 0; i < adapter->num_rx_queues; i++) { |
150 | devRxStats = &adapter->rqd_start[i].stats; | 149 | devRxStats = &adapter->rqd_start[i].stats; |
151 | drvRxStats = &adapter->rx_queue[i].stats; | 150 | drvRxStats = &adapter->rx_queue[i].stats; |
152 | net_stats->rx_packets += devRxStats->ucastPktsRxOK + | 151 | stats->rx_packets += devRxStats->ucastPktsRxOK + |
153 | devRxStats->mcastPktsRxOK + | 152 | devRxStats->mcastPktsRxOK + |
154 | devRxStats->bcastPktsRxOK; | 153 | devRxStats->bcastPktsRxOK; |
155 | 154 | ||
156 | net_stats->rx_bytes += devRxStats->ucastBytesRxOK + | 155 | stats->rx_bytes += devRxStats->ucastBytesRxOK + |
157 | devRxStats->mcastBytesRxOK + | 156 | devRxStats->mcastBytesRxOK + |
158 | devRxStats->bcastBytesRxOK; | 157 | devRxStats->bcastBytesRxOK; |
159 | 158 | ||
160 | net_stats->rx_errors += devRxStats->pktsRxError; | 159 | stats->rx_errors += devRxStats->pktsRxError; |
161 | net_stats->rx_dropped += drvRxStats->drop_total; | 160 | stats->rx_dropped += drvRxStats->drop_total; |
162 | net_stats->multicast += devRxStats->mcastPktsRxOK; | 161 | stats->multicast += devRxStats->mcastPktsRxOK; |
163 | } | 162 | } |
164 | return net_stats; | 163 | |
164 | return stats; | ||
165 | } | 165 | } |
166 | 166 | ||
167 | static int | 167 | static int |
diff --git a/drivers/net/vmxnet3/vmxnet3_int.h b/drivers/net/vmxnet3/vmxnet3_int.h index f50d36fdf405..0e567c249d6d 100644 --- a/drivers/net/vmxnet3/vmxnet3_int.h +++ b/drivers/net/vmxnet3/vmxnet3_int.h | |||
@@ -323,7 +323,6 @@ struct vmxnet3_adapter { | |||
323 | struct Vmxnet3_TxQueueDesc *tqd_start; /* all tx queue desc */ | 323 | struct Vmxnet3_TxQueueDesc *tqd_start; /* all tx queue desc */ |
324 | struct Vmxnet3_RxQueueDesc *rqd_start; /* all rx queue desc */ | 324 | struct Vmxnet3_RxQueueDesc *rqd_start; /* all rx queue desc */ |
325 | struct net_device *netdev; | 325 | struct net_device *netdev; |
326 | struct net_device_stats net_stats; | ||
327 | struct pci_dev *pdev; | 326 | struct pci_dev *pdev; |
328 | 327 | ||
329 | u8 __iomem *hw_addr0; /* for BAR 0 */ | 328 | u8 __iomem *hw_addr0; /* for BAR 0 */ |
@@ -407,7 +406,9 @@ vmxnet3_create_queues(struct vmxnet3_adapter *adapter, | |||
407 | u32 tx_ring_size, u32 rx_ring_size, u32 rx_ring2_size); | 406 | u32 tx_ring_size, u32 rx_ring_size, u32 rx_ring2_size); |
408 | 407 | ||
409 | extern void vmxnet3_set_ethtool_ops(struct net_device *netdev); | 408 | extern void vmxnet3_set_ethtool_ops(struct net_device *netdev); |
410 | extern struct net_device_stats *vmxnet3_get_stats(struct net_device *netdev); | 409 | |
410 | extern struct rtnl_link_stats64 * | ||
411 | vmxnet3_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats); | ||
411 | 412 | ||
412 | extern char vmxnet3_driver_name[]; | 413 | extern char vmxnet3_driver_name[]; |
413 | #endif | 414 | #endif |