!90 [sync] PR-73: Two patchs are uploaded from rdma-core mainline

Merge pull request !90 from openeuler-sync-bot/sync-pr73-openEuler-22.03-LTS-Next-to-master
This commit is contained in:
openeuler-ci-bot 2023-11-03 01:45:58 +00:00 committed by Gitee
commit 36c9e9df86
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 129 additions and 1 deletions

View File

@ -0,0 +1,64 @@
From 14e8bd8f4e30abdaabbe7ffc3a19e4381b4130fe Mon Sep 17 00:00:00 2001
From: Chengchang Tang <tangchengchang@huawei.com>
Date: Wed, 24 May 2023 10:34:07 +0800
Subject: [PATCH 1/2] libhns: Remove unnecessary QP checks
mainline inclusion
from mainline-v47.0
commit 4ea9a4f77ac8c174d1ae4cf551a2e5abea13516f
category: cleanup
bugzilla: https://gitee.com/src-openeuler/rdma-core/issues/I7NT3M
CVE: NA
Reference: https://github.com/linux-rdma/rdma-core/commit/4ea9a4f77ac8c174d1ae4cf551a2e5abea13516f
----------------------------------------------------------------------
It is not necessary to check the type of the queue on post_send and
post_recv since the QP type that cannot be supported will be rejected
when it is created.
Check for srq in post_recv has also been removed, because the RQ of
QP bound to srq is empty and will return immediate error in post_recv.
Besides, remove the unused parameter ctx.
Signed-off-by: Chengchang Tang <tangchengchang@huawei.com>
Signed-off-by: Junxian Huang <huangjunxian6@hisilicon.com>
Signed-off-by: Juan Zhou <zhoujuan51@h-partners.com>
---
providers/hns/hns_roce_u_hw_v2.c | 11 +----------
1 file changed, 1 insertion(+), 10 deletions(-)
diff --git a/providers/hns/hns_roce_u_hw_v2.c b/providers/hns/hns_roce_u_hw_v2.c
index ee2fffe..688eff8 100644
--- a/providers/hns/hns_roce_u_hw_v2.c
+++ b/providers/hns/hns_roce_u_hw_v2.c
@@ -908,11 +908,6 @@ static int check_qp_send(struct hns_roce_qp *qp, struct hns_roce_context *ctx)
struct ibv_qp *ibvqp = &qp->verbs_qp.qp;
int ret = 0;
- if (unlikely(ibvqp->qp_type != IBV_QPT_RC &&
- ibvqp->qp_type != IBV_QPT_UD) &&
- ibvqp->qp_type != IBV_QPT_XRC_SEND)
- return -EINVAL;
-
if (unlikely(ibvqp->state == IBV_QPS_RESET ||
ibvqp->state == IBV_QPS_INIT ||
ibvqp->state == IBV_QPS_RTR))
@@ -1516,11 +1511,7 @@ static int check_qp_recv(struct hns_roce_qp *qp, struct hns_roce_context *ctx)
struct ibv_qp *ibvqp = &qp->verbs_qp.qp;
int ret = 0;
- if (unlikely(ibvqp->qp_type != IBV_QPT_RC &&
- ibvqp->qp_type != IBV_QPT_UD))
- return -EINVAL;
-
- if (ibvqp->state == IBV_QPS_RESET || ibvqp->srq)
+ if (ibvqp->state == IBV_QPS_RESET)
return -EINVAL;
if (check_dca_attach_enable(qp)) {
--
2.25.1

View File

@ -0,0 +1,56 @@
From e20de83892bcba8e8944cbf83e8acc9192d514bb Mon Sep 17 00:00:00 2001
From: Chengchang Tang <tangchengchang@huawei.com>
Date: Mon, 3 Jul 2023 15:22:57 +0800
Subject: [PATCH 2/2] libhns: Fix reference to uninitialized cq pointer
mainline inclusion
from mainline-v47.0
commit e850ebe1570c06990cc60e96d0085d5d2a1cfcaa
category: bugfix
bugzilla: https://gitee.com/src-openeuler/rdma-core/issues/I7NTLE
CVE: NA
Reference: https://github.com/linux-rdma/rdma-core/commit/e850ebe1570c06990cc60e96d0085d5d2a1cfcaa
----------------------------------------------------------------------
In cases such as using XRC and SRQ where RQs are not created, the recv_cq
pointer will not be initailized, and thus the unsupported post recv
function should return before referencing the recv_cq pointer.
Fixes: 4ea9a4f77ac8 ("libhns: Remove unnecessary QP checks")
Signed-off-by: Chengchang Tang <tangchengchang@huawei.com>
Signed-off-by: Junxian Huang <huangjunxian6@hisilicon.com>
Signed-off-by: Juan Zhou <zhoujuan51@h-partners.com>
---
providers/hns/hns_roce_u_hw_v2.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/providers/hns/hns_roce_u_hw_v2.c b/providers/hns/hns_roce_u_hw_v2.c
index 688eff8..9238fe5 100644
--- a/providers/hns/hns_roce_u_hw_v2.c
+++ b/providers/hns/hns_roce_u_hw_v2.c
@@ -1599,15 +1599,15 @@ static int hns_roce_u_v2_post_recv(struct ibv_qp *ibvqp, struct ibv_recv_wr *wr,
max_sge = qp->rq.max_gs - qp->rq.rsv_sge;
for (nreq = 0; wr; ++nreq, wr = wr->next) {
- if (hns_roce_v2_wq_overflow(&qp->rq, nreq,
- to_hr_cq(qp->verbs_qp.qp.recv_cq))) {
- ret = ENOMEM;
+ if (wr->num_sge > max_sge) {
+ ret = max_sge > 0 ? EINVAL : EOPNOTSUPP;
*bad_wr = wr;
goto out;
}
- if (wr->num_sge > max_sge) {
- ret = EINVAL;
+ if (hns_roce_v2_wq_overflow(&qp->rq, nreq,
+ to_hr_cq(qp->verbs_qp.qp.recv_cq))) {
+ ret = ENOMEM;
*bad_wr = wr;
goto out;
}
--
2.25.1

View File

@ -1,6 +1,6 @@
Name: rdma-core Name: rdma-core
Version: 41.0 Version: 41.0
Release: 13 Release: 14
Summary: RDMA core userspace libraries and daemons Summary: RDMA core userspace libraries and daemons
License: GPLv2 or BSD License: GPLv2 or BSD
Url: https://github.com/linux-rdma/rdma-core Url: https://github.com/linux-rdma/rdma-core
@ -56,6 +56,8 @@ Patch46: 0047-libhns-Fix-the-owner-bit-error-of-sq-in-new-io.patch
Patch47: 0048-libhns-Fix-incorrect-post-send-with-direct-wqe-of-wr.patch Patch47: 0048-libhns-Fix-incorrect-post-send-with-direct-wqe-of-wr.patch
Patch48: 0049-libhns-Add-a-judgment-to-the-congestion-control-algo.patch Patch48: 0049-libhns-Add-a-judgment-to-the-congestion-control-algo.patch
Patch49: 0050-libhns-Support-user-to-choose-using-UD-sl-or-pktype-.patch Patch49: 0050-libhns-Support-user-to-choose-using-UD-sl-or-pktype-.patch
Patch50: 0051-libhns-Remove-unnecessary-QP-checks.patch
Patch51: 0052-libhns-Fix-reference-to-uninitialized-cq-pointer.patch
BuildRequires: binutils cmake >= 2.8.11 gcc libudev-devel pkgconfig pkgconfig(libnl-3.0) 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 BuildRequires: pkgconfig(libnl-route-3.0) valgrind-devel systemd systemd-devel
@ -303,6 +305,12 @@ fi
%{_mandir}/* %{_mandir}/*
%changelog %changelog
* Tue Jul 25 2023 Juan Zhou <zhoujuan51@h-partners.com> - 41.0-14
- Type: bugfix
- ID: NA
- SUG: NA
- DESC: Two patchs are uploaded from rdma-core mainline
* Fri Jun 9 2023 Juan Zhou <zhoujuan51@h-partners.com> - 41.0-13 * Fri Jun 9 2023 Juan Zhou <zhoujuan51@h-partners.com> - 41.0-13
- Type: bugfix - Type: bugfix
- ID: NA - ID: NA