From 1a842d207a981c72c5162f4efd89da8c5a07a772 Mon Sep 17 00:00:00 2001 From: Chengchang Tang Date: Tue, 8 Nov 2022 20:20:40 +0800 Subject: Perftest: Fix verification of max_inline_data for *_create_qp_ex() Currently, attr.cap.max_inline_data is used for validation in *_create_qp() and *_create_qp_ex(). But actually, when entering the create_qp_ex path, the variable attr is not used. So the current check of the *_create_qp_ex() branch is meaningless. The attr_ex.cap.max_inline_data is used to check the max_inline_data in *_create_qp_ex() path. And related printing error has also been fixed. Fixes: 13f71777e6f0 ("Added new post_send API usage for RC,UC,UD,XRC") Signed-off-by: Chengchang Tang --- src/perftest_resources.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/src/perftest_resources.c b/src/perftest_resources.c index 23c31d1..751ea96 100755 --- a/src/perftest_resources.c +++ b/src/perftest_resources.c @@ -2138,22 +2138,21 @@ struct ibv_qp* ctx_qp_create(struct pingpong_context *ctx, int dc_num_of_qps = user_param->num_of_qps / 2; int is_dc_server_side = 0; + struct ibv_qp_init_attr attr; + memset(&attr, 0, sizeof(struct ibv_qp_init_attr)); + struct ibv_qp_cap *qp_cap = &attr.cap; + #ifdef HAVE_IBV_WR_API enum ibv_wr_opcode opcode; - struct ibv_qp_init_attr attr; struct ibv_qp_init_attr_ex attr_ex; + memset(&attr_ex, 0, sizeof(struct ibv_qp_init_attr_ex)); #ifdef HAVE_MLX5DV struct mlx5dv_qp_init_attr attr_dv; memset(&attr_dv, 0, sizeof(attr_dv)); #endif - memset(&attr, 0, sizeof(struct ibv_qp_init_attr)); - memset(&attr_ex, 0, sizeof(struct ibv_qp_init_attr_ex)); #ifdef HAVE_SRD struct efadv_qp_init_attr efa_attr = {}; #endif - #else - struct ibv_qp_init_attr attr; - memset(&attr, 0, sizeof(struct ibv_qp_init_attr)); #endif attr.send_cq = ctx->send_cq; @@ -2328,10 +2327,15 @@ struct ibv_qp* ctx_qp_create(struct pingpong_context *ctx, fprintf(stderr, "Current TX depth is %d and inline size is %d .\n", user_param->tx_depth, user_param->inline_size); } - if (user_param->inline_size > attr.cap.max_inline_data) { - user_param->inline_size = attr.cap.max_inline_data; - printf(" Actual inline-size(%d) > requested inline-size(%d)\n", - attr.cap.max_inline_data, user_param->inline_size); + #ifdef HAVE_IBV_WR_API + if (!user_param->use_old_post_send) + qp_cap = &attr_ex.cap; + #endif + + if (user_param->inline_size > qp_cap->max_inline_data) { + printf(" Actual inline-size(%d) < requested inline-size(%d)\n", + qp_cap->max_inline_data, user_param->inline_size); + user_param->inline_size = qp_cap->max_inline_data; } return qp; -- 2.34.1