aboutsummaryrefslogtreecommitdiffstats
path: root/net/rose
diff options
context:
space:
mode:
authorEric Dumazet <eric.dumazet@gmail.com>2009-11-04 08:43:23 -0500
committerDavid S. Miller <davem@davemloft.net>2009-11-04 08:43:23 -0500
commitc6d14c84566d6b70ad9dc1618db0dec87cca9300 (patch)
tree5ec75245cfda4d61e6b4506b6217f047ff4af01a /net/rose
parentd0075634cf9d288988f57392a1f132d2053af961 (diff)
net: Introduce for_each_netdev_rcu() iterator
Adds RCU management to the list of netdevices. Convert some for_each_netdev() users to RCU version, if it can avoid read_lock-ing dev_base_lock Ie: read_lock(&dev_base_loack); for_each_netdev(net, dev) some_action(); read_unlock(&dev_base_lock); becomes : rcu_read_lock(); for_each_netdev_rcu(net, dev) some_action(); rcu_read_unlock(); Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/rose')
-rw-r--r--net/rose/rose_route.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/net/rose/rose_route.c b/net/rose/rose_route.c
index 9478d9b3d977..d936226916f2 100644
--- a/net/rose/rose_route.c
+++ b/net/rose/rose_route.c
@@ -600,13 +600,13 @@ struct net_device *rose_dev_first(void)
600{ 600{
601 struct net_device *dev, *first = NULL; 601 struct net_device *dev, *first = NULL;
602 602
603 read_lock(&dev_base_lock); 603 rcu_read_lock();
604 for_each_netdev(&init_net, dev) { 604 for_each_netdev_rcu(&init_net, dev) {
605 if ((dev->flags & IFF_UP) && dev->type == ARPHRD_ROSE) 605 if ((dev->flags & IFF_UP) && dev->type == ARPHRD_ROSE)
606 if (first == NULL || strncmp(dev->name, first->name, 3) < 0) 606 if (first == NULL || strncmp(dev->name, first->name, 3) < 0)
607 first = dev; 607 first = dev;
608 } 608 }
609 read_unlock(&dev_base_lock); 609 rcu_read_unlock();
610 610
611 return first; 611 return first;
612} 612}
@@ -618,8 +618,8 @@ struct net_device *rose_dev_get(rose_address *addr)
618{ 618{
619 struct net_device *dev; 619 struct net_device *dev;
620 620
621 read_lock(&dev_base_lock); 621 rcu_read_lock();
622 for_each_netdev(&init_net, dev) { 622 for_each_netdev_rcu(&init_net, dev) {
623 if ((dev->flags & IFF_UP) && dev->type == ARPHRD_ROSE && rosecmp(addr, (rose_address *)dev->dev_addr) == 0) { 623 if ((dev->flags & IFF_UP) && dev->type == ARPHRD_ROSE && rosecmp(addr, (rose_address *)dev->dev_addr) == 0) {
624 dev_hold(dev); 624 dev_hold(dev);
625 goto out; 625 goto out;
@@ -627,7 +627,7 @@ struct net_device *rose_dev_get(rose_address *addr)
627 } 627 }
628 dev = NULL; 628 dev = NULL;
629out: 629out:
630 read_unlock(&dev_base_lock); 630 rcu_read_unlock();
631 return dev; 631 return dev;
632} 632}
633 633
@@ -635,14 +635,14 @@ static int rose_dev_exists(rose_address *addr)
635{ 635{
636 struct net_device *dev; 636 struct net_device *dev;
637 637
638 read_lock(&dev_base_lock); 638 rcu_read_lock();
639 for_each_netdev(&init_net, dev) { 639 for_each_netdev_rcu(&init_net, dev) {
640 if ((dev->flags & IFF_UP) && dev->type == ARPHRD_ROSE && rosecmp(addr, (rose_address *)dev->dev_addr) == 0) 640 if ((dev->flags & IFF_UP) && dev->type == ARPHRD_ROSE && rosecmp(addr, (rose_address *)dev->dev_addr) == 0)
641 goto out; 641 goto out;
642 } 642 }
643 dev = NULL; 643 dev = NULL;
644out: 644out:
645 read_unlock(&dev_base_lock); 645 rcu_read_unlock();
646 return dev != NULL; 646 return dev != NULL;
647} 647}
648 648