From 950e7e2da1b50e5aab20b2efb450890df1ef0ed1 Mon Sep 17 00:00:00 2001 From: Chengchang Tang Date: Mon, 7 Nov 2022 21:09:08 +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 b6f1cb8..5065181 100755 --- a/src/perftest_resources.c +++ b/src/perftest_resources.c @@ -2364,22 +2364,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; @@ -2554,10 +2553,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.30.0