int msix_vec_count)
{
int query_sz = MLX5_ST_SZ_BYTES(query_hca_cap_out);
- int set_sz = MLX5_ST_SZ_BYTES(set_hca_cap_in);
- void *hca_cap = NULL, *query_cap = NULL, *cap;
int num_vf_msix, min_msix, max_msix;
+ void *query_cap, *hca_caps;
bool ec_vf_function;
int vport;
int ret;
return -EOVERFLOW;
query_cap = kvzalloc(query_sz, GFP_KERNEL);
- hca_cap = kvzalloc(set_sz, GFP_KERNEL);
- if (!hca_cap || !query_cap) {
- ret = -ENOMEM;
- goto out;
- }
+ if (!query_cap)
+ return -ENOMEM;
ec_vf_function = mlx5_core_ec_sriov_enabled(dev);
vport = mlx5_core_func_to_vport(dev, function_id, ec_vf_function);
if (ret)
goto out;
- cap = MLX5_ADDR_OF(set_hca_cap_in, hca_cap, capability);
- memcpy(cap, MLX5_ADDR_OF(query_hca_cap_out, query_cap, capability),
- MLX5_UN_SZ_BYTES(hca_cap_union));
- MLX5_SET(cmd_hca_cap, cap, dynamic_msix_table_size, msix_vec_count);
-
- MLX5_SET(set_hca_cap_in, hca_cap, opcode, MLX5_CMD_OP_SET_HCA_CAP);
- MLX5_SET(set_hca_cap_in, hca_cap, other_function, 1);
- MLX5_SET(set_hca_cap_in, hca_cap, ec_vf_function, ec_vf_function);
- MLX5_SET(set_hca_cap_in, hca_cap, function_id, function_id);
+ hca_caps = MLX5_ADDR_OF(query_hca_cap_out, query_cap, capability);
+ MLX5_SET(cmd_hca_cap, hca_caps, dynamic_msix_table_size,
+ msix_vec_count);
- MLX5_SET(set_hca_cap_in, hca_cap, op_mod,
- MLX5_SET_HCA_CAP_OP_MOD_GENERAL_DEVICE << 1);
- ret = mlx5_cmd_exec_in(dev, set_hca_cap, hca_cap);
+ ret = mlx5_vport_set_other_func_general_cap(dev, hca_caps, vport);
out:
- kvfree(hca_cap);
kvfree(query_cap);
return ret;
}