From 3963403fd564090f9d1439595b29b147f9c6a960 Mon Sep 17 00:00:00 2001 From: Alaa Hleihel Date: Tue, 19 May 2020 07:49:27 -0400 Subject: [PATCH 264/312] [netdrv] net/mlx5: E-switch, Annotate termtbl_mutex mutex destroy Message-id: <20200519074934.6303-57-ahleihel@redhat.com> Patchwork-id: 310558 Patchwork-instance: patchwork O-Subject: [RHEL8.3 BZ 1663246 56/63] net/mlx5: E-switch, Annotate termtbl_mutex mutex destroy Bugzilla: 1835595 1663246 RH-Acked-by: Marcelo Leitner RH-Acked-by: Jarod Wilson RH-Acked-by: John Linville RH-Acked-by: Ivan Vecera RH-Acked-by: Tony Camuso RH-Acked-by: Kamal Heib Bugzilla: http://bugzilla.redhat.com/1835595 Bugzilla: http://bugzilla.redhat.com/1663246 Upstream: v5.7-rc1 commit 2bb72e7e2abc6c8005baef4b35795616be2e0e4c Author: Parav Pandit Date: Sat Dec 14 03:24:25 2019 -0600 net/mlx5: E-switch, Annotate termtbl_mutex mutex destroy Annotate mutex destroy to keep it symmetric to init sequence. It should be destroyed after its users (representor netdevices) are destroyed in below flow. esw_offloads_disable() esw_offloads_unload_rep() Hence, initialize the mutex before creating the representors which uses it. Reviewed-by: Roi Dayan Reviewed-by: Bodong Wang Signed-off-by: Parav Pandit Reviewed-by: Mark Bloch Signed-off-by: Saeed Mahameed Signed-off-by: Alaa Hleihel Signed-off-by: Frantisek Hrbata --- drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c index 82905834ddb2..8d277bdaccea 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c @@ -2429,6 +2429,7 @@ int esw_offloads_enable(struct mlx5_eswitch *esw) else esw->offloads.encap = DEVLINK_ESWITCH_ENCAP_MODE_NONE; + mutex_init(&esw->offloads.termtbl_mutex); mlx5_rdma_enable_roce(esw->dev); err = esw_offloads_steering_init(esw); if (err) @@ -2451,7 +2452,6 @@ int esw_offloads_enable(struct mlx5_eswitch *esw) goto err_reps; esw_offloads_devcom_init(esw); - mutex_init(&esw->offloads.termtbl_mutex); return 0; @@ -2463,6 +2463,7 @@ int esw_offloads_enable(struct mlx5_eswitch *esw) esw_offloads_steering_cleanup(esw); err_steering_init: mlx5_rdma_disable_roce(esw->dev); + mutex_destroy(&esw->offloads.termtbl_mutex); return err; } @@ -2493,6 +2494,7 @@ void esw_offloads_disable(struct mlx5_eswitch *esw) esw_set_passing_vport_metadata(esw, false); esw_offloads_steering_cleanup(esw); mlx5_rdma_disable_roce(esw->dev); + mutex_destroy(&esw->offloads.termtbl_mutex); esw->offloads.encap = DEVLINK_ESWITCH_ENCAP_MODE_NONE; } -- 2.13.6