RDMA/mlx5: Convert mlx5_ib to use auxiliary bus
[linux-2.6-microblaze.git] / drivers / net / ethernet / mellanox / mlx5 / core / lag.c
index e4d4de1..325f32b 100644 (file)
@@ -243,24 +243,30 @@ static bool mlx5_lag_check_prereq(struct mlx5_lag *ldev)
 #endif
 }
 
-static void mlx5_lag_add_ib_devices(struct mlx5_lag *ldev)
+static void mlx5_lag_add_devices(struct mlx5_lag *ldev)
 {
        int i;
 
-       for (i = 0; i < MLX5_MAX_PORTS; i++)
-               if (ldev->pf[i].dev)
-                       mlx5_add_dev_by_protocol(ldev->pf[i].dev,
-                                                MLX5_INTERFACE_PROTOCOL_IB);
+       for (i = 0; i < MLX5_MAX_PORTS; i++) {
+               if (!ldev->pf[i].dev)
+                       continue;
+
+               ldev->pf[i].dev->priv.flags &= ~MLX5_PRIV_FLAGS_DISABLE_IB_ADEV;
+               mlx5_rescan_drivers_locked(ldev->pf[i].dev);
+       }
 }
 
-static void mlx5_lag_remove_ib_devices(struct mlx5_lag *ldev)
+static void mlx5_lag_remove_devices(struct mlx5_lag *ldev)
 {
        int i;
 
-       for (i = 0; i < MLX5_MAX_PORTS; i++)
-               if (ldev->pf[i].dev)
-                       mlx5_remove_dev_by_protocol(ldev->pf[i].dev,
-                                                   MLX5_INTERFACE_PROTOCOL_IB);
+       for (i = 0; i < MLX5_MAX_PORTS; i++) {
+               if (!ldev->pf[i].dev)
+                       continue;
+
+               ldev->pf[i].dev->priv.flags |= MLX5_PRIV_FLAGS_DISABLE_IB_ADEV;
+               mlx5_rescan_drivers_locked(ldev->pf[i].dev);
+       }
 }
 
 static void mlx5_do_bond(struct mlx5_lag *ldev)
@@ -290,20 +296,21 @@ static void mlx5_do_bond(struct mlx5_lag *ldev)
 #endif
 
                if (roce_lag)
-                       mlx5_lag_remove_ib_devices(ldev);
+                       mlx5_lag_remove_devices(ldev);
 
                err = mlx5_activate_lag(ldev, &tracker,
                                        roce_lag ? MLX5_LAG_FLAG_ROCE :
                                        MLX5_LAG_FLAG_SRIOV);
                if (err) {
                        if (roce_lag)
-                               mlx5_lag_add_ib_devices(ldev);
+                               mlx5_lag_add_devices(ldev);
 
                        return;
                }
 
                if (roce_lag) {
-                       mlx5_add_dev_by_protocol(dev0, MLX5_INTERFACE_PROTOCOL_IB);
+                       dev0->priv.flags &= ~MLX5_PRIV_FLAGS_DISABLE_IB_ADEV;
+                       mlx5_rescan_drivers_locked(dev0);
                        mlx5_nic_vport_enable_roce(dev1);
                }
        } else if (do_bond && __mlx5_lag_is_active(ldev)) {
@@ -312,7 +319,8 @@ static void mlx5_do_bond(struct mlx5_lag *ldev)
                roce_lag = __mlx5_lag_is_roce(ldev);
 
                if (roce_lag) {
-                       mlx5_remove_dev_by_protocol(dev0, MLX5_INTERFACE_PROTOCOL_IB);
+                       dev0->priv.flags |= MLX5_PRIV_FLAGS_DISABLE_IB_ADEV;
+                       mlx5_rescan_drivers_locked(dev0);
                        mlx5_nic_vport_disable_roce(dev1);
                }
 
@@ -321,7 +329,7 @@ static void mlx5_do_bond(struct mlx5_lag *ldev)
                        return;
 
                if (roce_lag)
-                       mlx5_lag_add_ib_devices(ldev);
+                       mlx5_lag_add_devices(ldev);
        }
 }