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

net: use rcu for network scheduler API

Use RCU to walk list of network devices in qdisc dump.
This could be optimized for large number of devices.
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 9e067597
...@@ -1279,9 +1279,10 @@ static int tc_dump_qdisc(struct sk_buff *skb, struct netlink_callback *cb) ...@@ -1279,9 +1279,10 @@ static int tc_dump_qdisc(struct sk_buff *skb, struct netlink_callback *cb)
s_idx = cb->args[0]; s_idx = cb->args[0];
s_q_idx = q_idx = cb->args[1]; s_q_idx = q_idx = cb->args[1];
read_lock(&dev_base_lock);
rcu_read_lock();
idx = 0; idx = 0;
for_each_netdev(&init_net, dev) { for_each_netdev_rcu(&init_net, dev) {
struct netdev_queue *dev_queue; struct netdev_queue *dev_queue;
if (idx < s_idx) if (idx < s_idx)
...@@ -1302,7 +1303,7 @@ static int tc_dump_qdisc(struct sk_buff *skb, struct netlink_callback *cb) ...@@ -1302,7 +1303,7 @@ static int tc_dump_qdisc(struct sk_buff *skb, struct netlink_callback *cb)
} }
done: done:
read_unlock(&dev_base_lock); rcu_read_unlock();
cb->args[0] = idx; cb->args[0] = idx;
cb->args[1] = q_idx; cb->args[1] = q_idx;
......
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