IB/mlx4: Do IBoE locking earlier when initializing the GID table
Updating the GID table under IBoE requires read/write from/to shared data structures. These data structures are protected with the device iboe lock. The flows that modify the GID table start from 1. Initializing the GID table 2. NETDEV events 3. INET or INET6 events This patch makes sure that the flow of initializing the GID table is consistent with the other two flows w.r.t on what step the lock is taken. Signed-off-by: Moni Shoua <monis@mellanox.co.il> Signed-off-by: Or Gerlitz <ogerlitz@mellanox.com> Signed-off-by: Roland Dreier <roland@purestorage.com>
This commit is contained in:
parent
4ce5a5744a
commit
ddf8bd3491
|
@ -1570,7 +1570,6 @@ static u8 mlx4_ib_get_dev_port(struct net_device *dev,
|
|||
rdma_vlan_dev_real_dev(dev) : dev;
|
||||
|
||||
iboe = &ibdev->iboe;
|
||||
spin_lock(&iboe->lock);
|
||||
|
||||
for (port = 1; port <= MLX4_MAX_PORTS; ++port)
|
||||
if ((netif_is_bond_master(real_dev) &&
|
||||
|
@ -1579,8 +1578,6 @@ static u8 mlx4_ib_get_dev_port(struct net_device *dev,
|
|||
(real_dev == iboe->netdevs[port - 1])))
|
||||
break;
|
||||
|
||||
spin_unlock(&iboe->lock);
|
||||
|
||||
if ((port == 0) || (port > MLX4_MAX_PORTS))
|
||||
return 0;
|
||||
else
|
||||
|
@ -1672,11 +1669,13 @@ static void mlx4_ib_set_default_gid(struct mlx4_ib_dev *ibdev,
|
|||
static int mlx4_ib_init_gid_table(struct mlx4_ib_dev *ibdev)
|
||||
{
|
||||
struct net_device *dev;
|
||||
struct mlx4_ib_iboe *iboe = &ibdev->iboe;
|
||||
|
||||
if (reset_gid_table(ibdev))
|
||||
return -1;
|
||||
|
||||
read_lock(&dev_base_lock);
|
||||
spin_lock(&iboe->lock);
|
||||
|
||||
for_each_netdev(&init_net, dev) {
|
||||
u8 port = mlx4_ib_get_dev_port(dev, ibdev);
|
||||
|
@ -1684,6 +1683,7 @@ static int mlx4_ib_init_gid_table(struct mlx4_ib_dev *ibdev)
|
|||
mlx4_ib_get_dev_addr(dev, ibdev, port);
|
||||
}
|
||||
|
||||
spin_unlock(&iboe->lock);
|
||||
read_unlock(&dev_base_lock);
|
||||
|
||||
return 0;
|
||||
|
|
Loading…
Reference in New Issue