Commit 22f4fbd9 authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller

infiniband: remove dev_base_lock use

dev_base_lock is the legacy way to lock the device list, and is planned
to disappear. (writers hold RTNL, readers hold RCU lock)

Convert rdma_translate_ip() and update_ipv6_gids() to RCU locking.
Signed-off-by: default avatarEric Dumazet <eric.dumazet@gmail.com>
Acked-by: default avatarRoland Dreier <rolandd@cisco.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent bba14de9
...@@ -130,8 +130,8 @@ int rdma_translate_ip(struct sockaddr *addr, struct rdma_dev_addr *dev_addr) ...@@ -130,8 +130,8 @@ int rdma_translate_ip(struct sockaddr *addr, struct rdma_dev_addr *dev_addr)
#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
case AF_INET6: case AF_INET6:
read_lock(&dev_base_lock); rcu_read_lock();
for_each_netdev(&init_net, dev) { for_each_netdev_rcu(&init_net, dev) {
if (ipv6_chk_addr(&init_net, if (ipv6_chk_addr(&init_net,
&((struct sockaddr_in6 *) addr)->sin6_addr, &((struct sockaddr_in6 *) addr)->sin6_addr,
dev, 1)) { dev, 1)) {
...@@ -139,7 +139,7 @@ int rdma_translate_ip(struct sockaddr *addr, struct rdma_dev_addr *dev_addr) ...@@ -139,7 +139,7 @@ int rdma_translate_ip(struct sockaddr *addr, struct rdma_dev_addr *dev_addr)
break; break;
} }
} }
read_unlock(&dev_base_lock); rcu_read_unlock();
break; break;
#endif #endif
} }
......
...@@ -848,8 +848,8 @@ static int update_ipv6_gids(struct mlx4_ib_dev *dev, int port, int clear) ...@@ -848,8 +848,8 @@ static int update_ipv6_gids(struct mlx4_ib_dev *dev, int port, int clear)
goto out; goto out;
} }
read_lock(&dev_base_lock); rcu_read_lock();
for_each_netdev(&init_net, tmp) { for_each_netdev_rcu(&init_net, tmp) {
if (ndev && (tmp == ndev || rdma_vlan_dev_real_dev(tmp) == ndev)) { if (ndev && (tmp == ndev || rdma_vlan_dev_real_dev(tmp) == ndev)) {
gid.global.subnet_prefix = cpu_to_be64(0xfe80000000000000LL); gid.global.subnet_prefix = cpu_to_be64(0xfe80000000000000LL);
vid = rdma_vlan_dev_vlan_id(tmp); vid = rdma_vlan_dev_vlan_id(tmp);
...@@ -884,7 +884,7 @@ static int update_ipv6_gids(struct mlx4_ib_dev *dev, int port, int clear) ...@@ -884,7 +884,7 @@ static int update_ipv6_gids(struct mlx4_ib_dev *dev, int port, int clear)
} }
} }
} }
read_unlock(&dev_base_lock); rcu_read_unlock();
for (i = 0; i < 128; ++i) for (i = 0; i < 128; ++i)
if (!hits[i]) { if (!hits[i]) {
......
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