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)
This commit is contained in:
Chengchang Tang 2022-02-17 16:55:39 +08:00 committed by openeuler-sync-bot
parent 1e6fa0e508
commit c145befca9
2 changed files with 45 additions and 1 deletions

View File

@ -0,0 +1,37 @@
From d72ae701214aa8318604192ac48c31c920bba593 Mon Sep 17 00:00:00 2001
From: Yangyang Li <liyangyang20@huawei.com>
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 <yueguofeng@hisilicon.com>
---
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

View File

@ -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 <tangchengchang@huawei.com> - 35.0-5
- Type: bugfix
- ID: NA
- SUG: NA
- DESC: Fix calculation of extended sge in hns
* Thu Feb 17 2022 tangchengchang <tangchengchang@huawei.com> - 35.0-4
- Type: bugfix
- ID: NA