Skip to content

Commit 920087f

Browse files
committed
Perftest: fix OOO_RECV_WRS enablement flow
Enabling the HAVE_MLX5DV and HAVE_OOO_RECV_WRS flags during perftest compilation leads to an issue when testing non-Mellanox devices. Specifically, the create_qp function will invoke mlx5dv_query_device, which is intended for Mellanox devices. This call will cause the test to terminate prematurely, as third-party devices do not support the mlx5dv interface This commit bypass the mlx5dv_query_device if using non-mlnx device. Signed-off-by: Shmuel Shaul <[email protected]>
1 parent cd69ae0 commit 920087f

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

src/perftest_resources.c

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1555,6 +1555,22 @@ static int check_odp_support(struct pingpong_context *ctx, struct perftest_param
15551555
}
15561556
#endif
15571557

1558+
/******************************************************************************
1559+
*
1560+
******************************************************************************/
1561+
static uint32_t get_device_vendor(struct ibv_context *context)
1562+
{
1563+
struct ibv_device_attr device_attr;
1564+
memset(&device_attr, 0, sizeof(device_attr));
1565+
1566+
if (ibv_query_device(context, &device_attr)) {
1567+
fprintf(stderr, "Failed to query device vendor id\n");
1568+
return 1;
1569+
}
1570+
1571+
return device_attr.vendor_id;
1572+
}
1573+
15581574
/******************************************************************************
15591575
*
15601576
******************************************************************************/
@@ -2347,6 +2363,7 @@ struct ibv_qp* ctx_qp_create(struct pingpong_context *ctx,
23472363
memset(&attr_dv, 0, sizeof(attr_dv));
23482364
#ifdef HAVE_OOO_RECV_WRS
23492365
struct mlx5dv_context ctx_dv;
2366+
uint32_t is_mlnx_device;
23502367
memset(&ctx_dv, 0, sizeof(ctx_dv));
23512368
#endif
23522369
#endif
@@ -2489,7 +2506,10 @@ struct ibv_qp* ctx_qp_create(struct pingpong_context *ctx,
24892506
{
24902507
#ifdef HAVE_MLX5DV
24912508
#ifdef HAVE_OOO_RECV_WRS
2492-
if (!user_param->no_ddp && user_param->connection_type != UD && user_param->connection_type != UC){
2509+
// OOO_RECV_WRS is not supported by non-mlnx devices
2510+
is_mlnx_device = get_device_vendor(ctx->context) == 0x02c9;
2511+
2512+
if (!user_param->no_ddp && is_mlnx_device && user_param->connection_type != UD && user_param->connection_type != UC){
24932513
ctx_dv.comp_mask = MLX5DV_CONTEXT_MASK_OOO_RECV_WRS;
24942514

24952515
int ret = mlx5dv_query_device(ctx->context, &ctx_dv);

0 commit comments

Comments
 (0)