net/mlx5e: Revert parameters on errors when changing trust state without reset
authorMaxim Mikityanskiy <maximmi@mellanox.com>
Thu, 14 Jan 2021 10:34:01 +0000 (12:34 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 3 Feb 2021 22:28:49 +0000 (23:28 +0100)
commitf24b493eba502547cabd246d119dcc664464ae65
treecf89d3100f8c12ebe8dfd93e87511785bad149e3
parent890f413ae5241baaf8176d63c2078d8462b2876c
net/mlx5e: Revert parameters on errors when changing trust state without reset

[ Upstream commit 912c9b5fcca1ab65b806c19dd3b3cb12d73c6fe2 ]

Trust state may be changed without recreating the channels. It happens
when the channels are closed, and when channel parameters (min inline
mode) stay the same after changing the trust state. Changing the trust
state is a hardware command that may fail. The current code didn't
restore the channel parameters to their old values if an error happened
and the channels were closed. This commit adds handling for this case.

Fixes: 6e0504c69811 ("net/mlx5e: Change inline mode correctly when changing trust state")
Signed-off-by: Maxim Mikityanskiy <maximmi@mellanox.com>
Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c