diff options
author | Ben Hutchings <bhutchings@solarflare.com> | 2010-06-08 03:19:54 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-06-12 18:51:22 -0400 |
commit | be1f3c2c027cc5ad735df6a45a542ed1db7ec48b (patch) | |
tree | c97815a7cf25ea62e8f3a6b3597cfa8957f40b81 /drivers/net/bonding/bond_main.c | |
parent | d19b51499967baddf4f9f12a0067146c2554527a (diff) |
net: Enable 64-bit net device statistics on 32-bit architectures
Use struct rtnl_link_stats64 as the statistics structure.
On 32-bit architectures, insert 32 bits of padding after/before each
field of struct net_device_stats to make its layout compatible with
struct rtnl_link_stats64. Add an anonymous union in net_device; move
stats into the union and add struct rtnl_link_stats64 stats64.
Add net_device_ops::ndo_get_stats64, implementations of which will
return a pointer to struct rtnl_link_stats64. Drivers that implement
this operation must not update the structure asynchronously.
Change dev_get_stats() to call ndo_get_stats64 if available, and to
return a pointer to struct rtnl_link_stats64. Change callers of
dev_get_stats() accordingly.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/bonding/bond_main.c')
-rw-r--r-- | drivers/net/bonding/bond_main.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c index ac4f94b7da37..a95a41b74b4e 100644 --- a/drivers/net/bonding/bond_main.c +++ b/drivers/net/bonding/bond_main.c | |||
@@ -3804,20 +3804,21 @@ static int bond_close(struct net_device *bond_dev) | |||
3804 | return 0; | 3804 | return 0; |
3805 | } | 3805 | } |
3806 | 3806 | ||
3807 | static struct net_device_stats *bond_get_stats(struct net_device *bond_dev) | 3807 | static struct rtnl_link_stats64 *bond_get_stats(struct net_device *bond_dev) |
3808 | { | 3808 | { |
3809 | struct bonding *bond = netdev_priv(bond_dev); | 3809 | struct bonding *bond = netdev_priv(bond_dev); |
3810 | struct net_device_stats *stats = &bond_dev->stats; | 3810 | struct rtnl_link_stats64 *stats = &bond_dev->stats64; |
3811 | struct net_device_stats local_stats; | 3811 | struct rtnl_link_stats64 local_stats; |
3812 | struct slave *slave; | 3812 | struct slave *slave; |
3813 | int i; | 3813 | int i; |
3814 | 3814 | ||
3815 | memset(&local_stats, 0, sizeof(struct net_device_stats)); | 3815 | memset(&local_stats, 0, sizeof(local_stats)); |
3816 | 3816 | ||
3817 | read_lock_bh(&bond->lock); | 3817 | read_lock_bh(&bond->lock); |
3818 | 3818 | ||
3819 | bond_for_each_slave(bond, slave, i) { | 3819 | bond_for_each_slave(bond, slave, i) { |
3820 | const struct net_device_stats *sstats = dev_get_stats(slave->dev); | 3820 | const struct rtnl_link_stats64 *sstats = |
3821 | dev_get_stats(slave->dev); | ||
3821 | 3822 | ||
3822 | local_stats.rx_packets += sstats->rx_packets; | 3823 | local_stats.rx_packets += sstats->rx_packets; |
3823 | local_stats.rx_bytes += sstats->rx_bytes; | 3824 | local_stats.rx_bytes += sstats->rx_bytes; |
@@ -4569,7 +4570,7 @@ static const struct net_device_ops bond_netdev_ops = { | |||
4569 | .ndo_stop = bond_close, | 4570 | .ndo_stop = bond_close, |
4570 | .ndo_start_xmit = bond_start_xmit, | 4571 | .ndo_start_xmit = bond_start_xmit, |
4571 | .ndo_select_queue = bond_select_queue, | 4572 | .ndo_select_queue = bond_select_queue, |
4572 | .ndo_get_stats = bond_get_stats, | 4573 | .ndo_get_stats64 = bond_get_stats, |
4573 | .ndo_do_ioctl = bond_do_ioctl, | 4574 | .ndo_do_ioctl = bond_do_ioctl, |
4574 | .ndo_set_multicast_list = bond_set_multicast_list, | 4575 | .ndo_set_multicast_list = bond_set_multicast_list, |
4575 | .ndo_change_mtu = bond_change_mtu, | 4576 | .ndo_change_mtu = bond_change_mtu, |