Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 144324
b: refs/heads/master
c: ae0e8e8
h: refs/heads/master
v: v3
  • Loading branch information
Stephen Hemminger authored and David S. Miller committed Apr 27, 2009
1 parent 60b68aa commit 2f62d19
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 26 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 6a783c9067e3f71aac61a9262fe42c1f68efd4fc
refs/heads/master: ae0e8e82205c903978a79ebf5e31c670b61fa5b4
41 changes: 16 additions & 25 deletions trunk/drivers/net/veth.c
Original file line number Diff line number Diff line change
Expand Up @@ -210,31 +210,29 @@ static int veth_xmit(struct sk_buff *skb, struct net_device *dev)

static struct net_device_stats *veth_get_stats(struct net_device *dev)
{
struct veth_priv *priv;
struct net_device_stats *dev_stats;
int cpu;
struct veth_priv *priv = netdev_priv(dev);
struct net_device_stats *dev_stats = &dev->stats;
unsigned int cpu;
struct veth_net_stats *stats;

priv = netdev_priv(dev);
dev_stats = &dev->stats;

dev_stats->rx_packets = 0;
dev_stats->tx_packets = 0;
dev_stats->rx_bytes = 0;
dev_stats->tx_bytes = 0;
dev_stats->tx_dropped = 0;
dev_stats->rx_dropped = 0;

for_each_online_cpu(cpu) {
stats = per_cpu_ptr(priv->stats, cpu);
if (priv->stats)
for_each_online_cpu(cpu) {
stats = per_cpu_ptr(priv->stats, cpu);

dev_stats->rx_packets += stats->rx_packets;
dev_stats->tx_packets += stats->tx_packets;
dev_stats->rx_bytes += stats->rx_bytes;
dev_stats->tx_bytes += stats->tx_bytes;
dev_stats->tx_dropped += stats->tx_dropped;
dev_stats->rx_dropped += stats->rx_dropped;
}
dev_stats->rx_packets += stats->rx_packets;
dev_stats->tx_packets += stats->tx_packets;
dev_stats->rx_bytes += stats->rx_bytes;
dev_stats->tx_bytes += stats->tx_bytes;
dev_stats->tx_dropped += stats->tx_dropped;
dev_stats->rx_dropped += stats->rx_dropped;
}

return dev_stats;
}
Expand All @@ -261,6 +259,8 @@ static int veth_close(struct net_device *dev)
netif_carrier_off(dev);
netif_carrier_off(priv->peer);

free_percpu(priv->stats);
priv->stats = NULL;
return 0;
}

Expand Down Expand Up @@ -291,15 +291,6 @@ static int veth_dev_init(struct net_device *dev)
return 0;
}

static void veth_dev_free(struct net_device *dev)
{
struct veth_priv *priv;

priv = netdev_priv(dev);
free_percpu(priv->stats);
free_netdev(dev);
}

static const struct net_device_ops veth_netdev_ops = {
.ndo_init = veth_dev_init,
.ndo_open = veth_open,
Expand All @@ -317,7 +308,7 @@ static void veth_setup(struct net_device *dev)
dev->netdev_ops = &veth_netdev_ops;
dev->ethtool_ops = &veth_ethtool_ops;
dev->features |= NETIF_F_LLTX;
dev->destructor = veth_dev_free;
dev->destructor = free_netdev;
}

/*
Expand Down

0 comments on commit 2f62d19

Please sign in to comment.