Commit 4e046de0 authored by Bodong Wang's avatar Bodong Wang Committed by Saeed Mahameed

Revert "net/mlx5e: E-Switch, Initialize eswitch only if eswitch manager"

This reverts commit 5f5991f3.

With the original commit, eswitch instance will not be initialized for
a function which is vport group manager but not eswitch manager such as
host PF on SmartNIC (BlueField) card. This will result in a kernel crash
when such a vport group manager is trying to access vports in its group.
E.g, PF vport manager (not eswitch manager) tries to configure the MAC
of its VF vport, a kernel trace will happen similar as bellow:

 BUG: unable to handle kernel NULL pointer dereference at 0000000000000000
 ...
 RIP: 0010:mlx5_eswitch_get_vport_config+0xc/0x180 [mlx5_core]
 ...

Fixes: 5f5991f3 ("net/mlx5e: E-Switch, Initialize eswitch only if eswitch manager")
Signed-off-by: default avatarBodong Wang <bodong@mellanox.com>
Reported-by: default avatarYuval Avnery <yuvalav@mellanox.com>
Reviewed-by: default avatarDaniel Jurgens <danielj@mellanox.com>
Reviewed-by: default avatarOr Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: default avatarSaeed Mahameed <saeedm@mellanox.com>
parent 49a57857
...@@ -1728,7 +1728,7 @@ int mlx5_eswitch_init(struct mlx5_core_dev *dev) ...@@ -1728,7 +1728,7 @@ int mlx5_eswitch_init(struct mlx5_core_dev *dev)
int vport_num; int vport_num;
int err; int err;
if (!MLX5_ESWITCH_MANAGER(dev)) if (!MLX5_VPORT_MANAGER(dev))
return 0; return 0;
esw_info(dev, esw_info(dev,
...@@ -1797,7 +1797,7 @@ int mlx5_eswitch_init(struct mlx5_core_dev *dev) ...@@ -1797,7 +1797,7 @@ int mlx5_eswitch_init(struct mlx5_core_dev *dev)
void mlx5_eswitch_cleanup(struct mlx5_eswitch *esw) void mlx5_eswitch_cleanup(struct mlx5_eswitch *esw)
{ {
if (!esw || !MLX5_ESWITCH_MANAGER(esw->dev)) if (!esw || !MLX5_VPORT_MANAGER(esw->dev))
return; return;
esw_info(esw->dev, "cleanup\n"); esw_info(esw->dev, "cleanup\n");
......
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