net/mlx5: LAG and SRIOV cannot be used together
authorAviv Heller <avivh@mellanox.com>
Sun, 17 Apr 2016 16:32:13 +0000 (19:32 +0300)
committerLeon Romanovsky <leon@kernel.org>
Thu, 18 Aug 2016 15:49:56 +0000 (18:49 +0300)
Until support will be added for RoCE LAG SRIOV.

Signed-off-by: Aviv Heller <avivh@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
drivers/net/ethernet/mellanox/mlx5/core/lag.c
drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h
drivers/net/ethernet/mellanox/mlx5/core/sriov.c

index 952305054e16cb001fecd11e3822be81d62315c8..3cb570ac2b80cd6428b6c95e147ea2775c8f19af 100644 (file)
@@ -201,6 +201,12 @@ static void mlx5_do_bond(struct mlx5_lag *ldev)
        mutex_unlock(&lag_mutex);
 
        if (tracker.is_bonded && !mlx5_lag_is_bonded(ldev)) {
+               if (mlx5_sriov_is_enabled(dev0) ||
+                   mlx5_sriov_is_enabled(dev1)) {
+                       mlx5_core_warn(dev0, "LAG is not supported with SRIOV");
+                       return;
+               }
+
                for (i = 0; i < MLX5_MAX_PORTS; i++)
                        mlx5_remove_dev_by_protocol(ldev->pf[i].dev,
                                                    MLX5_INTERFACE_PROTOCOL_IB);
index e716996a8b92828a801ea39d33620d9eec1aad5c..8557435280c33f3b1744bf77794a8e33c3e2e437 100644 (file)
@@ -90,6 +90,7 @@ void mlx5_core_event(struct mlx5_core_dev *dev, enum mlx5_dev_event event,
 void mlx5_enter_error_state(struct mlx5_core_dev *dev);
 void mlx5_disable_device(struct mlx5_core_dev *dev);
 int mlx5_core_sriov_configure(struct pci_dev *dev, int num_vfs);
+bool mlx5_sriov_is_enabled(struct mlx5_core_dev *dev);
 int mlx5_core_enable_hca(struct mlx5_core_dev *dev, u16 func_id);
 int mlx5_core_disable_hca(struct mlx5_core_dev *dev, u16 func_id);
 int mlx5_wait_for_vf_pages(struct mlx5_core_dev *dev);
index 0680dfb4bb1eeff15b4c30a6fe3d0bb003ddaada..78e7892451831824abd5b50fe09005a02f527021 100644 (file)
 #include "eswitch.h"
 #endif
 
+bool mlx5_sriov_is_enabled(struct mlx5_core_dev *dev)
+{
+       struct mlx5_core_sriov *sriov = &dev->priv.sriov;
+
+       return !!sriov->num_vfs;
+}
+
 static void enable_vfs(struct mlx5_core_dev *dev, int num_vfs)
 {
        struct mlx5_core_sriov *sriov = &dev->priv.sriov;
@@ -144,6 +151,11 @@ int mlx5_core_sriov_configure(struct pci_dev *pdev, int num_vfs)
        if (!mlx5_core_is_pf(dev))
                return -EPERM;
 
+       if (num_vfs && mlx5_lag_is_active(dev)) {
+               mlx5_core_warn(dev, "can't turn sriov on while LAG is active");
+               return -EINVAL;
+       }
+
        mlx5_core_cleanup_vfs(dev);
 
        if (!num_vfs) {