net/mlx5: E-Switch, Change mode lock from mutex to rw semaphore
authorRoi Dayan <roid@nvidia.com>
Wed, 16 Sep 2020 07:11:42 +0000 (10:11 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 26 Nov 2021 09:39:16 +0000 (10:39 +0100)
commit68748ea4d1225da644fa91263e4e019f4c72ddb7
tree82fdf472723f7f7c47da5e6acde9b2f541a6c0f0
parent6190e1a2d41aa7fdf6d38b24d5ca4baaa0412fd9
net/mlx5: E-Switch, Change mode lock from mutex to rw semaphore

[ Upstream commit c55479d0cb6a28029844d0e90730704a0fb5efd3 ]

E-Switch mode change routine will take the write lock to prevent any
consumer to access the E-Switch resources while E-Switch is going
through a mode change.

In the next patch
E-Switch consumers (e.g vport representors) will take read_lock prior to
accessing E-Switch resources to prevent E-Switch mode changing in the
middle of the operation.

Signed-off-by: Roi Dayan <roid@nvidia.com>
Reviewed-by: Parav Pandit <parav@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
drivers/net/ethernet/mellanox/mlx5/core/eswitch.h
drivers/net/ethernet/mellanox/mlx5/core/eswitch_offloads.c