Perftest: Fix failure in creating cq when create cq ex is not

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: b6f957f ("Perftest: Add support for TD lock-free mode")
(cherry picked from commit c6e2261f2d5be0856a7e2be14ae794a0ef8649df)
This commit is contained in:
Xinghai Cen 2024-09-04 17:27:56 +08:00 committed by openeuler-sync-bot
parent d43ced9ba0
commit 9a7735ee77
4 changed files with 86 additions and 13 deletions

View File

@ -1,9 +1,11 @@
From f8f97b189e9af6cff8559b10c749ff289219b754 Mon Sep 17 00:00:00 2001 From f8f97b189e9af6cff8559b10c749ff289219b754 Mon Sep 17 00:00:00 2001
From: Xinghai Cen <cenxinghai@h-partners.com> From: Xinghai Cen <cenxinghai@h-partners.com>
Date: Wed, 21 Aug 2024 20:06:50 +0800 Date: Wed, 21 Aug 2024 20:06:50 +0800
Subject: [PATCH] Perftest: Fix TD lock-free mode not working for QP When Subject: [PATCH] Perftest: Fix TD lock-free mode not working for QP
creating QP in TD lock-free mode, set attr_ex.pd with ctx->pad instead of
ctx->pd, otherwise the lock-free won't work. Fix TD lock-free mode not working for QP When
creating QP in TD lock-free mode, set attr_ex.pd with ctx->pad instead of
ctx->pd, otherwise the lock-free won't work.
Fixes: "Perftest: Add support for TD lock-free mode" Fixes: "Perftest: Add support for TD lock-free mode"
Signed-off-by: Guofeng Yue <yueguofeng@h-partners.com> Signed-off-by: Guofeng Yue <yueguofeng@h-partners.com>

View File

@ -0,0 +1,64 @@
From 3ea6ea2490eb19e5951201804ab9df525338c799 Mon Sep 17 00:00:00 2001
From: Ge Hu <huge4@huawei.com>
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 <selvin.xavier@broadcom.com>
Signed-off-by: Junxian Huang <huangjunxian6@hisilicon.com>
Signed-off-by: Xinghai Cen <cenxinghai@h-partners.com>
---
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

View File

@ -1,6 +1,6 @@
Name: perftest Name: perftest
Version: 4.5 Version: 4.5
Release: 10 Release: 11
License: GPLv2 or BSD License: GPLv2 or BSD
Summary: RDMA Performance Testing Tools Summary: RDMA Performance Testing Tools
Url: https://github.com/linux-rdma/perftest Url: https://github.com/linux-rdma/perftest
@ -19,6 +19,7 @@ Patch10: 0010-Perftest-Support-selecting-congestion-control-algori.patch
Patch11: 0011-Perftest-Fix-rx_depth-check-for-XRC.patch Patch11: 0011-Perftest-Fix-rx_depth-check-for-XRC.patch
Patch12: 0012-Perftest-Add-support-for-TD-lock-free-mode.patch Patch12: 0012-Perftest-Add-support-for-TD-lock-free-mode.patch
Patch13: 0013-Perftest-Fix-TD-lock-free-mode-not-working-for-QP.patch Patch13: 0013-Perftest-Fix-TD-lock-free-mode-not-working-for-QP.patch
Patch14: 0014-Perftest-Fix-failure-in-creating-cq-when-create-cq-e.patch
BuildRequires: automake gcc libibverbs-devel >= 1.2.0 librdmacm-devel >= 1.0.21 libibumad-devel >= 1.3.10.2 BuildRequires: automake gcc libibverbs-devel >= 1.2.0 librdmacm-devel >= 1.0.21 libibumad-devel >= 1.3.10.2
BuildRequires: pciutils-devel libibverbs librdmacm libibumad BuildRequires: pciutils-devel libibverbs librdmacm libibumad
@ -46,6 +47,12 @@ done
%_bindir/* %_bindir/*
%changelog %changelog
* Mon Sep 2 2024 Xinghai Cen <cenxinghai@h-partners.com> - 4.5-11
- Type: bugfix
- ID: NA
- SUG: NA
- DESC: Fix failure in creating cq when create cq ex is not
* Wed Aug 21 2024 Xinghai Cen <cenxinghai@h-partners.com> - 4.5-10 * Wed Aug 21 2024 Xinghai Cen <cenxinghai@h-partners.com> - 4.5-10
- Type: feature - Type: feature
- ID: NA - ID: NA