Commit 655b2aae authored by Moni Shoua's avatar Moni Shoua Committed by Roland Dreier

IB/mlx4: Reorder steps in RoCE GID table initialization

There's no need to reset the gid table twice and we need to do it only
for Ethernet ports. Also, no need to actively scan ndetdevs since it's
being done immediatly after we register netdev notifiers.
Signed-off-by: default avatarMoni Shoua <monis@mellanox.com>
Signed-off-by: default avatarOr Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: default avatarRoland Dreier <roland@purestorage.com>
parent f5c4834d
......@@ -1730,24 +1730,33 @@ static int mlx4_ib_init_gid_table(struct mlx4_ib_dev *ibdev)
struct net_device *dev;
struct mlx4_ib_iboe *iboe = &ibdev->iboe;
int i;
int err = 0;
for (i = 1; i <= ibdev->num_ports; ++i)
if (reset_gid_table(ibdev, i))
return -1;
for (i = 1; i <= ibdev->num_ports; ++i) {
if (rdma_port_get_link_layer(&ibdev->ib_dev, i) ==
IB_LINK_LAYER_ETHERNET) {
err = reset_gid_table(ibdev, i);
if (err)
goto out;
}
}
read_lock(&dev_base_lock);
spin_lock(&iboe->lock);
for_each_netdev(&init_net, dev) {
u8 port = mlx4_ib_get_dev_port(dev, ibdev);
if (port)
/* port will be non-zero only for ETH ports */
if (port) {
mlx4_ib_set_default_gid(ibdev, dev, port);
mlx4_ib_get_dev_addr(dev, ibdev, port);
}
}
spin_unlock(&iboe->lock);
read_unlock(&dev_base_lock);
return 0;
out:
return err;
}
static void mlx4_ib_scan_netdevs(struct mlx4_ib_dev *ibdev,
......@@ -2202,12 +2211,8 @@ static void *mlx4_ib_add(struct mlx4_dev *dev)
}
}
#endif
for (i = 1 ; i <= ibdev->num_ports ; ++i)
reset_gid_table(ibdev, i);
rtnl_lock();
mlx4_ib_scan_netdevs(ibdev, NULL, 0);
rtnl_unlock();
mlx4_ib_init_gid_table(ibdev);
if (mlx4_ib_init_gid_table(ibdev))
goto err_notif;
}
for (j = 0; j < ARRAY_SIZE(mlx4_class_attributes); ++j) {
......
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