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>
This commit is contained in:
parent
4b9d9be839
commit
95305f6c3b
3 changed files with 26 additions and 25 deletions
|
@ -2864,7 +2864,7 @@ vmxnet3_probe_device(struct pci_dev *pdev,
|
||||||
.ndo_set_mac_address = vmxnet3_set_mac_addr,
|
.ndo_set_mac_address = vmxnet3_set_mac_addr,
|
||||||
.ndo_change_mtu = vmxnet3_change_mtu,
|
.ndo_change_mtu = vmxnet3_change_mtu,
|
||||||
.ndo_set_features = vmxnet3_set_features,
|
.ndo_set_features = vmxnet3_set_features,
|
||||||
.ndo_get_stats = vmxnet3_get_stats,
|
.ndo_get_stats64 = vmxnet3_get_stats64,
|
||||||
.ndo_tx_timeout = vmxnet3_tx_timeout,
|
.ndo_tx_timeout = vmxnet3_tx_timeout,
|
||||||
.ndo_set_multicast_list = vmxnet3_set_mc,
|
.ndo_set_multicast_list = vmxnet3_set_mc,
|
||||||
.ndo_vlan_rx_register = vmxnet3_vlan_rx_register,
|
.ndo_vlan_rx_register = vmxnet3_vlan_rx_register,
|
||||||
|
|
|
@ -113,15 +113,15 @@ vmxnet3_global_stats[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
struct net_device_stats *
|
struct rtnl_link_stats64 *
|
||||||
vmxnet3_get_stats(struct net_device *netdev)
|
vmxnet3_get_stats64(struct net_device *netdev,
|
||||||
|
struct rtnl_link_stats64 *stats)
|
||||||
{
|
{
|
||||||
struct vmxnet3_adapter *adapter;
|
struct vmxnet3_adapter *adapter;
|
||||||
struct vmxnet3_tq_driver_stats *drvTxStats;
|
struct vmxnet3_tq_driver_stats *drvTxStats;
|
||||||
struct vmxnet3_rq_driver_stats *drvRxStats;
|
struct vmxnet3_rq_driver_stats *drvRxStats;
|
||||||
struct UPT1_TxStats *devTxStats;
|
struct UPT1_TxStats *devTxStats;
|
||||||
struct UPT1_RxStats *devRxStats;
|
struct UPT1_RxStats *devRxStats;
|
||||||
struct net_device_stats *net_stats = &netdev->stats;
|
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -132,36 +132,36 @@ vmxnet3_get_stats(struct net_device *netdev)
|
||||||
VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD, VMXNET3_CMD_GET_STATS);
|
VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD, VMXNET3_CMD_GET_STATS);
|
||||||
spin_unlock_irqrestore(&adapter->cmd_lock, flags);
|
spin_unlock_irqrestore(&adapter->cmd_lock, flags);
|
||||||
|
|
||||||
memset(net_stats, 0, sizeof(*net_stats));
|
|
||||||
for (i = 0; i < adapter->num_tx_queues; i++) {
|
for (i = 0; i < adapter->num_tx_queues; i++) {
|
||||||
devTxStats = &adapter->tqd_start[i].stats;
|
devTxStats = &adapter->tqd_start[i].stats;
|
||||||
drvTxStats = &adapter->tx_queue[i].stats;
|
drvTxStats = &adapter->tx_queue[i].stats;
|
||||||
net_stats->tx_packets += devTxStats->ucastPktsTxOK +
|
stats->tx_packets += devTxStats->ucastPktsTxOK +
|
||||||
devTxStats->mcastPktsTxOK +
|
devTxStats->mcastPktsTxOK +
|
||||||
devTxStats->bcastPktsTxOK;
|
devTxStats->bcastPktsTxOK;
|
||||||
net_stats->tx_bytes += devTxStats->ucastBytesTxOK +
|
stats->tx_bytes += devTxStats->ucastBytesTxOK +
|
||||||
devTxStats->mcastBytesTxOK +
|
devTxStats->mcastBytesTxOK +
|
||||||
devTxStats->bcastBytesTxOK;
|
devTxStats->bcastBytesTxOK;
|
||||||
net_stats->tx_errors += devTxStats->pktsTxError;
|
stats->tx_errors += devTxStats->pktsTxError;
|
||||||
net_stats->tx_dropped += drvTxStats->drop_total;
|
stats->tx_dropped += drvTxStats->drop_total;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < adapter->num_rx_queues; i++) {
|
for (i = 0; i < adapter->num_rx_queues; i++) {
|
||||||
devRxStats = &adapter->rqd_start[i].stats;
|
devRxStats = &adapter->rqd_start[i].stats;
|
||||||
drvRxStats = &adapter->rx_queue[i].stats;
|
drvRxStats = &adapter->rx_queue[i].stats;
|
||||||
net_stats->rx_packets += devRxStats->ucastPktsRxOK +
|
stats->rx_packets += devRxStats->ucastPktsRxOK +
|
||||||
devRxStats->mcastPktsRxOK +
|
devRxStats->mcastPktsRxOK +
|
||||||
devRxStats->bcastPktsRxOK;
|
devRxStats->bcastPktsRxOK;
|
||||||
|
|
||||||
net_stats->rx_bytes += devRxStats->ucastBytesRxOK +
|
stats->rx_bytes += devRxStats->ucastBytesRxOK +
|
||||||
devRxStats->mcastBytesRxOK +
|
devRxStats->mcastBytesRxOK +
|
||||||
devRxStats->bcastBytesRxOK;
|
devRxStats->bcastBytesRxOK;
|
||||||
|
|
||||||
net_stats->rx_errors += devRxStats->pktsRxError;
|
stats->rx_errors += devRxStats->pktsRxError;
|
||||||
net_stats->rx_dropped += drvRxStats->drop_total;
|
stats->rx_dropped += drvRxStats->drop_total;
|
||||||
net_stats->multicast += devRxStats->mcastPktsRxOK;
|
stats->multicast += devRxStats->mcastPktsRxOK;
|
||||||
}
|
}
|
||||||
return net_stats;
|
|
||||||
|
return stats;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
|
|
@ -323,7 +323,6 @@ struct vmxnet3_adapter {
|
||||||
struct Vmxnet3_TxQueueDesc *tqd_start; /* all tx queue desc */
|
struct Vmxnet3_TxQueueDesc *tqd_start; /* all tx queue desc */
|
||||||
struct Vmxnet3_RxQueueDesc *rqd_start; /* all rx queue desc */
|
struct Vmxnet3_RxQueueDesc *rqd_start; /* all rx queue desc */
|
||||||
struct net_device *netdev;
|
struct net_device *netdev;
|
||||||
struct net_device_stats net_stats;
|
|
||||||
struct pci_dev *pdev;
|
struct pci_dev *pdev;
|
||||||
|
|
||||||
u8 __iomem *hw_addr0; /* for BAR 0 */
|
u8 __iomem *hw_addr0; /* for BAR 0 */
|
||||||
|
@ -407,7 +406,9 @@ vmxnet3_create_queues(struct vmxnet3_adapter *adapter,
|
||||||
u32 tx_ring_size, u32 rx_ring_size, u32 rx_ring2_size);
|
u32 tx_ring_size, u32 rx_ring_size, u32 rx_ring2_size);
|
||||||
|
|
||||||
extern void vmxnet3_set_ethtool_ops(struct net_device *netdev);
|
extern void vmxnet3_set_ethtool_ops(struct net_device *netdev);
|
||||||
extern struct net_device_stats *vmxnet3_get_stats(struct net_device *netdev);
|
|
||||||
|
extern struct rtnl_link_stats64 *
|
||||||
|
vmxnet3_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *stats);
|
||||||
|
|
||||||
extern char vmxnet3_driver_name[];
|
extern char vmxnet3_driver_name[];
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Reference in a new issue