diff options
author | Eric Dumazet <eric.dumazet@gmail.com> | 2010-07-08 00:08:43 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-07-09 02:12:27 -0400 |
commit | 5d07bf264746b7c22d7104e0e2232eeea3d32296 (patch) | |
tree | db2644e1c997d49424e8d718bec19e25279818de /drivers/net | |
parent | 122e28ebac2cc2378101d1d37a5886c3ac1f8b18 (diff) |
bnx2: 64 bit stats on all arches
Now core network is able to handle 64 bit netdevice stats on 32 bit
arches, we can provide them for bnx2, since hardware maintains some 64
bit counters.
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Acked-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/bnx2.c | 25 |
1 files changed, 7 insertions, 18 deletions
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c index 22fa1e941247..a203f39e2b8c 100644 --- a/drivers/net/bnx2.c +++ b/drivers/net/bnx2.c | |||
@@ -6589,36 +6589,25 @@ bnx2_save_stats(struct bnx2 *bp) | |||
6589 | temp_stats[i] += hw_stats[i]; | 6589 | temp_stats[i] += hw_stats[i]; |
6590 | } | 6590 | } |
6591 | 6591 | ||
6592 | #define GET_64BIT_NET_STATS64(ctr) \ | 6592 | #define GET_64BIT_NET_STATS64(ctr) \ |
6593 | (unsigned long) ((unsigned long) (ctr##_hi) << 32) + \ | 6593 | (((u64) (ctr##_hi) << 32) + (u64) (ctr##_lo)) |
6594 | (unsigned long) (ctr##_lo) | ||
6595 | 6594 | ||
6596 | #define GET_64BIT_NET_STATS32(ctr) \ | ||
6597 | (ctr##_lo) | ||
6598 | |||
6599 | #if (BITS_PER_LONG == 64) | ||
6600 | #define GET_64BIT_NET_STATS(ctr) \ | 6595 | #define GET_64BIT_NET_STATS(ctr) \ |
6601 | GET_64BIT_NET_STATS64(bp->stats_blk->ctr) + \ | 6596 | GET_64BIT_NET_STATS64(bp->stats_blk->ctr) + \ |
6602 | GET_64BIT_NET_STATS64(bp->temp_stats_blk->ctr) | 6597 | GET_64BIT_NET_STATS64(bp->temp_stats_blk->ctr) |
6603 | #else | ||
6604 | #define GET_64BIT_NET_STATS(ctr) \ | ||
6605 | GET_64BIT_NET_STATS32(bp->stats_blk->ctr) + \ | ||
6606 | GET_64BIT_NET_STATS32(bp->temp_stats_blk->ctr) | ||
6607 | #endif | ||
6608 | 6598 | ||
6609 | #define GET_32BIT_NET_STATS(ctr) \ | 6599 | #define GET_32BIT_NET_STATS(ctr) \ |
6610 | (unsigned long) (bp->stats_blk->ctr + \ | 6600 | (unsigned long) (bp->stats_blk->ctr + \ |
6611 | bp->temp_stats_blk->ctr) | 6601 | bp->temp_stats_blk->ctr) |
6612 | 6602 | ||
6613 | static struct net_device_stats * | 6603 | static struct rtnl_link_stats64 * |
6614 | bnx2_get_stats(struct net_device *dev) | 6604 | bnx2_get_stats64(struct net_device *dev, struct rtnl_link_stats64 *net_stats) |
6615 | { | 6605 | { |
6616 | struct bnx2 *bp = netdev_priv(dev); | 6606 | struct bnx2 *bp = netdev_priv(dev); |
6617 | struct net_device_stats *net_stats = &dev->stats; | ||
6618 | 6607 | ||
6619 | if (bp->stats_blk == NULL) { | 6608 | if (bp->stats_blk == NULL) |
6620 | return net_stats; | 6609 | return net_stats; |
6621 | } | 6610 | |
6622 | net_stats->rx_packets = | 6611 | net_stats->rx_packets = |
6623 | GET_64BIT_NET_STATS(stat_IfHCInUcastPkts) + | 6612 | GET_64BIT_NET_STATS(stat_IfHCInUcastPkts) + |
6624 | GET_64BIT_NET_STATS(stat_IfHCInMulticastPkts) + | 6613 | GET_64BIT_NET_STATS(stat_IfHCInMulticastPkts) + |
@@ -8289,7 +8278,7 @@ static const struct net_device_ops bnx2_netdev_ops = { | |||
8289 | .ndo_open = bnx2_open, | 8278 | .ndo_open = bnx2_open, |
8290 | .ndo_start_xmit = bnx2_start_xmit, | 8279 | .ndo_start_xmit = bnx2_start_xmit, |
8291 | .ndo_stop = bnx2_close, | 8280 | .ndo_stop = bnx2_close, |
8292 | .ndo_get_stats = bnx2_get_stats, | 8281 | .ndo_get_stats64 = bnx2_get_stats64, |
8293 | .ndo_set_rx_mode = bnx2_set_rx_mode, | 8282 | .ndo_set_rx_mode = bnx2_set_rx_mode, |
8294 | .ndo_do_ioctl = bnx2_ioctl, | 8283 | .ndo_do_ioctl = bnx2_ioctl, |
8295 | .ndo_validate_addr = eth_validate_addr, | 8284 | .ndo_validate_addr = eth_validate_addr, |