]> git.baikalelectronics.ru Git - kernel.git/commitdiff
net/mlx5: E-Switch Make cleanup sequence mirror of init
authorParav Pandit <parav@nvidia.com>
Tue, 2 Mar 2021 19:39:01 +0000 (21:39 +0200)
committerSaeed Mahameed <saeedm@nvidia.com>
Wed, 14 Apr 2021 18:02:35 +0000 (11:02 -0700)
Make cleanup sequence mirror of init sequence for cleaning up reps
and freeing vports.

Also when reps initialization fails, there is no need to perform reps
cleanup.

Signed-off-by: Parav Pandit <parav@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
drivers/net/ethernet/mellanox/mlx5/core/eswitch.c

index b3bc82e419b64c81a92540d11b7a17ece8b31392..9009574372fcb330d9d7c6b069c09ef48efd061d 100644 (file)
@@ -1856,7 +1856,6 @@ int mlx5_eswitch_init(struct mlx5_core_dev *dev)
 abort:
        if (esw->work_queue)
                destroy_workqueue(esw->work_queue);
-       esw_offloads_cleanup_reps(esw);
        kfree(esw->vports);
        kfree(esw);
        return err;
@@ -1871,7 +1870,6 @@ void mlx5_eswitch_cleanup(struct mlx5_eswitch *esw)
 
        esw->dev->priv.eswitch = NULL;
        destroy_workqueue(esw->work_queue);
-       esw_offloads_cleanup_reps(esw);
        mutex_destroy(&esw->state_lock);
        WARN_ON(!xa_empty(&esw->offloads.vhca_map));
        xa_destroy(&esw->offloads.vhca_map);
@@ -1879,6 +1877,7 @@ void mlx5_eswitch_cleanup(struct mlx5_eswitch *esw)
        mlx5e_mod_hdr_tbl_destroy(&esw->offloads.mod_hdr);
        mutex_destroy(&esw->offloads.encap_tbl_lock);
        mutex_destroy(&esw->offloads.decap_tbl_lock);
+       esw_offloads_cleanup_reps(esw);
        kfree(esw->vports);
        kfree(esw);
 }