提交 ddf8bd34 编写于 作者: M Moni Shoua 提交者: Roland Dreier

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: NMoni Shoua <monis@mellanox.co.il>
Signed-off-by: NOr Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: NRoland Dreier <roland@purestorage.com>
上级 4ce5a574
...@@ -1570,7 +1570,6 @@ static u8 mlx4_ib_get_dev_port(struct net_device *dev, ...@@ -1570,7 +1570,6 @@ static u8 mlx4_ib_get_dev_port(struct net_device *dev,
rdma_vlan_dev_real_dev(dev) : dev; rdma_vlan_dev_real_dev(dev) : dev;
iboe = &ibdev->iboe; iboe = &ibdev->iboe;
spin_lock(&iboe->lock);
for (port = 1; port <= MLX4_MAX_PORTS; ++port) for (port = 1; port <= MLX4_MAX_PORTS; ++port)
if ((netif_is_bond_master(real_dev) && if ((netif_is_bond_master(real_dev) &&
...@@ -1579,8 +1578,6 @@ static u8 mlx4_ib_get_dev_port(struct net_device *dev, ...@@ -1579,8 +1578,6 @@ static u8 mlx4_ib_get_dev_port(struct net_device *dev,
(real_dev == iboe->netdevs[port - 1]))) (real_dev == iboe->netdevs[port - 1])))
break; break;
spin_unlock(&iboe->lock);
if ((port == 0) || (port > MLX4_MAX_PORTS)) if ((port == 0) || (port > MLX4_MAX_PORTS))
return 0; return 0;
else else
...@@ -1672,11 +1669,13 @@ static void mlx4_ib_set_default_gid(struct mlx4_ib_dev *ibdev, ...@@ -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) static int mlx4_ib_init_gid_table(struct mlx4_ib_dev *ibdev)
{ {
struct net_device *dev; struct net_device *dev;
struct mlx4_ib_iboe *iboe = &ibdev->iboe;
if (reset_gid_table(ibdev)) if (reset_gid_table(ibdev))
return -1; return -1;
read_lock(&dev_base_lock); read_lock(&dev_base_lock);
spin_lock(&iboe->lock);
for_each_netdev(&init_net, dev) { for_each_netdev(&init_net, dev) {
u8 port = mlx4_ib_get_dev_port(dev, ibdev); 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) ...@@ -1684,6 +1683,7 @@ static int mlx4_ib_init_gid_table(struct mlx4_ib_dev *ibdev)
mlx4_ib_get_dev_addr(dev, ibdev, port); mlx4_ib_get_dev_addr(dev, ibdev, port);
} }
spin_unlock(&iboe->lock);
read_unlock(&dev_base_lock); read_unlock(&dev_base_lock);
return 0; return 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册