diff options
author | Matt Carlson <mcarlson@broadcom.com> | 2012-02-13 19:20:09 +0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-02-14 05:45:04 +0400 |
commit | b546e46f5c9f19a921d6f62db80f2e9371bc0558 (patch) | |
tree | 363edfa3698ed62ec6e9028d760ff9f7282b3f9f /drivers | |
parent | 3906969189a409e590a51b18c86a92d0506c9372 (diff) | |
download | linux-b546e46f5c9f19a921d6f62db80f2e9371bc0558.tar.xz |
tg3: Fix stats while interface is down
If the tg3 interface is down, the driver will return ethtool stats
uninitialized. This patch zeroes out the destination stat buffer in
such a case.
Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
Reviewed-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/ethernet/broadcom/tg3.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c index 0a765f109cc1..4a0b9af71238 100644 --- a/drivers/net/ethernet/broadcom/tg3.c +++ b/drivers/net/ethernet/broadcom/tg3.c @@ -10154,9 +10154,6 @@ static struct tg3_ethtool_stats *tg3_get_estats(struct tg3 *tp, struct tg3_ethtool_stats *old_estats = &tp->estats_prev; struct tg3_hw_stats *hw_stats = tp->hw_stats; - if (!hw_stats) - return old_estats; - ESTAT_ADD(rx_octets); ESTAT_ADD(rx_fragments); ESTAT_ADD(rx_ucast_packets); @@ -11029,7 +11026,10 @@ static void tg3_get_ethtool_stats(struct net_device *dev, { struct tg3 *tp = netdev_priv(dev); - tg3_get_estats(tp, (struct tg3_ethtool_stats *)tmp_stats); + if (tp->hw_stats) + tg3_get_estats(tp, (struct tg3_ethtool_stats *)tmp_stats); + else + memset(tmp_stats, 0, sizeof(struct tg3_ethtool_stats)); } static __be32 *tg3_vpd_readblock(struct tg3 *tp, u32 *vpdlen) |