aboutsummaryrefslogtreecommitdiffstats
path: root/net/core/dev.c
diff options
context:
space:
mode:
authorBen Hutchings <bhutchings@solarflare.com>2010-06-08 03:19:54 -0400
committerDavid S. Miller <davem@davemloft.net>2010-06-12 18:51:22 -0400
commitbe1f3c2c027cc5ad735df6a45a542ed1db7ec48b (patch)
treec97815a7cf25ea62e8f3a6b3597cfa8957f40b81 /net/core/dev.c
parentd19b51499967baddf4f9f12a0067146c2554527a (diff)
net: Enable 64-bit net device statistics on 32-bit architectures
Use struct rtnl_link_stats64 as the statistics structure. On 32-bit architectures, insert 32 bits of padding after/before each field of struct net_device_stats to make its layout compatible with struct rtnl_link_stats64. Add an anonymous union in net_device; move stats into the union and add struct rtnl_link_stats64 stats64. Add net_device_ops::ndo_get_stats64, implementations of which will return a pointer to struct rtnl_link_stats64. Drivers that implement this operation must not update the structure asynchronously. Change dev_get_stats() to call ndo_get_stats64 if available, and to return a pointer to struct rtnl_link_stats64. Change callers of dev_get_stats() accordingly. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core/dev.c')
-rw-r--r--net/core/dev.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/net/core/dev.c b/net/core/dev.c
index 277844901ce3..a1abc10db08a 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -3701,10 +3701,10 @@ void dev_seq_stop(struct seq_file *seq, void *v)
3701 3701
3702static void dev_seq_printf_stats(struct seq_file *seq, struct net_device *dev) 3702static void dev_seq_printf_stats(struct seq_file *seq, struct net_device *dev)
3703{ 3703{
3704 const struct net_device_stats *stats = dev_get_stats(dev); 3704 const struct rtnl_link_stats64 *stats = dev_get_stats(dev);
3705 3705
3706 seq_printf(seq, "%6s: %7lu %7lu %4lu %4lu %4lu %5lu %10lu %9lu " 3706 seq_printf(seq, "%6s: %7llu %7llu %4llu %4llu %4llu %5llu %10llu %9llu "
3707 "%8lu %7lu %4lu %4lu %4lu %5lu %7lu %10lu\n", 3707 "%8llu %7llu %4llu %4llu %4llu %5llu %7llu %10llu\n",
3708 dev->name, stats->rx_bytes, stats->rx_packets, 3708 dev->name, stats->rx_bytes, stats->rx_packets,
3709 stats->rx_errors, 3709 stats->rx_errors,
3710 stats->rx_dropped + stats->rx_missed_errors, 3710 stats->rx_dropped + stats->rx_missed_errors,
@@ -5281,18 +5281,21 @@ EXPORT_SYMBOL(dev_txq_stats_fold);
5281 * @dev: device to get statistics from 5281 * @dev: device to get statistics from
5282 * 5282 *
5283 * Get network statistics from device. The device driver may provide 5283 * Get network statistics from device. The device driver may provide
5284 * its own method by setting dev->netdev_ops->get_stats; otherwise 5284 * its own method by setting dev->netdev_ops->get_stats64 or
5285 * the internal statistics structure is used. 5285 * dev->netdev_ops->get_stats; otherwise the internal statistics
5286 * structure is used.
5286 */ 5287 */
5287const struct net_device_stats *dev_get_stats(struct net_device *dev) 5288const struct rtnl_link_stats64 *dev_get_stats(struct net_device *dev)
5288{ 5289{
5289 const struct net_device_ops *ops = dev->netdev_ops; 5290 const struct net_device_ops *ops = dev->netdev_ops;
5290 5291
5292 if (ops->ndo_get_stats64)
5293 return ops->ndo_get_stats64(dev);
5291 if (ops->ndo_get_stats) 5294 if (ops->ndo_get_stats)
5292 return ops->ndo_get_stats(dev); 5295 return (struct rtnl_link_stats64 *)ops->ndo_get_stats(dev);
5293 5296
5294 dev_txq_stats_fold(dev, &dev->stats); 5297 dev_txq_stats_fold(dev, &dev->stats);
5295 return &dev->stats; 5298 return &dev->stats64;
5296} 5299}
5297EXPORT_SYMBOL(dev_get_stats); 5300EXPORT_SYMBOL(dev_get_stats);
5298 5301