Skip to content

Commit

Permalink
net/mlx5e: E-Switch, Add a check that log_max_l2_table is valid
Browse files Browse the repository at this point in the history
If log_max_l2_table is 0 there is no really room for one L2 address.
and should be treated as not supported.
Do the check in MPFS init and for vport context events which
both used to update L2 address.

Signed-off-by: Roi Dayan <roid@nvidia.com>
Reviewed-by: Maor Dickman <maord@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
  • Loading branch information
Roi Dayan authored and Saeed Mahameed committed May 19, 2023
1 parent 292243d commit 3d7c5f7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion drivers/net/ethernet/mellanox/mlx5/core/eswitch.c
Original file line number Diff line number Diff line change
Expand Up @@ -712,6 +712,9 @@ void esw_vport_change_handle_locked(struct mlx5_vport *vport)
struct mlx5_eswitch *esw = dev->priv.eswitch;
u8 mac[ETH_ALEN];

if (!MLX5_CAP_GEN(dev, log_max_l2_table))
return;

mlx5_query_nic_vport_mac_address(dev, vport->vport, true, mac);
esw_debug(dev, "vport[%d] Context Changed: perm mac: %pM\n",
vport->vport, mac);
Expand Down Expand Up @@ -948,7 +951,8 @@ void mlx5_esw_vport_disable(struct mlx5_eswitch *esw, u16 vport_num)
vport->enabled = false;

/* Disable events from this vport */
arm_vport_context_events_cmd(esw->dev, vport->vport, 0);
if (MLX5_CAP_GEN(esw->dev, log_max_l2_table))
arm_vport_context_events_cmd(esw->dev, vport->vport, 0);

if (!mlx5_esw_is_manager_vport(esw, vport->vport) &&
MLX5_CAP_GEN(esw->dev, vhca_resource_manager))
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/ethernet/mellanox/mlx5/core/lib/mpfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ int mlx5_mpfs_init(struct mlx5_core_dev *dev)
int l2table_size = 1 << MLX5_CAP_GEN(dev, log_max_l2_table);
struct mlx5_mpfs *mpfs;

if (!MLX5_ESWITCH_MANAGER(dev))
if (!MLX5_ESWITCH_MANAGER(dev) || l2table_size == 1)
return 0;

mpfs = kzalloc(sizeof(*mpfs), GFP_KERNEL);
Expand Down

0 comments on commit 3d7c5f7

Please sign in to comment.