net/mlx5: E-Switch, return error if encap isn't supported
authorRaed Salem <raeds@nvidia.com>
Mon, 1 Nov 2021 14:18:53 +0000 (16:18 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 26 Nov 2021 09:39:16 +0000 (10:39 +0100)
commit4b4302a02b7f734260856b9c3607fb78d35ba018
treeb36d157f7102a37f17b29301c376008ea6085767
parent68748ea4d1225da644fa91263e4e019f4c72ddb7
net/mlx5: E-Switch, return error if encap isn't supported

[ Upstream commit c4c3176739dfa6efcc5b1d1de4b3fd2b51b048c7 ]

On regular ConnectX HCAs getting encap mode isn't supported when the
E-Switch is in NONE mode. Current code would return no error code when
trying to get encap mode in such case which is wrong.

Fix by returning error value to indicate failure to caller in such case.

Fixes: 8e0aa4bc959c ("net/mlx5: E-switch, Protect eswitch mode changes")
Signed-off-by: Raed Salem <raeds@nvidia.com>
Reviewed-by: Mark Bloch <mbloch@nvidia.com>
Reviewed-by: Maor Dickman <maord@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_offloads.c