From: Parav Pandit <parav@mellanox.com>
Date: Wed, 24 Jun 2020 05:56:25 -0500
Subject: net/mlx5: E-switch, When eswitch is unsupported, return -EOPNOTSUPP
Patch-mainline: v5.9-rc1
Git-commit: e9716afdcae4ceea3a093e5b2fac1a5df0f943ca
References: jsc#SLE-15172
When eswitch is unsupported, currently -EPERM error code is returned
instead of -EOPNOTSUPP.
Due to this VF device's devlink virtual port is not enumerated because
port_function_get() callback returned -EPERM instead of -EOPNOTSUPP.
Hence, return the error code -EOPNOTSUPP when eswitch is unsupported.
Fixes: bd93975353d5 ("net/mlx5: E-switch, Introduce and use eswitch support check helper")
Signed-off-by: Parav Pandit <parav@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Acked-by: Thomas Bogendoerfer <tbogendoerfer@suse.de>
---
drivers/net/ethernet/mellanox/mlx5/core/eswitch.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
@@ -69,7 +69,7 @@ static int mlx5_eswitch_check(const stru
return -EOPNOTSUPP;
if (!MLX5_ESWITCH_MANAGER(dev))
- return -EPERM;
+ return -EOPNOTSUPP;
return 0;
}