aboutsummaryrefslogtreecommitdiffstats
path: root/net/core
diff options
context:
space:
mode:
authorEric Dumazet <eric.dumazet@gmail.com>2010-06-07 07:42:13 -0400
committerDavid S. Miller <davem@davemloft.net>2010-06-08 01:49:25 -0400
commitbb69ae049fcc986fcd742eb90ca0d44a7a49c9f1 (patch)
tree22f9aa03f9f59139ece8ef1484fe5d4a5b86bd47 /net/core
parent6e8b11b43b0c2e901734e2cdd70c6e325a90c4ef (diff)
anycast: Some RCU conversions
- dev_get_by_flags() changed to dev_get_by_flags_rcu() - ipv6_sock_ac_join() dont touch dev & idev refcounts - ipv6_sock_ac_drop() dont touch dev & idev refcounts - ipv6_sock_ac_close() dont touch dev & idev refcounts - ipv6_dev_ac_dec() dount touch idev refcount - ipv6_chk_acast_addr() dont touch idev refcount Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com> CC: Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/core')
-rw-r--r--net/core/dev.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/net/core/dev.c b/net/core/dev.c
index c8d127718ff1..6f330cee79a6 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -803,35 +803,31 @@ struct net_device *dev_getfirstbyhwtype(struct net *net, unsigned short type)
803EXPORT_SYMBOL(dev_getfirstbyhwtype); 803EXPORT_SYMBOL(dev_getfirstbyhwtype);
804 804
805/** 805/**
806 * dev_get_by_flags - find any device with given flags 806 * dev_get_by_flags_rcu - find any device with given flags
807 * @net: the applicable net namespace 807 * @net: the applicable net namespace
808 * @if_flags: IFF_* values 808 * @if_flags: IFF_* values
809 * @mask: bitmask of bits in if_flags to check 809 * @mask: bitmask of bits in if_flags to check
810 * 810 *
811 * Search for any interface with the given flags. Returns NULL if a device 811 * Search for any interface with the given flags. Returns NULL if a device
812 * is not found or a pointer to the device. The device returned has 812 * is not found or a pointer to the device. Must be called inside
813 * had a reference added and the pointer is safe until the user calls 813 * rcu_read_lock(), and result refcount is unchanged.
814 * dev_put to indicate they have finished with it.
815 */ 814 */
816 815
817struct net_device *dev_get_by_flags(struct net *net, unsigned short if_flags, 816struct net_device *dev_get_by_flags_rcu(struct net *net, unsigned short if_flags,
818 unsigned short mask) 817 unsigned short mask)
819{ 818{
820 struct net_device *dev, *ret; 819 struct net_device *dev, *ret;
821 820
822 ret = NULL; 821 ret = NULL;
823 rcu_read_lock();
824 for_each_netdev_rcu(net, dev) { 822 for_each_netdev_rcu(net, dev) {
825 if (((dev->flags ^ if_flags) & mask) == 0) { 823 if (((dev->flags ^ if_flags) & mask) == 0) {
826 dev_hold(dev);
827 ret = dev; 824 ret = dev;
828 break; 825 break;
829 } 826 }
830 } 827 }
831 rcu_read_unlock();
832 return ret; 828 return ret;
833} 829}
834EXPORT_SYMBOL(dev_get_by_flags); 830EXPORT_SYMBOL(dev_get_by_flags_rcu);
835 831
836/** 832/**
837 * dev_valid_name - check if name is okay for network device 833 * dev_valid_name - check if name is okay for network device