Skip to content

Commit 22f4fbd

Browse files
Eric Dumazetdavem330
authored andcommitted
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: Eric Dumazet <[email protected]> Acked-by: Roland Dreier <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent bba14de commit 22f4fbd

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

drivers/infiniband/core/addr.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,16 +130,16 @@ int rdma_translate_ip(struct sockaddr *addr, struct rdma_dev_addr *dev_addr)
130130

131131
#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
132132
case AF_INET6:
133-
read_lock(&dev_base_lock);
134-
for_each_netdev(&init_net, dev) {
133+
rcu_read_lock();
134+
for_each_netdev_rcu(&init_net, dev) {
135135
if (ipv6_chk_addr(&init_net,
136136
&((struct sockaddr_in6 *) addr)->sin6_addr,
137137
dev, 1)) {
138138
ret = rdma_copy_addr(dev_addr, dev, NULL);
139139
break;
140140
}
141141
}
142-
read_unlock(&dev_base_lock);
142+
rcu_read_unlock();
143143
break;
144144
#endif
145145
}

drivers/infiniband/hw/mlx4/main.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -848,8 +848,8 @@ static int update_ipv6_gids(struct mlx4_ib_dev *dev, int port, int clear)
848848
goto out;
849849
}
850850

851-
read_lock(&dev_base_lock);
852-
for_each_netdev(&init_net, tmp) {
851+
rcu_read_lock();
852+
for_each_netdev_rcu(&init_net, tmp) {
853853
if (ndev && (tmp == ndev || rdma_vlan_dev_real_dev(tmp) == ndev)) {
854854
gid.global.subnet_prefix = cpu_to_be64(0xfe80000000000000LL);
855855
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)
884884
}
885885
}
886886
}
887-
read_unlock(&dev_base_lock);
887+
rcu_read_unlock();
888888

889889
for (i = 0; i < 128; ++i)
890890
if (!hits[i]) {

0 commit comments

Comments
 (0)