diff options
author | Eric Dumazet <eric.dumazet@gmail.com> | 2010-07-07 16:44:24 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-07-09 02:12:28 -0400 |
commit | 511d22247be767bbf275ee7a5a388c4f009aa0c1 (patch) | |
tree | 80455cfcf51782be3546212e1df38b3314c86758 | |
parent | 5d07bf264746b7c22d7104e0e2232eeea3d32296 (diff) |
tg3: 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 tg3, since hardware maintains 64 bit
counters.
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/tg3.c | 35 | ||||
-rw-r--r-- | drivers/net/tg3.h | 4 |
2 files changed, 14 insertions, 25 deletions
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index 289cdc5fde92..7c75f1e33996 100644 --- a/drivers/net/tg3.c +++ b/drivers/net/tg3.c | |||
@@ -9021,7 +9021,8 @@ err_out1: | |||
9021 | return err; | 9021 | return err; |
9022 | } | 9022 | } |
9023 | 9023 | ||
9024 | static struct net_device_stats *tg3_get_stats(struct net_device *); | 9024 | static struct rtnl_link_stats64 *tg3_get_stats64(struct net_device *, |
9025 | struct rtnl_link_stats64 *); | ||
9025 | static struct tg3_ethtool_stats *tg3_get_estats(struct tg3 *); | 9026 | static struct tg3_ethtool_stats *tg3_get_estats(struct tg3 *); |
9026 | 9027 | ||
9027 | static int tg3_close(struct net_device *dev) | 9028 | static int tg3_close(struct net_device *dev) |
@@ -9055,8 +9056,8 @@ static int tg3_close(struct net_device *dev) | |||
9055 | 9056 | ||
9056 | tg3_ints_fini(tp); | 9057 | tg3_ints_fini(tp); |
9057 | 9058 | ||
9058 | memcpy(&tp->net_stats_prev, tg3_get_stats(tp->dev), | 9059 | tg3_get_stats64(tp->dev, &tp->net_stats_prev); |
9059 | sizeof(tp->net_stats_prev)); | 9060 | |
9060 | memcpy(&tp->estats_prev, tg3_get_estats(tp), | 9061 | memcpy(&tp->estats_prev, tg3_get_estats(tp), |
9061 | sizeof(tp->estats_prev)); | 9062 | sizeof(tp->estats_prev)); |
9062 | 9063 | ||
@@ -9069,24 +9070,12 @@ static int tg3_close(struct net_device *dev) | |||
9069 | return 0; | 9070 | return 0; |
9070 | } | 9071 | } |
9071 | 9072 | ||
9072 | static inline unsigned long get_stat64(tg3_stat64_t *val) | 9073 | static inline u64 get_stat64(tg3_stat64_t *val) |
9073 | { | ||
9074 | unsigned long ret; | ||
9075 | |||
9076 | #if (BITS_PER_LONG == 32) | ||
9077 | ret = val->low; | ||
9078 | #else | ||
9079 | ret = ((u64)val->high << 32) | ((u64)val->low); | ||
9080 | #endif | ||
9081 | return ret; | ||
9082 | } | ||
9083 | |||
9084 | static inline u64 get_estat64(tg3_stat64_t *val) | ||
9085 | { | 9074 | { |
9086 | return ((u64)val->high << 32) | ((u64)val->low); | 9075 | return ((u64)val->high << 32) | ((u64)val->low); |
9087 | } | 9076 | } |
9088 | 9077 | ||
9089 | static unsigned long calc_crc_errors(struct tg3 *tp) | 9078 | static u64 calc_crc_errors(struct tg3 *tp) |
9090 | { | 9079 | { |
9091 | struct tg3_hw_stats *hw_stats = tp->hw_stats; | 9080 | struct tg3_hw_stats *hw_stats = tp->hw_stats; |
9092 | 9081 | ||
@@ -9114,7 +9103,7 @@ static unsigned long calc_crc_errors(struct tg3 *tp) | |||
9114 | 9103 | ||
9115 | #define ESTAT_ADD(member) \ | 9104 | #define ESTAT_ADD(member) \ |
9116 | estats->member = old_estats->member + \ | 9105 | estats->member = old_estats->member + \ |
9117 | get_estat64(&hw_stats->member) | 9106 | get_stat64(&hw_stats->member) |
9118 | 9107 | ||
9119 | static struct tg3_ethtool_stats *tg3_get_estats(struct tg3 *tp) | 9108 | static struct tg3_ethtool_stats *tg3_get_estats(struct tg3 *tp) |
9120 | { | 9109 | { |
@@ -9204,11 +9193,11 @@ static struct tg3_ethtool_stats *tg3_get_estats(struct tg3 *tp) | |||
9204 | return estats; | 9193 | return estats; |
9205 | } | 9194 | } |
9206 | 9195 | ||
9207 | static struct net_device_stats *tg3_get_stats(struct net_device *dev) | 9196 | static struct rtnl_link_stats64 *tg3_get_stats64(struct net_device *dev, |
9197 | struct rtnl_link_stats64 *stats) | ||
9208 | { | 9198 | { |
9209 | struct tg3 *tp = netdev_priv(dev); | 9199 | struct tg3 *tp = netdev_priv(dev); |
9210 | struct net_device_stats *stats = &tp->net_stats; | 9200 | struct rtnl_link_stats64 *old_stats = &tp->net_stats_prev; |
9211 | struct net_device_stats *old_stats = &tp->net_stats_prev; | ||
9212 | struct tg3_hw_stats *hw_stats = tp->hw_stats; | 9201 | struct tg3_hw_stats *hw_stats = tp->hw_stats; |
9213 | 9202 | ||
9214 | if (!hw_stats) | 9203 | if (!hw_stats) |
@@ -14317,7 +14306,7 @@ static const struct net_device_ops tg3_netdev_ops = { | |||
14317 | .ndo_open = tg3_open, | 14306 | .ndo_open = tg3_open, |
14318 | .ndo_stop = tg3_close, | 14307 | .ndo_stop = tg3_close, |
14319 | .ndo_start_xmit = tg3_start_xmit, | 14308 | .ndo_start_xmit = tg3_start_xmit, |
14320 | .ndo_get_stats = tg3_get_stats, | 14309 | .ndo_get_stats64 = tg3_get_stats64, |
14321 | .ndo_validate_addr = eth_validate_addr, | 14310 | .ndo_validate_addr = eth_validate_addr, |
14322 | .ndo_set_multicast_list = tg3_set_rx_mode, | 14311 | .ndo_set_multicast_list = tg3_set_rx_mode, |
14323 | .ndo_set_mac_address = tg3_set_mac_addr, | 14312 | .ndo_set_mac_address = tg3_set_mac_addr, |
@@ -14336,7 +14325,7 @@ static const struct net_device_ops tg3_netdev_ops_dma_bug = { | |||
14336 | .ndo_open = tg3_open, | 14325 | .ndo_open = tg3_open, |
14337 | .ndo_stop = tg3_close, | 14326 | .ndo_stop = tg3_close, |
14338 | .ndo_start_xmit = tg3_start_xmit_dma_bug, | 14327 | .ndo_start_xmit = tg3_start_xmit_dma_bug, |
14339 | .ndo_get_stats = tg3_get_stats, | 14328 | .ndo_get_stats64 = tg3_get_stats64, |
14340 | .ndo_validate_addr = eth_validate_addr, | 14329 | .ndo_validate_addr = eth_validate_addr, |
14341 | .ndo_set_multicast_list = tg3_set_rx_mode, | 14330 | .ndo_set_multicast_list = tg3_set_rx_mode, |
14342 | .ndo_set_mac_address = tg3_set_mac_addr, | 14331 | .ndo_set_mac_address = tg3_set_mac_addr, |
diff --git a/drivers/net/tg3.h b/drivers/net/tg3.h index 6b6af7698b38..b72ac52b33fd 100644 --- a/drivers/net/tg3.h +++ b/drivers/net/tg3.h | |||
@@ -2772,8 +2772,8 @@ struct tg3 { | |||
2772 | 2772 | ||
2773 | 2773 | ||
2774 | /* begin "everything else" cacheline(s) section */ | 2774 | /* begin "everything else" cacheline(s) section */ |
2775 | struct net_device_stats net_stats; | 2775 | struct rtnl_link_stats64 net_stats; |
2776 | struct net_device_stats net_stats_prev; | 2776 | struct rtnl_link_stats64 net_stats_prev; |
2777 | struct tg3_ethtool_stats estats; | 2777 | struct tg3_ethtool_stats estats; |
2778 | struct tg3_ethtool_stats estats_prev; | 2778 | struct tg3_ethtool_stats estats_prev; |
2779 | 2779 | ||