aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMoni Shoua <monis@mellanox.co.il>2014-02-05 08:13:00 -0500
committerRoland Dreier <roland@purestorage.com>2014-02-13 17:31:08 -0500
commitddf8bd349115c2bc85a62e3d94018c9976ac72f7 (patch)
tree24dd0a015fae802e2d5c22997ca356b9c727828d
parent4ce5a5744a2f5479e58c6788cbe3987b8071b62e (diff)
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>
-rw-r--r--drivers/infiniband/hw/mlx4/main.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c
index 93f492f62997..3bafd0bebd4c 100644
--- a/drivers/infiniband/hw/mlx4/main.c
+++ b/drivers/infiniband/hw/mlx4/main.c
@@ -1570,7 +1570,6 @@ static u8 mlx4_ib_get_dev_port(struct net_device *dev,
1570 rdma_vlan_dev_real_dev(dev) : dev; 1570 rdma_vlan_dev_real_dev(dev) : dev;
1571 1571
1572 iboe = &ibdev->iboe; 1572 iboe = &ibdev->iboe;
1573 spin_lock(&iboe->lock);
1574 1573
1575 for (port = 1; port <= MLX4_MAX_PORTS; ++port) 1574 for (port = 1; port <= MLX4_MAX_PORTS; ++port)
1576 if ((netif_is_bond_master(real_dev) && 1575 if ((netif_is_bond_master(real_dev) &&
@@ -1579,8 +1578,6 @@ static u8 mlx4_ib_get_dev_port(struct net_device *dev,
1579 (real_dev == iboe->netdevs[port - 1]))) 1578 (real_dev == iboe->netdevs[port - 1])))
1580 break; 1579 break;
1581 1580
1582 spin_unlock(&iboe->lock);
1583
1584 if ((port == 0) || (port > MLX4_MAX_PORTS)) 1581 if ((port == 0) || (port > MLX4_MAX_PORTS))
1585 return 0; 1582 return 0;
1586 else 1583 else
@@ -1672,11 +1669,13 @@ static void mlx4_ib_set_default_gid(struct mlx4_ib_dev *ibdev,
1672static int mlx4_ib_init_gid_table(struct mlx4_ib_dev *ibdev) 1669static int mlx4_ib_init_gid_table(struct mlx4_ib_dev *ibdev)
1673{ 1670{
1674 struct net_device *dev; 1671 struct net_device *dev;
1672 struct mlx4_ib_iboe *iboe = &ibdev->iboe;
1675 1673
1676 if (reset_gid_table(ibdev)) 1674 if (reset_gid_table(ibdev))
1677 return -1; 1675 return -1;
1678 1676
1679 read_lock(&dev_base_lock); 1677 read_lock(&dev_base_lock);
1678 spin_lock(&iboe->lock);
1680 1679
1681 for_each_netdev(&init_net, dev) { 1680 for_each_netdev(&init_net, dev) {
1682 u8 port = mlx4_ib_get_dev_port(dev, ibdev); 1681 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 mlx4_ib_get_dev_addr(dev, ibdev, port); 1683 mlx4_ib_get_dev_addr(dev, ibdev, port);
1685 } 1684 }
1686 1685
1686 spin_unlock(&iboe->lock);
1687 read_unlock(&dev_base_lock); 1687 read_unlock(&dev_base_lock);
1688 1688
1689 return 0; 1689 return 0;