[PATCH] libhns: Fix missing fields for SRQ WC

From: Xinghai Cen <cenxinghai@h-partners.com> The sl and src_qpn fields in recv-WC are not filled when the QP is UD and has an SRQ. Here fix it. In addition, UD QP does not support RQ INLINE and CQE INLINE features. Reorder the related if-else statements to reduce the number of conditional checks in IO path. Signed-off-by: Xinghai Cen <cenxinghai@h-partners.com> --- ...libhns-Fix-missing-fields-for-SRQ-WC.patch | 82 +++++++++++++++++++ rdma-core.spec | 11 ++- 2 files changed, 91 insertions(+), 2 deletions(-) create mode 100644 0092-libhns-Fix-missing-fields-for-SRQ-WC.patch diff --git a/0092-libhns-Fix-missing-fields-for-SRQ-WC.patch b/0092-libhns-Fix-missing-fields-for-SRQ-WC.patch new file mode 100644 index 0000000..9bccce2 --- /dev/null +++ b/0092-libhns-Fix-missing-fields-for-SRQ-WC.patch @@ -0,0 +1,82 @@ +From 1bebc7700d46ef8e4cafc757e8f989ace4789d69 Mon Sep 17 00:00:00 2001 +From: wenglianfa <wenglianfa@huawei.com> +Date: Wed, 15 Jan 2025 15:55:29 +0800 +Subject: [PATCH] libhns: Fix missing fields for SRQ WC + +mainline inclusion +from mainline-master +commit c4119911c212aaa552c9cb928fba0a696640c9b5 +category: bugfix +bugzilla: https://gitee.com/src-openeuler/rdma-core/issues/IBPB3C +CVE: NA +Reference: https://github.com/linux-rdma/rdma-core/pull/1543/commits/65a7ce99cf4bfd6748... + +---------------------------------------------------------------------- + +The sl and src_qpn fields in recv-WC are not filled when the QP is UD +and has an SRQ. Here fix it. + +In addition, UD QP does not support RQ INLINE and CQE INLINE features. +Reorder the related if-else statements to reduce the number of +conditional checks in IO path. + +Fixes: 061f7e1757ca ("libhns: Refactor the poll one interface") +Signed-off-by: wenglianfa <wenglianfa@huawei.com> +Signed-off-by: Junxian Huang <huangjunxian6@hisilicon.com> +Signed-off-by: Xinghai Cen <cenxinghai@h-partners.com> +--- + providers/hns/hns_roce_u_hw_v2.c | 13 ++++++++----- + 1 file changed, 8 insertions(+), 5 deletions(-) + +diff --git a/providers/hns/hns_roce_u_hw_v2.c b/providers/hns/hns_roce_u_hw_v2.c +index 1bbd788..f05b839 100644 +--- a/providers/hns/hns_roce_u_hw_v2.c ++++ b/providers/hns/hns_roce_u_hw_v2.c +@@ -540,7 +540,8 @@ static void parse_for_ud_qp(struct hns_roce_v2_cqe *cqe, struct ibv_wc *wc, + } + + static void parse_cqe_for_srq(struct hns_roce_v2_cqe *cqe, struct ibv_wc *wc, +- struct hns_roce_srq *srq) ++ struct hns_roce_srq *srq, ++ struct hns_roce_qp *hr_qp) + { + uint32_t wqe_idx; + +@@ -550,6 +551,9 @@ static void parse_cqe_for_srq(struct hns_roce_v2_cqe *cqe, struct ibv_wc *wc, + + if (hr_reg_read(cqe, CQE_CQE_INLINE)) + handle_recv_cqe_inl_from_srq(cqe, srq); ++ else if (hr_qp->verbs_qp.qp.qp_type == IBV_QPT_UD) { ++ parse_for_ud_qp(cqe, wc, hr_qp->enable_ud_sl); ++ } + } + + static int parse_cqe_for_resp(struct hns_roce_v2_cqe *cqe, struct ibv_wc *wc, +@@ -561,13 +565,12 @@ static int parse_cqe_for_resp(struct hns_roce_v2_cqe *cqe, struct ibv_wc *wc, + wc->wr_id = wq->wrid[wq->tail & (wq->wqe_cnt - 1)]; + ++wq->tail; + +- if (hr_qp->verbs_qp.qp.qp_type == IBV_QPT_UD) +- parse_for_ud_qp(cqe, wc, hr_qp->enable_ud_sl); +- + if (hr_reg_read(cqe, CQE_CQE_INLINE)) + handle_recv_cqe_inl_from_rq(cqe, hr_qp); + else if (hr_reg_read(cqe, CQE_RQ_INLINE)) + handle_recv_rq_inl(cqe, hr_qp); ++ else if (hr_qp->verbs_qp.qp.qp_type == IBV_QPT_UD) ++ parse_for_ud_qp(cqe, wc, hr_qp->enable_ud_sl); + + return 0; + } +@@ -777,7 +780,7 @@ static int parse_cqe_for_cq(struct hns_roce_context *ctx, struct hns_roce_cq *cq + return V2_CQ_POLL_ERR; + + if (srq) +- parse_cqe_for_srq(cqe, wc, srq); ++ parse_cqe_for_srq(cqe, wc, srq, cur_qp); + else + parse_cqe_for_resp(cqe, wc, cur_qp); + } +-- +2.33.0 + diff --git a/rdma-core.spec b/rdma-core.spec index 369d9b8..33781ce 100644 --- a/rdma-core.spec +++ b/rdma-core.spec @@ -1,6 +1,6 @@ Name: rdma-core Version: 41.0 -Release: 30 +Release: 31 Summary: RDMA core userspace libraries and daemons License: GPLv2 or BSD Url: https://github.com/linux-rdma/rdma-core @@ -97,6 +97,7 @@ patch88: 0088-libhns-Fix-reference-to-uninitialized-cq-pointer.patch patch89: 0089-libhns-Fix-bypassed-vendor-check-in-hnsdv_query_devi.patch patch90: 0090-libhns-Fix-coredump-during-QP-destruction-when-send_.patch patch91: 0091-libhns-Fix-the-identification-mark-of-RDMA-UD-packet.patch +patch92: 0092-libhns-Fix-missing-fields-for-SRQ-WC.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 @@ -344,7 +345,13 @@ fi %{_mandir}/* %changelog -* Thu Feb 25 2025 Dazhao Lao <laodazhao@huawei.com> - 41.0-30 +* Thu Feb 27 2025 Xinghai Cen <cenxinghai@h-partners.com> - 41.0-31 +- Type: bugfix +- ID: NA +- SUG: NA +- DESC: Fix missing fields for SRQ WC + +* Tue Feb 25 2025 Dazhao Lao <laodazhao@huawei.com> - 41.0-30 - Type: bugfix - ID: NA - SUG: NA -- 2.33.0
participants (1)
-
Junxian Huang