mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-24 07:31:41 +00:00
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>
This commit is contained in:
parent
217d32dc5f
commit
28172739f0
18 changed files with 84 additions and 66 deletions
|
@ -666,7 +666,8 @@ struct netdev_rx_queue {
|
|||
* Callback uses when the transmitter has not made any progress
|
||||
* for dev->watchdog ticks.
|
||||
*
|
||||
* struct rtnl_link_stats64* (*ndo_get_stats64)(struct net_device *dev);
|
||||
* struct rtnl_link_stats64* (*ndo_get_stats64)(struct net_device *dev
|
||||
* struct rtnl_link_stats64 *storage);
|
||||
* struct net_device_stats* (*ndo_get_stats)(struct net_device *dev);
|
||||
* Called when a user wants to get the network device usage
|
||||
* statistics. Drivers must do one of the following:
|
||||
|
@ -733,7 +734,8 @@ struct net_device_ops {
|
|||
struct neigh_parms *);
|
||||
void (*ndo_tx_timeout) (struct net_device *dev);
|
||||
|
||||
struct rtnl_link_stats64* (*ndo_get_stats64)(struct net_device *dev);
|
||||
struct rtnl_link_stats64* (*ndo_get_stats64)(struct net_device *dev,
|
||||
struct rtnl_link_stats64 *storage);
|
||||
struct net_device_stats* (*ndo_get_stats)(struct net_device *dev);
|
||||
|
||||
void (*ndo_vlan_rx_register)(struct net_device *dev,
|
||||
|
@ -2139,8 +2141,10 @@ extern void netdev_features_change(struct net_device *dev);
|
|||
/* Load a device via the kmod */
|
||||
extern void dev_load(struct net *net, const char *name);
|
||||
extern void dev_mcast_init(void);
|
||||
extern const struct rtnl_link_stats64 *dev_get_stats(struct net_device *dev);
|
||||
extern void dev_txq_stats_fold(const struct net_device *dev, struct net_device_stats *stats);
|
||||
extern const struct rtnl_link_stats64 *dev_get_stats(struct net_device *dev,
|
||||
struct rtnl_link_stats64 *storage);
|
||||
extern void dev_txq_stats_fold(const struct net_device *dev,
|
||||
struct net_device_stats *stats);
|
||||
|
||||
extern int netdev_max_backlog;
|
||||
extern int netdev_tstamp_prequeue;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue