代码拉取完成,页面将自动刷新
From 3ea6ea2490eb19e5951201804ab9df525338c799 Mon Sep 17 00:00:00 2001
From: Ge Hu <[email protected]>
Date: Mon, 2 Sep 2024 19:43:09 +0800
Subject: [PATCH] Perftest: Fix failure in creating cq when create cq ex is not
supported by providers
The previous TD lock-free patch introduced ibv_create_cq_ex() to
perftest, but it breaks the provider devices which do not support
this API yet. For these devices calling this API leads to an errno
of EOPNOTSUPP. So add a check of errno, and if it is EOPNOTSUPP,
use ibv_create_cq() as a fallback.
Fixes: b6f957f6bc6c ("Perftest: Add support for TD lock-free mode")
Tested-By: Selvin Xavier <[email protected]>
Signed-off-by: Junxian Huang <[email protected]>
Signed-off-by: Xinghai Cen <[email protected]>
---
src/perftest_resources.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/src/perftest_resources.c b/src/perftest_resources.c
index 58dbdef..843c45f 100755
--- a/src/perftest_resources.c
+++ b/src/perftest_resources.c
@@ -1516,7 +1516,7 @@ int create_reg_cqs(struct pingpong_context *ctx,
struct perftest_parameters *user_param,
int tx_buffer_depth, int need_recv_cq)
{
- #ifdef HAVE_CQ_EX
+#ifdef HAVE_CQ_EX
struct ibv_cq_init_attr_ex send_cq_attr = {
.cqe = tx_buffer_depth * user_param->num_of_qps,
.cq_context = NULL,
@@ -1532,6 +1532,8 @@ int create_reg_cqs(struct pingpong_context *ctx,
#endif
ctx->send_cq = ibv_cq_ex_to_cq(ibv_create_cq_ex(ctx->context, &send_cq_attr));
if (!ctx->send_cq) {
+ if (!user_param->no_lock && errno == EOPNOTSUPP)
+ goto cq_ex_not_supported;
fprintf(stderr, "Couldn't create CQ\n");
return FAILURE;
}
@@ -1556,7 +1558,9 @@ int create_reg_cqs(struct pingpong_context *ctx,
}
}
return SUCCESS;
-#else
+
+cq_ex_not_supported:
+#endif
ctx->send_cq = ibv_create_cq(ctx->context,tx_buffer_depth *
user_param->num_of_qps, NULL, ctx->channel, user_param->eq_num);
if (!ctx->send_cq) {
@@ -1574,7 +1578,6 @@ int create_reg_cqs(struct pingpong_context *ctx,
}
return SUCCESS;
-#endif
}
/******************************************************************************
--
2.25.1
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。