netdev: introduce dev_get_stats()
In order for the network device ops get_stats call to be immutable, the handling of the default internal network device stats block has to be changed. Add a new helper function which replaces the old use of internal_get_stats. Note: change return code to make it clear that the caller should not go changing the returned statistics. Signed-off-by: Stephen Hemminger <shemminger@vyatta.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
d314774cf2
commit
eeda3fd64f
@@ -67,7 +67,6 @@ static void appldata_get_net_sum_data(void *data)
|
||||
int i;
|
||||
struct appldata_net_sum_data *net_data;
|
||||
struct net_device *dev;
|
||||
struct net_device_stats *stats;
|
||||
unsigned long rx_packets, tx_packets, rx_bytes, tx_bytes, rx_errors,
|
||||
tx_errors, rx_dropped, tx_dropped, collisions;
|
||||
|
||||
@@ -86,7 +85,8 @@ static void appldata_get_net_sum_data(void *data)
|
||||
collisions = 0;
|
||||
read_lock(&dev_base_lock);
|
||||
for_each_netdev(&init_net, dev) {
|
||||
stats = dev->get_stats(dev);
|
||||
const struct net_device_stats *stats = dev_get_stats(dev);
|
||||
|
||||
rx_packets += stats->rx_packets;
|
||||
tx_packets += stats->tx_packets;
|
||||
rx_bytes += stats->rx_bytes;
|
||||
|
||||
Reference in New Issue
Block a user