Commit c46fb773 authored by Leon Romanovsky's avatar Leon Romanovsky Committed by Jakub Kicinski

net/mlx5: Drop extra layer of locks in IPsec

There is no need in holding devlink lock as it gives nothing
compared to already used write mode_lock.
Signed-off-by: default avatarLeon Romanovsky <leonro@nvidia.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@nvidia.com>
Link: https://lore.kernel.org/r/20230825062836.103744-4-saeed@kernel.orgSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 390a24cb
...@@ -3903,38 +3903,28 @@ int mlx5_devlink_eswitch_inline_mode_get(struct devlink *devlink, u8 *mode) ...@@ -3903,38 +3903,28 @@ int mlx5_devlink_eswitch_inline_mode_get(struct devlink *devlink, u8 *mode)
bool mlx5_eswitch_block_encap(struct mlx5_core_dev *dev) bool mlx5_eswitch_block_encap(struct mlx5_core_dev *dev)
{ {
struct devlink *devlink = priv_to_devlink(dev); struct mlx5_eswitch *esw = dev->priv.eswitch;
struct mlx5_eswitch *esw;
devl_lock(devlink); if (!mlx5_esw_allowed(esw))
esw = mlx5_devlink_eswitch_get(devlink);
if (IS_ERR(esw)) {
devl_unlock(devlink);
/* Failure means no eswitch => not possible to change encap */
return true; return true;
}
down_write(&esw->mode_lock); down_write(&esw->mode_lock);
if (esw->mode != MLX5_ESWITCH_LEGACY && if (esw->mode != MLX5_ESWITCH_LEGACY &&
esw->offloads.encap != DEVLINK_ESWITCH_ENCAP_MODE_NONE) { esw->offloads.encap != DEVLINK_ESWITCH_ENCAP_MODE_NONE) {
up_write(&esw->mode_lock); up_write(&esw->mode_lock);
devl_unlock(devlink);
return false; return false;
} }
esw->offloads.num_block_encap++; esw->offloads.num_block_encap++;
up_write(&esw->mode_lock); up_write(&esw->mode_lock);
devl_unlock(devlink);
return true; return true;
} }
void mlx5_eswitch_unblock_encap(struct mlx5_core_dev *dev) void mlx5_eswitch_unblock_encap(struct mlx5_core_dev *dev)
{ {
struct devlink *devlink = priv_to_devlink(dev); struct mlx5_eswitch *esw = dev->priv.eswitch;
struct mlx5_eswitch *esw;
esw = mlx5_devlink_eswitch_get(devlink); if (!mlx5_esw_allowed(esw))
if (IS_ERR(esw))
return; return;
down_write(&esw->mode_lock); down_write(&esw->mode_lock);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment