Skip to content

Commit 6496357

Browse files
msanallaSaeed Mahameed
authored and
Saeed Mahameed
committed
net/mlx5: Query hca_cap_2 only when supported
On vport enable, where fw's hca caps are queried, the driver queries hca_caps_2 without checking if fw truly supports them, causing a false failure of vfs vport load and blocking SRIOV enablement on old devices such as CX4 where hca_caps_2 support is missing. Thus, add a check for the said caps support before accessing them. Fixes: e5b9642 ("net/mlx5: E-Switch, Implement devlink port function cmds to control migratable") Signed-off-by: Maher Sanalla <msanalla@nvidia.com> Reviewed-by: Shay Drory <shayd@nvidia.com> Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
1 parent f7a4851 commit 6496357

File tree

1 file changed

+3
-0
lines changed
  • drivers/net/ethernet/mellanox/mlx5/core

1 file changed

+3
-0
lines changed

drivers/net/ethernet/mellanox/mlx5/core/eswitch.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -807,6 +807,9 @@ static int mlx5_esw_vport_caps_get(struct mlx5_eswitch *esw, struct mlx5_vport *
807807
hca_caps = MLX5_ADDR_OF(query_hca_cap_out, query_ctx, capability);
808808
vport->info.roce_enabled = MLX5_GET(cmd_hca_cap, hca_caps, roce);
809809

810+
if (!MLX5_CAP_GEN_MAX(esw->dev, hca_cap_2))
811+
goto out_free;
812+
810813
memset(query_ctx, 0, query_out_sz);
811814
err = mlx5_vport_get_other_func_cap(esw->dev, vport->vport, query_ctx,
812815
MLX5_CAP_GENERAL_2);

0 commit comments

Comments
 (0)