aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/netdevice.h
diff options
context:
space:
mode:
authorEric Dumazet <eric.dumazet@gmail.com>2010-07-07 17:58:56 -0400
committerDavid S. Miller <davem@davemloft.net>2010-07-07 17:58:56 -0400
commit28172739f0a276eb8d6ca917b3974c2edb036da3 (patch)
treeb1dc00cfa20c209992e247c6f73601f609f9ca3b /include/linux/netdevice.h
parent217d32dc5f299c483ca0d3c8cc6811c72c0339c4 (diff)
net: fix 64 bit counters on 32 bit arches
There is a small possibility that a reader gets incorrect values on 32 bit arches. SNMP applications could catch incorrect counters when a 32bit high part is changed by another stats consumer/provider. One way to solve this is to add a rtnl_link_stats64 param to all ndo_get_stats64() methods, and also add such a parameter to dev_get_stats(). Rule is that we are not allowed to use dev->stats64 as a temporary storage for 64bit stats, but a caller provided area (usually on stack) Old drivers (only providing get_stats() method) need no changes. Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/netdevice.h')
-rw-r--r--include/linux/netdevice.h12
1 files changed, 8 insertions, 4 deletions
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 4d27368674db..60de65316fdb 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -666,7 +666,8 @@ struct netdev_rx_queue {
666 * Callback uses when the transmitter has not made any progress 666 * Callback uses when the transmitter has not made any progress
667 * for dev->watchdog ticks. 667 * for dev->watchdog ticks.
668 * 668 *
669 * struct rtnl_link_stats64* (*ndo_get_stats64)(struct net_device *dev); 669 * struct rtnl_link_stats64* (*ndo_get_stats64)(struct net_device *dev
670 * struct rtnl_link_stats64 *storage);
670 * struct net_device_stats* (*ndo_get_stats)(struct net_device *dev); 671 * struct net_device_stats* (*ndo_get_stats)(struct net_device *dev);
671 * Called when a user wants to get the network device usage 672 * Called when a user wants to get the network device usage
672 * statistics. Drivers must do one of the following: 673 * statistics. Drivers must do one of the following:
@@ -733,7 +734,8 @@ struct net_device_ops {
733 struct neigh_parms *); 734 struct neigh_parms *);
734 void (*ndo_tx_timeout) (struct net_device *dev); 735 void (*ndo_tx_timeout) (struct net_device *dev);
735 736
736 struct rtnl_link_stats64* (*ndo_get_stats64)(struct net_device *dev); 737 struct rtnl_link_stats64* (*ndo_get_stats64)(struct net_device *dev,
738 struct rtnl_link_stats64 *storage);
737 struct net_device_stats* (*ndo_get_stats)(struct net_device *dev); 739 struct net_device_stats* (*ndo_get_stats)(struct net_device *dev);
738 740
739 void (*ndo_vlan_rx_register)(struct net_device *dev, 741 void (*ndo_vlan_rx_register)(struct net_device *dev,
@@ -2139,8 +2141,10 @@ extern void netdev_features_change(struct net_device *dev);
2139/* Load a device via the kmod */ 2141/* Load a device via the kmod */
2140extern void dev_load(struct net *net, const char *name); 2142extern void dev_load(struct net *net, const char *name);
2141extern void dev_mcast_init(void); 2143extern void dev_mcast_init(void);
2142extern const struct rtnl_link_stats64 *dev_get_stats(struct net_device *dev); 2144extern const struct rtnl_link_stats64 *dev_get_stats(struct net_device *dev,
2143extern void dev_txq_stats_fold(const struct net_device *dev, struct net_device_stats *stats); 2145 struct rtnl_link_stats64 *storage);
2146extern void dev_txq_stats_fold(const struct net_device *dev,
2147 struct net_device_stats *stats);
2144 2148
2145extern int netdev_max_backlog; 2149extern int netdev_max_backlog;
2146extern int netdev_tstamp_prequeue; 2150extern int netdev_tstamp_prequeue;