aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Carlson <mcarlson@broadcom.com>2012-02-13 10:20:09 -0500
committerDavid S. Miller <davem@davemloft.net>2012-02-13 20:45:04 -0500
commitb546e46f5c9f19a921d6f62db80f2e9371bc0558 (patch)
tree363edfa3698ed62ec6e9028d760ff9f7282b3f9f
parent3906969189a409e590a51b18c86a92d0506c9372 (diff)
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>
-rw-r--r--drivers/net/ethernet/broadcom/tg3.c8
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,
10154 struct tg3_ethtool_stats *old_estats = &tp->estats_prev; 10154 struct tg3_ethtool_stats *old_estats = &tp->estats_prev;
10155 struct tg3_hw_stats *hw_stats = tp->hw_stats; 10155 struct tg3_hw_stats *hw_stats = tp->hw_stats;
10156 10156
10157 if (!hw_stats)
10158 return old_estats;
10159
10160 ESTAT_ADD(rx_octets); 10157 ESTAT_ADD(rx_octets);
10161 ESTAT_ADD(rx_fragments); 10158 ESTAT_ADD(rx_fragments);
10162 ESTAT_ADD(rx_ucast_packets); 10159 ESTAT_ADD(rx_ucast_packets);
@@ -11029,7 +11026,10 @@ static void tg3_get_ethtool_stats(struct net_device *dev,
11029{ 11026{
11030 struct tg3 *tp = netdev_priv(dev); 11027 struct tg3 *tp = netdev_priv(dev);
11031 11028
11032 tg3_get_estats(tp, (struct tg3_ethtool_stats *)tmp_stats); 11029 if (tp->hw_stats)
11030 tg3_get_estats(tp, (struct tg3_ethtool_stats *)tmp_stats);
11031 else
11032 memset(tmp_stats, 0, sizeof(struct tg3_ethtool_stats));
11033} 11033}
11034 11034
11035static __be32 *tg3_vpd_readblock(struct tg3 *tp, u32 *vpdlen) 11035static __be32 *tg3_vpd_readblock(struct tg3 *tp, u32 *vpdlen)