net/mlx5: Warn for devlink reload when there are VFs alive
authorLama Kayal <lkayal@nvidia.com>
Sun, 1 Aug 2021 11:57:16 +0000 (14:57 +0300)
committerSaeed Mahameed <saeedm@nvidia.com>
Thu, 30 Sep 2021 23:19:01 +0000 (16:19 -0700)
When performing PF reload, VF can't communicate with FW until
it recovers and reloads as well.

Add a warning message when performing devlink reload while
VFs are still present. Thus, giving a notice of an unfavorable
behavior that might occur as a result of a consequential reloads
and cause interruption of VF recovery.

Signed-off-by: Lama Kayal <lkayal@nvidia.com>
Reviewed-by: Moshe Shemesh <moshe@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
drivers/net/ethernet/mellanox/mlx5/core/devlink.c

index d7576b6..b9a6cea 100644 (file)
@@ -136,6 +136,7 @@ static int mlx5_devlink_reload_down(struct devlink *devlink, bool netns_change,
                                    struct netlink_ext_ack *extack)
 {
        struct mlx5_core_dev *dev = devlink_priv(devlink);
+       struct pci_dev *pdev = dev->pdev;
        bool sf_dev_allocated;
 
        sf_dev_allocated = mlx5_sf_dev_allocated(dev);
@@ -153,6 +154,10 @@ static int mlx5_devlink_reload_down(struct devlink *devlink, bool netns_change,
                return -EOPNOTSUPP;
        }
 
+       if (pci_num_vf(pdev)) {
+               NL_SET_ERR_MSG_MOD(extack, "reload while VFs are present is unfavorable");
+       }
+
        switch (action) {
        case DEVLINK_RELOAD_ACTION_DRIVER_REINIT:
                mlx5_unload_one(dev);