mlx5: Fix HCA cap 2 query

Previously we were trying to set hca_cap_2 without checking if
sw_vhca_id_valid max value, which is the only settable value inside
hca_cap_2, and seeing that we dont have driver support for sw_vhca_id
yet there is no need to set hca_cap_2 at all, it is enough to query it.

Fixes: 7b959396ca ("mlx5: Introduce new destination type TABLE_TYPE")
MFC after:	3 days
This commit is contained in:
Patrisious Haddad 2023-05-11 12:48:26 +03:00 committed by Konstantin Belousov
parent 3b3195f676
commit 0cd90ee598

View file

@ -561,39 +561,15 @@ static int handle_hca_cap_atomic(struct mlx5_core_dev *dev)
static int handle_hca_cap_2(struct mlx5_core_dev *dev)
{
void *set_ctx;
void *set_hca_cap;
int set_sz = MLX5_ST_SZ_BYTES(set_hca_cap_in);
int err;
if (MLX5_CAP_GEN_MAX(dev, hca_cap_2)) {
err = mlx5_core_get_caps(dev, MLX5_CAP_GENERAL_2);
if (err)
return err;
} else {
return 0;
}
/* To be added if sw_vhca support was added */
/*if (!MLX5_CAP_GEN_2_MAX(dev, sw_vhca_id_valid) ||
!(dev->priv.sw_vhca_id > 0))
return 0;*/
set_ctx = kzalloc(set_sz, GFP_KERNEL);
if (!set_ctx)
return -ENOMEM;
MLX5_SET(set_hca_cap_in, set_ctx, op_mod,
MLX5_CAP_GENERAL_2 << 1);
set_hca_cap = MLX5_ADDR_OF(set_hca_cap_in, set_ctx, capability);
memcpy(set_hca_cap, dev->hca_caps_cur[MLX5_CAP_GENERAL_2],
MLX5_ST_SZ_BYTES(cmd_hca_cap_2));
//MLX5_SET(cmd_hca_cap_2, set_hca_cap, sw_vhca_id_valid, 1);
err = set_caps(dev, set_ctx, set_sz);
kfree(set_ctx);
return err;
return 0;
}
static int set_hca_ctrl(struct mlx5_core_dev *dev)