Commit e576b9ef authored by stephen hemminger's avatar stephen hemminger Committed by David S. Miller

s390: use RCU to walk list of network devices

This is similar to other cases where for_each_netdev_rcu
can be used when gathering information.

By inspection, don't have platform or cross-build environment
to validate.
Signed-off-by: default avatarStephen Hemminger <shemminger@vyatta.com>
Acked-by: default avatarEric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent f1e9016d
...@@ -83,8 +83,9 @@ static void appldata_get_net_sum_data(void *data) ...@@ -83,8 +83,9 @@ static void appldata_get_net_sum_data(void *data)
rx_dropped = 0; rx_dropped = 0;
tx_dropped = 0; tx_dropped = 0;
collisions = 0; collisions = 0;
read_lock(&dev_base_lock);
for_each_netdev(&init_net, dev) { rcu_read_lock();
for_each_netdev_rcu(&init_net, dev) {
const struct net_device_stats *stats = dev_get_stats(dev); const struct net_device_stats *stats = dev_get_stats(dev);
rx_packets += stats->rx_packets; rx_packets += stats->rx_packets;
...@@ -98,7 +99,8 @@ static void appldata_get_net_sum_data(void *data) ...@@ -98,7 +99,8 @@ static void appldata_get_net_sum_data(void *data)
collisions += stats->collisions; collisions += stats->collisions;
i++; i++;
} }
read_unlock(&dev_base_lock); rcu_read_unlock();
net_data->nr_interfaces = i; net_data->nr_interfaces = i;
net_data->rx_packets = rx_packets; net_data->rx_packets = rx_packets;
net_data->tx_packets = tx_packets; net_data->tx_packets = tx_packets;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment