Commit 6311cc44 authored by stephen hemminger's avatar stephen hemminger Committed by David S. Miller

veth: convert to 64 bit statistics

Not much change, device was already keeping per cpu statistics.
Use recent 64 statistics interface.
Signed-off-by: default avatarStephen Hemminger <shemminger@vyatta.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 95305f6c
...@@ -24,12 +24,12 @@ ...@@ -24,12 +24,12 @@
#define MAX_MTU 65535 /* Max L3 MTU (arbitrary) */ #define MAX_MTU 65535 /* Max L3 MTU (arbitrary) */
struct veth_net_stats { struct veth_net_stats {
unsigned long rx_packets; u64 rx_packets;
unsigned long tx_packets; u64 tx_packets;
unsigned long rx_bytes; u64 rx_bytes;
unsigned long tx_bytes; u64 tx_bytes;
unsigned long tx_dropped; u64 tx_dropped;
unsigned long rx_dropped; u64 rx_dropped;
}; };
struct veth_priv { struct veth_priv {
...@@ -159,32 +159,27 @@ static netdev_tx_t veth_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -159,32 +159,27 @@ static netdev_tx_t veth_xmit(struct sk_buff *skb, struct net_device *dev)
* general routines * general routines
*/ */
static struct net_device_stats *veth_get_stats(struct net_device *dev) static struct rtnl_link_stats64 *veth_get_stats64(struct net_device *dev,
struct rtnl_link_stats64 *tot)
{ {
struct veth_priv *priv; struct veth_priv *priv;
int cpu; int cpu;
struct veth_net_stats *stats, total = {0}; struct veth_net_stats *stats;
priv = netdev_priv(dev); priv = netdev_priv(dev);
for_each_possible_cpu(cpu) { for_each_possible_cpu(cpu) {
stats = per_cpu_ptr(priv->stats, cpu); stats = per_cpu_ptr(priv->stats, cpu);
total.rx_packets += stats->rx_packets; tot->rx_packets += stats->rx_packets;
total.tx_packets += stats->tx_packets; tot->tx_packets += stats->tx_packets;
total.rx_bytes += stats->rx_bytes; tot->rx_bytes += stats->rx_bytes;
total.tx_bytes += stats->tx_bytes; tot->tx_bytes += stats->tx_bytes;
total.tx_dropped += stats->tx_dropped; tot->tx_dropped += stats->tx_dropped;
total.rx_dropped += stats->rx_dropped; tot->rx_dropped += stats->rx_dropped;
} }
dev->stats.rx_packets = total.rx_packets;
dev->stats.tx_packets = total.tx_packets; return tot;
dev->stats.rx_bytes = total.rx_bytes;
dev->stats.tx_bytes = total.tx_bytes;
dev->stats.tx_dropped = total.tx_dropped;
dev->stats.rx_dropped = total.rx_dropped;
return &dev->stats;
} }
static int veth_open(struct net_device *dev) static int veth_open(struct net_device *dev)
...@@ -254,7 +249,7 @@ static const struct net_device_ops veth_netdev_ops = { ...@@ -254,7 +249,7 @@ static const struct net_device_ops veth_netdev_ops = {
.ndo_stop = veth_close, .ndo_stop = veth_close,
.ndo_start_xmit = veth_xmit, .ndo_start_xmit = veth_xmit,
.ndo_change_mtu = veth_change_mtu, .ndo_change_mtu = veth_change_mtu,
.ndo_get_stats = veth_get_stats, .ndo_get_stats64 = veth_get_stats64,
.ndo_set_mac_address = eth_mac_addr, .ndo_set_mac_address = eth_mac_addr,
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment