Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 183534
b: refs/heads/master
c: a474305
h: refs/heads/master
v: v3
  • Loading branch information
Michael Chan authored and David S. Miller committed Jan 18, 2010
1 parent 8eae7cf commit aa9b329
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 31 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: 2c8c1e7297e19bdef3c178c3ea41d898a7716e3e
refs/heads/master: a47430583dab67b23161b0e75226781deed50138
62 changes: 32 additions & 30 deletions trunk/drivers/net/bnx2.c
Original file line number Diff line number Diff line change
Expand Up @@ -6542,92 +6542,94 @@ bnx2_close(struct net_device *dev)
return 0;
}

#define GET_NET_STATS64(ctr) \
#define GET_64BIT_NET_STATS64(ctr) \
(unsigned long) ((unsigned long) (ctr##_hi) << 32) + \
(unsigned long) (ctr##_lo)

#define GET_NET_STATS32(ctr) \
#define GET_64BIT_NET_STATS32(ctr) \
(ctr##_lo)

#if (BITS_PER_LONG == 64)
#define GET_NET_STATS GET_NET_STATS64
#define GET_64BIT_NET_STATS(ctr) \
GET_64BIT_NET_STATS64(bp->stats_blk->ctr)
#else
#define GET_NET_STATS GET_NET_STATS32
#define GET_64BIT_NET_STATS(ctr) \
GET_64BIT_NET_STATS32(bp->stats_blk->ctr)
#endif

#define GET_32BIT_NET_STATS(ctr) \
(unsigned long) (bp->stats_blk->ctr)

static struct net_device_stats *
bnx2_get_stats(struct net_device *dev)
{
struct bnx2 *bp = netdev_priv(dev);
struct statistics_block *stats_blk = bp->stats_blk;
struct net_device_stats *net_stats = &dev->stats;

if (bp->stats_blk == NULL) {
return net_stats;
}
net_stats->rx_packets =
GET_NET_STATS(stats_blk->stat_IfHCInUcastPkts) +
GET_NET_STATS(stats_blk->stat_IfHCInMulticastPkts) +
GET_NET_STATS(stats_blk->stat_IfHCInBroadcastPkts);
GET_64BIT_NET_STATS(stat_IfHCInUcastPkts) +
GET_64BIT_NET_STATS(stat_IfHCInMulticastPkts) +
GET_64BIT_NET_STATS(stat_IfHCInBroadcastPkts);

net_stats->tx_packets =
GET_NET_STATS(stats_blk->stat_IfHCOutUcastPkts) +
GET_NET_STATS(stats_blk->stat_IfHCOutMulticastPkts) +
GET_NET_STATS(stats_blk->stat_IfHCOutBroadcastPkts);
GET_64BIT_NET_STATS(stat_IfHCOutUcastPkts) +
GET_64BIT_NET_STATS(stat_IfHCOutMulticastPkts) +
GET_64BIT_NET_STATS(stat_IfHCOutBroadcastPkts);

net_stats->rx_bytes =
GET_NET_STATS(stats_blk->stat_IfHCInOctets);
GET_64BIT_NET_STATS(stat_IfHCInOctets);

net_stats->tx_bytes =
GET_NET_STATS(stats_blk->stat_IfHCOutOctets);
GET_64BIT_NET_STATS(stat_IfHCOutOctets);

net_stats->multicast =
GET_NET_STATS(stats_blk->stat_IfHCOutMulticastPkts);
GET_64BIT_NET_STATS(stat_IfHCOutMulticastPkts);

net_stats->collisions =
(unsigned long) stats_blk->stat_EtherStatsCollisions;
GET_32BIT_NET_STATS(stat_EtherStatsCollisions);

net_stats->rx_length_errors =
(unsigned long) (stats_blk->stat_EtherStatsUndersizePkts +
stats_blk->stat_EtherStatsOverrsizePkts);
GET_32BIT_NET_STATS(stat_EtherStatsUndersizePkts) +
GET_32BIT_NET_STATS(stat_EtherStatsOverrsizePkts);

net_stats->rx_over_errors =
(unsigned long) (stats_blk->stat_IfInFTQDiscards +
stats_blk->stat_IfInMBUFDiscards);
GET_32BIT_NET_STATS(stat_IfInFTQDiscards) +
GET_32BIT_NET_STATS(stat_IfInMBUFDiscards);

net_stats->rx_frame_errors =
(unsigned long) stats_blk->stat_Dot3StatsAlignmentErrors;
GET_32BIT_NET_STATS(stat_Dot3StatsAlignmentErrors);

net_stats->rx_crc_errors =
(unsigned long) stats_blk->stat_Dot3StatsFCSErrors;
GET_32BIT_NET_STATS(stat_Dot3StatsFCSErrors);

net_stats->rx_errors = net_stats->rx_length_errors +
net_stats->rx_over_errors + net_stats->rx_frame_errors +
net_stats->rx_crc_errors;

net_stats->tx_aborted_errors =
(unsigned long) (stats_blk->stat_Dot3StatsExcessiveCollisions +
stats_blk->stat_Dot3StatsLateCollisions);
GET_32BIT_NET_STATS(stat_Dot3StatsExcessiveCollisions) +
GET_32BIT_NET_STATS(stat_Dot3StatsLateCollisions);

if ((CHIP_NUM(bp) == CHIP_NUM_5706) ||
(CHIP_ID(bp) == CHIP_ID_5708_A0))
net_stats->tx_carrier_errors = 0;
else {
net_stats->tx_carrier_errors =
(unsigned long)
stats_blk->stat_Dot3StatsCarrierSenseErrors;
GET_32BIT_NET_STATS(stat_Dot3StatsCarrierSenseErrors);
}

net_stats->tx_errors =
(unsigned long)
stats_blk->stat_emac_tx_stat_dot3statsinternalmactransmiterrors
+
GET_32BIT_NET_STATS(stat_emac_tx_stat_dot3statsinternalmactransmiterrors) +
net_stats->tx_aborted_errors +
net_stats->tx_carrier_errors;

net_stats->rx_missed_errors =
(unsigned long) (stats_blk->stat_IfInFTQDiscards +
stats_blk->stat_IfInMBUFDiscards + stats_blk->stat_FwRxDrop);
GET_32BIT_NET_STATS(stat_IfInFTQDiscards) +
GET_32BIT_NET_STATS(stat_IfInMBUFDiscards) +
GET_32BIT_NET_STATS(stat_FwRxDrop);

return net_stats;
}
Expand Down

0 comments on commit aa9b329

Please sign in to comment.