net/mlx5: Disable eswitch as the first thing in mlx5_unload()
authorJiri Pirko <jiri@nvidia.com>
Wed, 13 Sep 2023 07:12:33 +0000 (09:12 +0200)
committerDavid S. Miller <davem@davemloft.net>
Sun, 17 Sep 2023 13:01:46 +0000 (14:01 +0100)
The eswitch disable call does removal of all representors. Do that
before clearing the SF device table and maintain the same flow as during
SF devlink port removal, where the representor is removed before
the actual SF is removed.

Signed-off-by: Jiri Pirko <jiri@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlx5/core/main.c

index 1556196..d17c9c3 100644 (file)
@@ -1405,9 +1405,9 @@ err_irq_table:
 
 static void mlx5_unload(struct mlx5_core_dev *dev)
 {
+       mlx5_eswitch_disable(dev->priv.eswitch);
        mlx5_devlink_traps_unregister(priv_to_devlink(dev));
        mlx5_sf_dev_table_destroy(dev);
-       mlx5_eswitch_disable(dev->priv.eswitch);
        mlx5_sriov_detach(dev);
        mlx5_lag_remove_mdev(dev);
        mlx5_ec_cleanup(dev);