From c145befca9cac6c5a50882fb1d5d8ca2c42a6219 Mon Sep 17 00:00:00 2001 From: Chengchang Tang Date: Thu, 17 Feb 2022 16:55:39 +0800 Subject: [PATCH] Backport patch "libhns: Bugfix for calculation of extended sge" This patch backport a Bugfix patch from a later versions of rdma-core. (cherry picked from commit fdf09b5dd6788beef47bcd2aba0ef838d20f8900) --- ...gfix-for-calculation-of-extended-sge.patch | 37 +++++++++++++++++++ rdma-core.spec | 9 ++++- 2 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 0001-libhns-Bugfix-for-calculation-of-extended-sge.patch diff --git a/0001-libhns-Bugfix-for-calculation-of-extended-sge.patch b/0001-libhns-Bugfix-for-calculation-of-extended-sge.patch new file mode 100644 index 0000000..ae707dd --- /dev/null +++ b/0001-libhns-Bugfix-for-calculation-of-extended-sge.patch @@ -0,0 +1,37 @@ +From d72ae701214aa8318604192ac48c31c920bba593 Mon Sep 17 00:00:00 2001 +From: Yangyang Li +Date: Thu, 23 Dec 2021 14:52:13 +0800 +Subject: [PATCH] libhns: Bugfix for calculation of extended sge + +Page alignment is required when setting the number of extended sge +according to the hardware's achivement. If the space of needed extended sge +is greater than one page, the roundup_pow_of_two() can ensure that. But if +the needed extended sge isn't 0 and can not be filled in a whole page, the +driver should align it specifically. + +Signed-off-by: Guofeng Yue +--- + providers/hns/hns_roce_u_verbs.c | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/providers/hns/hns_roce_u_verbs.c b/providers/hns/hns_roce_u_verbs.c +index abff0921..30ab072a 100644 +--- a/providers/hns/hns_roce_u_verbs.c ++++ b/providers/hns/hns_roce_u_verbs.c +@@ -939,7 +939,12 @@ static void set_extend_sge_param(struct hns_roce_device *hr_dev, + } + + qp->ex_sge.sge_shift = HNS_ROCE_SGE_SHIFT; +- qp->ex_sge.sge_cnt = cnt; ++ ++ /* If the number of extended sge is not zero, they MUST use the ++ * space of HNS_HW_PAGE_SIZE at least. ++ */ ++ qp->ex_sge.sge_cnt = cnt ? ++ max(cnt, HNS_HW_PAGE_SIZE / HNS_ROCE_SGE_SIZE) : 0; + } + + static void hns_roce_set_qp_params(struct ibv_qp_init_attr_ex *attr, +-- +2.33.0 + diff --git a/rdma-core.spec b/rdma-core.spec index 83db961..89484aa 100644 --- a/rdma-core.spec +++ b/rdma-core.spec @@ -1,6 +1,6 @@ Name: rdma-core Version: 35.0 -Release: 4 +Release: 5 Summary: RDMA core userspace libraries and daemons License: GPLv2 or BSD Url: https://github.com/linux-rdma/rdma-core @@ -49,6 +49,7 @@ Obsoletes: openib-srptools <= 0.0.6 Conflicts: infiniband-diags <= 1.6.7 Patch0: 0000-use-e-para-to-make-transferred-meaning-take-effect.patch +Patch1: 0001-libhns-Bugfix-for-calculation-of-extended-sge.patch %{?systemd_requires} @@ -249,6 +250,12 @@ rm -f %{buildroot}/%{_sbindir}/srp_daemon.sh %{_mandir}/* %changelog +* Thu Feb 17 2022 tangchengchang - 35.0-5 +- Type: bugfix +- ID: NA +- SUG: NA +- DESC: Fix calculation of extended sge in hns + * Thu Feb 17 2022 tangchengchang - 35.0-4 - Type: bugfix - ID: NA