diff options
author | Stephen Hemminger <shemminger@vyatta.com> | 2008-11-20 00:40:23 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-11-20 00:40:23 -0500 |
commit | eeda3fd64f75bcbfaa70ce946513abaf3f23b8e0 (patch) | |
tree | 082d1921a5783ef5b07b4cf666804d6509f25f1a /drivers/net/bonding | |
parent | d314774cf2cd5dfeb39a00d37deee65d4c627927 (diff) |
netdev: introduce dev_get_stats()
In order for the network device ops get_stats call to be immutable, the handling
of the default internal network device stats block has to be changed. Add a new
helper function which replaces the old use of internal_get_stats.
Note: change return code to make it clear that the caller should not
go changing the returned statistics.
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/bonding')
-rw-r--r-- | drivers/net/bonding/bond_main.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index a08ea4808056..db5f5c24a250 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
@@ -3899,7 +3899,7 @@ static int bond_close(struct net_device *bond_dev) | |||
3899 | static struct net_device_stats *bond_get_stats(struct net_device *bond_dev) | 3899 | static struct net_device_stats *bond_get_stats(struct net_device *bond_dev) |
3900 | { | 3900 | { |
3901 | struct bonding *bond = netdev_priv(bond_dev); | 3901 | struct bonding *bond = netdev_priv(bond_dev); |
3902 | struct net_device_stats *stats = &(bond->stats), *sstats; | 3902 | struct net_device_stats *stats = &bond->stats; |
3903 | struct net_device_stats local_stats; | 3903 | struct net_device_stats local_stats; |
3904 | struct slave *slave; | 3904 | struct slave *slave; |
3905 | int i; | 3905 | int i; |
@@ -3909,7 +3909,8 @@ static struct net_device_stats *bond_get_stats(struct net_device *bond_dev) | |||
3909 | read_lock_bh(&bond->lock); | 3909 | read_lock_bh(&bond->lock); |
3910 | 3910 | ||
3911 | bond_for_each_slave(bond, slave, i) { | 3911 | bond_for_each_slave(bond, slave, i) { |
3912 | sstats = slave->dev->get_stats(slave->dev); | 3912 | const struct net_device_stats *sstats = dev_get_stats(slave->dev); |
3913 | |||
3913 | local_stats.rx_packets += sstats->rx_packets; | 3914 | local_stats.rx_packets += sstats->rx_packets; |
3914 | local_stats.rx_bytes += sstats->rx_bytes; | 3915 | local_stats.rx_bytes += sstats->rx_bytes; |
3915 | local_stats.rx_errors += sstats->rx_errors; | 3916 | local_stats.rx_errors += sstats->rx_errors; |