Fix flexible WQE buffer page related issues

1. Fix missing flexible WQE buffer page flag
2. Fix ext_sge page size

Signed-off-by: Chengchang Tang <tangchengchang@huawei.com>
Signed-off-by: Juan Zhou <zhoujuan51@h-partners.com>
(cherry picked from commit e8a0671cf69d32baa72c4430f2b3ac279fbce147)
This commit is contained in:
Juan Zhou 2024-05-06 10:04:50 +08:00 committed by openeuler-sync-bot
parent 6cf19bb5af
commit 058cb01e3d
3 changed files with 96 additions and 1 deletions

View File

@ -0,0 +1,35 @@
From 6ee60b49872472129e26fbb4d19061e7a864a32a Mon Sep 17 00:00:00 2001
From: Chengchang Tang <tangchengchang@huawei.com>
Date: Tue, 30 Jan 2024 20:57:02 +0800
Subject: [PATCH] libhns: Fix missing flexible WQE buffer page flag
driver inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I98HIN
--------------------------------------------------------------------------
Due to the lack of this flag, this feature cannot actually take effect.
Fixes: bf57963e729c ("libhns: Support flexible WQE buffer page size")
Signed-off-by: Chengchang Tang <tangchengchang@huawei.com>
---
providers/hns/hns_roce_u.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/providers/hns/hns_roce_u.c b/providers/hns/hns_roce_u.c
index 7a3d1a2..c4a3ba5 100644
--- a/providers/hns/hns_roce_u.c
+++ b/providers/hns/hns_roce_u.c
@@ -342,7 +342,7 @@ static void ucontext_set_cmd(struct hns_roce_alloc_ucontext *cmd,
struct hnsdv_context_attr *attr)
{
cmd->config |= HNS_ROCE_EXSGE_FLAGS | HNS_ROCE_RQ_INLINE_FLAGS |
- HNS_ROCE_CQE_INLINE_FLAGS;
+ HNS_ROCE_CQE_INLINE_FLAGS | HNS_ROCE_UCTX_DYN_QP_PGSZ;
if (!attr || !(attr->flags & HNSDV_CONTEXT_FLAGS_DCA))
return;
--
2.33.0

View File

@ -0,0 +1,52 @@
From 85b6e60f3ec97d2479373111b2a4bceb6ef286cd Mon Sep 17 00:00:00 2001
From: Chengchang Tang <tangchengchang@huawei.com>
Date: Fri, 19 Apr 2024 12:06:12 +0800
Subject: [PATCH] libhns: Fix ext_sge page size
driver inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I98HIN
--------------------------------------------------------------------------
The buffer for extending SGE must be equal to the WQE buffer page
size.
Fixes: bf57963e729c ("libhns: Support flexible WQE buffer page size")
Signed-off-by: Chengchang Tang <tangchengchang@huawei.com>
---
providers/hns/hns_roce_u_verbs.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/providers/hns/hns_roce_u_verbs.c b/providers/hns/hns_roce_u_verbs.c
index 8964d53..a680339 100644
--- a/providers/hns/hns_roce_u_verbs.c
+++ b/providers/hns/hns_roce_u_verbs.c
@@ -1270,8 +1270,10 @@ static void get_best_multi_region_pg_shift(struct hns_roce_device *hr_dev,
/*
* The larger the pagesize used, the better the performance, but it
* may waste more memory. Therefore, we use the least common multiple
- * (aligned to power of 2) of sq wqe buffer size, rq wqe buffer size,
* and ext_sge buffer size as the pagesize. Additionally, since the
+ * (aligned to power of 2) of sq wqe buffer size and rq wqe buffer
+ * size as the pagesize. And the wqe buffer page cannot be larger
+ * than the buffer size used by extend sge. Additionally, since the
* kernel cannot guarantee the allocation of contiguous memory larger
* than the system page, the pagesize must be smaller than the system
* page.
@@ -1281,8 +1283,10 @@ static void get_best_multi_region_pg_shift(struct hns_roce_device *hr_dev,
rq_size = qp->rq.wqe_cnt << qp->rq.wqe_shift;
pg_shift = max_t(uint8_t, sq_size ? hr_ilog32(sq_size) : 0,
- ext_sge_size ? hr_ilog32(ext_sge_size) : 0);
- pg_shift = max_t(uint8_t, pg_shift, rq_size ? hr_ilog32(rq_size) : 0);
+ rq_size ? hr_ilog32(rq_size) : 0);
+ pg_shift = ext_sge_size ?
+ min_t(uint8_t, pg_shift, hr_ilog32(ext_sge_size)) :
+ pg_shift;
pg_shift = max_t(uint8_t, pg_shift, HNS_HW_PAGE_SHIFT);
qp->pageshift = min_t(uint8_t, pg_shift, hr_ilog32(hr_dev->page_size));
}
--
2.33.0

View File

@ -1,6 +1,6 @@
Name: rdma-core
Version: 50.0
Release: 7
Release: 8
Summary: RDMA core userspace libraries and daemons
License: GPLv2 or BSD
Url: https://github.com/linux-rdma/rdma-core
@ -33,6 +33,8 @@ patch24: 0024-libhns-Sync-DCA-status-by-shared-memory.patch
patch25: 0025-libhns-Add-direct-verbs-support-to-config-DCA.patch
patch26: 0026-libhns-Add-RoH-device-IDs.patch
patch27: 0027-libhns-Add-the-parsing-of-mac-type-in-RoH-mode.patch
patch28: 0028-libhns-Fix-missing-flexible-WQE-buffer-page-flag.patch
patch29: 0029-libhns-Fix-ext_sge-page-size.patch
BuildRequires: binutils cmake >= 2.8.11 gcc libudev-devel pkgconfig pkgconfig(libnl-3.0)
BuildRequires: pkgconfig(libnl-route-3.0) valgrind-devel systemd systemd-devel
@ -612,6 +614,12 @@ fi
%doc %{_docdir}/%{name}-%{version}/70-persistent-ipoib.rules
%changelog
* Mon May 6 2024 Juan Zhou <zhoujuan51@h-partners.com> - 50.0-8
- Type: bugfix
- ID: NA
- SUG: NA
- DESC: Fix flexible WQE buffer page related issues
* Fri Apr 12 2024 Ke Chen <chenke54@huawei.com> - 50.0-7
- Type: requirement
- ID: NA