!103 [sync] PR-102: Corrects several minor issues found in review
From: @openeuler-sync-bot Reviewed-by: @hellotcc Signed-off-by: @hellotcc
This commit is contained in:
commit
d9b79ed5fe
@ -1,7 +1,7 @@
|
||||
From 6852a8b49a1af09fc41b7b5432d9487323d0f394 Mon Sep 17 00:00:00 2001
|
||||
From 64933c92842d34190c8cda9a864505d0558d3f5f Mon Sep 17 00:00:00 2001
|
||||
From: Chengchang Tang <tangchengchang@huawei.com>
|
||||
Date: Mon, 30 Oct 2023 16:59:22 +0800
|
||||
Subject: [PATCH 8/8] libhns: Support write with notify
|
||||
Subject: [PATCH] libhns: Support write with notify
|
||||
|
||||
driver inclusion
|
||||
category: feature
|
||||
@ -140,28 +140,24 @@ index 2ad9ea0..5e46f89 100644
|
||||
}
|
||||
|
||||
diff --git a/providers/hns/hnsdv.h b/providers/hns/hnsdv.h
|
||||
index 98c68fd..792a23e 100644
|
||||
index 98c68fd..7d95db4 100644
|
||||
--- a/providers/hns/hnsdv.h
|
||||
+++ b/providers/hns/hnsdv.h
|
||||
@@ -96,17 +96,28 @@ int hnsdv_query_device(struct ibv_context *ctx_in,
|
||||
|
||||
enum hnsdv_cq_init_attr_mask {
|
||||
HNSDV_CQ_INIT_ATTR_MASK_CREATE_FLAGS = 1 << 0,
|
||||
+ HNSDV_CQ_CREATE_ENABLE_NOTIFY = 1 << 1,
|
||||
};
|
||||
@@ -100,13 +100,24 @@ enum hnsdv_cq_init_attr_mask {
|
||||
|
||||
enum hnsdv_cq_create_flags {
|
||||
HNSDV_CQ_CREATE_ENABLE_POE_MODE = 1 << 0,
|
||||
};
|
||||
|
||||
+ HNSDV_CQ_CREATE_ENABLE_NOTIFY = 1 << 1,
|
||||
+};
|
||||
+
|
||||
+enum hnsdv_cq_notify_mode {
|
||||
+ HNSDV_CQ_NOTIFY_MODE_64B_ALIGN = 0,
|
||||
+ HNSDV_CQ_NOTIFY_MODE_4B_ALIGN = 1,
|
||||
+ HNSDV_CQ_NOTIFY_MODE_DDR_64B_ALIGN = 2,
|
||||
+ HNSDV_CQ_NOTIFY_MODE_DDR_4B_ALIGN = 3,
|
||||
+ HNSDV_CQ_NOTIFY_MODE_GUARD = 4, /* Invalid for user */
|
||||
+};
|
||||
+
|
||||
};
|
||||
|
||||
struct hnsdv_cq_init_attr {
|
||||
uint64_t comp_mask; /* Use enum hnsdv_cq_init_attr_mask */
|
||||
uint64_t create_flags; /* Use enum hnsdv_cq_create_flags */
|
||||
|
||||
@ -0,0 +1,88 @@
|
||||
From 95f3cc1f25c091f97aefceac268fe6435d0861c3 Mon Sep 17 00:00:00 2001
|
||||
From: Ran Zhou <zhouran10@partner.com>
|
||||
Date: Mon, 27 Nov 2023 16:39:48 +0800
|
||||
Subject: [PATCH 71/75] libhns: Corrects several issues with output format and
|
||||
variable types.
|
||||
|
||||
driver inclusion
|
||||
category: bugfix
|
||||
bugzilla: https://gitee.com/src-openeuler/rdma-core/issues/I8J2S3?from=project-issue
|
||||
|
||||
--------------------------------------------------------------------------
|
||||
1.Unify the types of two variables to avoid infinite loop.
|
||||
|
||||
2.Standardization the output control character.
|
||||
|
||||
Signed-off-by: Luoyouming <luoyouming@huawei.com>
|
||||
---
|
||||
providers/hns/hns_roce_u.c | 2 +-
|
||||
providers/hns/hns_roce_u_hw_v2.c | 10 +++++-----
|
||||
2 files changed, 6 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/providers/hns/hns_roce_u.c b/providers/hns/hns_roce_u.c
|
||||
index 084385b..f30486f 100644
|
||||
--- a/providers/hns/hns_roce_u.c
|
||||
+++ b/providers/hns/hns_roce_u.c
|
||||
@@ -179,7 +179,7 @@ static void set_dca_pool_param(struct hns_roce_context *ctx,
|
||||
dca_ctx->min_size = HNS_DCA_MAX_MEM_SIZE;
|
||||
|
||||
verbs_debug(&ctx->ibv_ctx,
|
||||
- "Support DCA, unit %d, max %ld, min %ld Bytes.\n",
|
||||
+ "Support DCA, unit %u, max %lu, min %lu Bytes.\n",
|
||||
dca_ctx->unit_size, dca_ctx->max_size, dca_ctx->min_size);
|
||||
}
|
||||
|
||||
diff --git a/providers/hns/hns_roce_u_hw_v2.c b/providers/hns/hns_roce_u_hw_v2.c
|
||||
index 495fbcb..754f918 100644
|
||||
--- a/providers/hns/hns_roce_u_hw_v2.c
|
||||
+++ b/providers/hns/hns_roce_u_hw_v2.c
|
||||
@@ -2680,8 +2680,8 @@ static void set_inline_data_list_rc(struct hns_roce_qp *qp,
|
||||
{
|
||||
unsigned int msg_len = qp->sge_info.total_len;
|
||||
void *dseg;
|
||||
+ size_t i;
|
||||
int ret;
|
||||
- int i;
|
||||
|
||||
hr_reg_enable(wqe, RCWQE_INLINE);
|
||||
|
||||
@@ -2741,7 +2741,7 @@ static void wr_set_inline_data_list_rc(struct ibv_qp_ex *ibv_qp, size_t num_buf,
|
||||
{
|
||||
struct hns_roce_qp *qp = to_hr_qp(&ibv_qp->qp_base);
|
||||
struct hns_roce_rc_sq_wqe *wqe = qp->cur_wqe;
|
||||
- int i;
|
||||
+ size_t i;
|
||||
|
||||
if (!wqe)
|
||||
return;
|
||||
@@ -2872,7 +2872,7 @@ static void wr_set_sge_list_ud(struct ibv_qp_ex *ibv_qp, size_t num_sge,
|
||||
}
|
||||
|
||||
hr_reg_write(wqe, UDWQE_MSG_START_SGE_IDX, sge_idx & mask);
|
||||
- for (int i = 0; i < num_sge; i++) {
|
||||
+ for (size_t i = 0; i < num_sge; i++) {
|
||||
if (!sg_list[i].length)
|
||||
continue;
|
||||
|
||||
@@ -2899,8 +2899,8 @@ static void set_inline_data_list_ud(struct hns_roce_qp *qp,
|
||||
uint8_t data[HNS_ROCE_MAX_UD_INL_INN_SZ] = {};
|
||||
unsigned int msg_len = qp->sge_info.total_len;
|
||||
void *tmp;
|
||||
+ size_t i;
|
||||
int ret;
|
||||
- int i;
|
||||
|
||||
if (!check_inl_data_len(qp, msg_len)) {
|
||||
qp->err = EINVAL;
|
||||
@@ -2962,7 +2962,7 @@ static void wr_set_inline_data_list_ud(struct ibv_qp_ex *ibv_qp, size_t num_buf,
|
||||
{
|
||||
struct hns_roce_qp *qp = to_hr_qp(&ibv_qp->qp_base);
|
||||
struct hns_roce_ud_sq_wqe *wqe = qp->cur_wqe;
|
||||
- int i;
|
||||
+ size_t i;
|
||||
|
||||
if (!wqe)
|
||||
return;
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@ -0,0 +1,45 @@
|
||||
From 884663cd803e3781aec9c45f7fc0145b6a2b4539 Mon Sep 17 00:00:00 2001
|
||||
From: Luoyouming <luoyouming@huawei.com>
|
||||
Date: Mon, 27 Nov 2023 16:39:49 +0800
|
||||
Subject: [PATCH 72/75] libhns: Add input parameter check for
|
||||
hnsdv_query_device()
|
||||
|
||||
driver inclusion
|
||||
category: cleanup
|
||||
bugzilla: https://gitee.com/src-openeuler/rdma-core/issues/I8J2W9?from=project-issue
|
||||
|
||||
--------------------------------------------------------------------------
|
||||
|
||||
Add null pointer check for pointer parameter.
|
||||
|
||||
Signed-off-by: Luoyouming <luoyouming@huawei.com>
|
||||
---
|
||||
providers/hns/hns_roce_u_verbs.c | 5 +++--
|
||||
1 file changed, 3 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/providers/hns/hns_roce_u_verbs.c b/providers/hns/hns_roce_u_verbs.c
|
||||
index c906632..e597e93 100644
|
||||
--- a/providers/hns/hns_roce_u_verbs.c
|
||||
+++ b/providers/hns/hns_roce_u_verbs.c
|
||||
@@ -126,15 +126,16 @@ int hnsdv_query_device(struct ibv_context *context,
|
||||
struct hnsdv_context *attrs_out)
|
||||
{
|
||||
struct hns_roce_context *ctx = context ? to_hr_ctx(context) : NULL;
|
||||
- struct hns_roce_device *hr_dev = to_hr_dev(context->device);
|
||||
+ struct hns_roce_device *hr_dev;
|
||||
|
||||
if (!ctx || !attrs_out)
|
||||
return EINVAL;
|
||||
|
||||
- if (!hr_dev) {
|
||||
+ if (!context->device && !is_hns_dev(context->device)) {
|
||||
verbs_err(verbs_get_ctx(context), "not a HNS RoCE device!\n");
|
||||
return EOPNOTSUPP;
|
||||
}
|
||||
+ hr_dev = to_hr_dev(context->device);
|
||||
|
||||
memset(attrs_out, 0, sizeof(*attrs_out));
|
||||
|
||||
--
|
||||
2.25.1
|
||||
|
||||
63
0073-libhns-Fix-uninitialized-qp-attr-when-flush-cqe.patch
Normal file
63
0073-libhns-Fix-uninitialized-qp-attr-when-flush-cqe.patch
Normal file
@ -0,0 +1,63 @@
|
||||
From 57499cbc906ec4065f65bb8dfda56081a799746e Mon Sep 17 00:00:00 2001
|
||||
From: Chengchang Tang <tangchengchang@huawei.com>
|
||||
Date: Mon, 27 Nov 2023 16:39:51 +0800
|
||||
Subject: [PATCH 73/75] libhns: Fix uninitialized qp attr when flush cqe
|
||||
|
||||
driver inclusion
|
||||
category: bugfix
|
||||
bugzilla: https://gitee.com/src-openeuler/rdma-core/issues/I8J2XW?from=project-issue
|
||||
|
||||
--------------------------------------------------------------------------
|
||||
|
||||
When flushing cqe, the state of qp needs to be modified. The incoming qp
|
||||
attr is not initialized, which may lead to undefined behavior.
|
||||
|
||||
Signed-off-by: Chengchang Tang <tangchengchang@huawei.com>
|
||||
---
|
||||
providers/hns/hns_roce_u_hw_v2.c | 8 ++++----
|
||||
1 file changed, 4 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/providers/hns/hns_roce_u_hw_v2.c b/providers/hns/hns_roce_u_hw_v2.c
|
||||
index 754f918..b48cabd 100644
|
||||
--- a/providers/hns/hns_roce_u_hw_v2.c
|
||||
+++ b/providers/hns/hns_roce_u_hw_v2.c
|
||||
@@ -405,7 +405,7 @@ static int hns_roce_u_v2_modify_qp(struct ibv_qp *qp, struct ibv_qp_attr *attr,
|
||||
|
||||
static int hns_roce_flush_cqe(struct hns_roce_qp *hr_qp, uint8_t status)
|
||||
{
|
||||
- struct ibv_qp_attr attr;
|
||||
+ struct ibv_qp_attr attr = {};
|
||||
int attr_mask;
|
||||
|
||||
if (status != HNS_ROCE_V2_CQE_WR_FLUSH_ERR) {
|
||||
@@ -1614,8 +1614,8 @@ int hns_roce_u_v2_post_send(struct ibv_qp *ibvqp, struct ibv_send_wr *wr,
|
||||
struct hns_roce_qp *qp = to_hr_qp(ibvqp);
|
||||
struct hns_roce_sge_info sge_info = {};
|
||||
struct hns_roce_rc_sq_wqe *wqe;
|
||||
+ struct ibv_qp_attr attr = {};
|
||||
unsigned int wqe_idx, nreq;
|
||||
- struct ibv_qp_attr attr;
|
||||
int ret;
|
||||
|
||||
ret = check_qp_send(qp, ctx);
|
||||
@@ -1788,7 +1788,7 @@ static int hns_roce_u_v2_post_recv(struct ibv_qp *ibvqp, struct ibv_recv_wr *wr,
|
||||
struct hns_roce_context *ctx = to_hr_ctx(ibvqp->context);
|
||||
struct hns_roce_qp *qp = to_hr_qp(ibvqp);
|
||||
unsigned int wqe_idx, nreq, max_sge;
|
||||
- struct ibv_qp_attr attr;
|
||||
+ struct ibv_qp_attr attr = {};
|
||||
int ret;
|
||||
|
||||
ret = check_qp_recv(qp, ctx);
|
||||
@@ -3021,7 +3021,7 @@ static int wr_complete(struct ibv_qp_ex *ibv_qp)
|
||||
struct hns_roce_context *ctx = to_hr_ctx(ibv_qp->qp_base.context);
|
||||
struct hns_roce_qp *qp = to_hr_qp(&ibv_qp->qp_base);
|
||||
unsigned int nreq = qp->sq.head - qp->rb_sq_head;
|
||||
- struct ibv_qp_attr attr;
|
||||
+ struct ibv_qp_attr attr = {};
|
||||
int err = qp->err;
|
||||
|
||||
if (err) {
|
||||
--
|
||||
2.25.1
|
||||
|
||||
64
0074-libhns-Fix-possible-overflow-in-cq-clean.patch
Normal file
64
0074-libhns-Fix-possible-overflow-in-cq-clean.patch
Normal file
@ -0,0 +1,64 @@
|
||||
From 9e3f4aa0a83ea0ff9512678e3932e611186d573e Mon Sep 17 00:00:00 2001
|
||||
From: Chengchang Tang <tangchengchang@huawei.com>
|
||||
Date: Mon, 27 Nov 2023 16:39:50 +0800
|
||||
Subject: [PATCH 74/75] libhns: Fix possible overflow in cq clean
|
||||
|
||||
driver inclusion
|
||||
category: bugfix
|
||||
bugzilla: https://gitee.com/src-openeuler/rdma-core/issues/I8J2XP?from=project-issue
|
||||
|
||||
--------------------------------------------------------------------------
|
||||
|
||||
The ci/pi of hns roce cq allows data to be flipped. but in
|
||||
__hns_roce_v2_cq_clean(), this flip may lead to an wrong number
|
||||
of loops.
|
||||
|
||||
This patch fixes it by extending the data type to avoid data
|
||||
flipping.
|
||||
|
||||
Signed-off-by: Chengchang Tang <tangchengchang@huawei.com>
|
||||
---
|
||||
providers/hns/hns_roce_u_hw_v2.c | 25 +++++++++++++------------
|
||||
1 file changed, 13 insertions(+), 12 deletions(-)
|
||||
|
||||
diff --git a/providers/hns/hns_roce_u_hw_v2.c b/providers/hns/hns_roce_u_hw_v2.c
|
||||
index b48cabd..fc938de 100644
|
||||
--- a/providers/hns/hns_roce_u_hw_v2.c
|
||||
+++ b/providers/hns/hns_roce_u_hw_v2.c
|
||||
@@ -1847,20 +1847,21 @@ out:
|
||||
static void __hns_roce_v2_cq_clean(struct hns_roce_cq *cq, uint32_t qpn,
|
||||
struct hns_roce_srq *srq)
|
||||
{
|
||||
- int nfreed = 0;
|
||||
- bool is_recv_cqe;
|
||||
- uint8_t owner_bit;
|
||||
- uint16_t wqe_index;
|
||||
- uint32_t prod_index;
|
||||
- struct hns_roce_v2_cqe *cqe, *dest;
|
||||
- struct hns_roce_context *ctx = to_hr_ctx(cq->verbs_cq.cq.context);
|
||||
-
|
||||
- for (prod_index = cq->cons_index; get_sw_cqe_v2(cq, prod_index);
|
||||
- ++prod_index)
|
||||
- if (prod_index > cq->cons_index + cq->verbs_cq.cq.cqe)
|
||||
+ struct hns_roce_context *ctx = to_hr_ctx(cq->verbs_cq.cq.context);
|
||||
+ uint64_t cons_index = cq->cons_index;
|
||||
+ uint64_t prod_index = cq->cons_index;
|
||||
+ struct hns_roce_v2_cqe *cqe, *dest;
|
||||
+ uint16_t wqe_index;
|
||||
+ uint8_t owner_bit;
|
||||
+ bool is_recv_cqe;
|
||||
+ int nfreed = 0;
|
||||
+
|
||||
+ for (; get_sw_cqe_v2(cq, prod_index); ++prod_index)
|
||||
+ if (prod_index > cons_index + cq->verbs_cq.cq.cqe)
|
||||
break;
|
||||
|
||||
- while ((int) --prod_index - (int) cq->cons_index >= 0) {
|
||||
+ while (prod_index - cons_index > 0) {
|
||||
+ prod_index--;
|
||||
cqe = get_cqe_v2(cq, prod_index & cq->verbs_cq.cq.cqe);
|
||||
if (hr_reg_read(cqe, CQE_LCL_QPN) == qpn) {
|
||||
is_recv_cqe = hr_reg_read(cqe, CQE_S_R);
|
||||
--
|
||||
2.25.1
|
||||
|
||||
36
0075-libhns-Fix-unnecessary-dca-memory-detach.patch
Normal file
36
0075-libhns-Fix-unnecessary-dca-memory-detach.patch
Normal file
@ -0,0 +1,36 @@
|
||||
From c989f93b01c45f8453bc839722f91ddc8b000037 Mon Sep 17 00:00:00 2001
|
||||
From: Chengchang Tang <tangchengchang@huawei.com>
|
||||
Date: Mon, 27 Nov 2023 16:39:52 +0800
|
||||
Subject: [PATCH 75/75] libhns: Fix unnecessary dca memory detach
|
||||
|
||||
driver inclusion
|
||||
category: bugfix
|
||||
bugzilla: https://gitee.com/src-openeuler/rdma-core/issues/I8J2Y5?from=project-issue
|
||||
|
||||
--------------------------------------------------------------------------
|
||||
|
||||
If sq is not enabled, it should not detach dca mem. Moreover, under the
|
||||
current code logic, if detach dca mem, its sq index will be a random
|
||||
value because it is not initialized.
|
||||
|
||||
Signed-off-by: Chengchang Tang <tangchengchang@huawei.com>
|
||||
---
|
||||
providers/hns/hns_roce_u_hw_v2.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/providers/hns/hns_roce_u_hw_v2.c b/providers/hns/hns_roce_u_hw_v2.c
|
||||
index fc938de..2fb738d 100644
|
||||
--- a/providers/hns/hns_roce_u_hw_v2.c
|
||||
+++ b/providers/hns/hns_roce_u_hw_v2.c
|
||||
@@ -696,7 +696,7 @@ static void dca_detach_qp_buf(struct hns_roce_context *ctx,
|
||||
hns_roce_spin_unlock(&qp->rq.hr_lock);
|
||||
hns_roce_spin_unlock(&qp->sq.hr_lock);
|
||||
|
||||
- if (is_empty)
|
||||
+ if (is_empty && qp->sq.wqe_cnt > 0)
|
||||
hns_roce_detach_dca_mem(ctx, qp->verbs_qp.qp.handle, &attr);
|
||||
}
|
||||
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
Name: rdma-core
|
||||
Version: 41.0
|
||||
Release: 20
|
||||
Release: 21
|
||||
Summary: RDMA core userspace libraries and daemons
|
||||
License: GPLv2 or BSD
|
||||
Url: https://github.com/linux-rdma/rdma-core
|
||||
@ -76,6 +76,11 @@ patch66: 0067-libhns-Support-STARS-mode-QP.patch
|
||||
patch67: 0068-Update-kernel-headers-for-supporting-write-with-noti.patch
|
||||
patch68: 0069-libhns-Support-write-with-notify.patch
|
||||
patch70: 0070-libhns-Get-dmac-from-kernel-driver.patch
|
||||
patch71: 0071-libhns-Corrects-several-issues-with-output-format-an.patch
|
||||
patch72: 0072-libhns-Add-input-parameter-check-for-hnsdv_query_dev.patch
|
||||
patch73: 0073-libhns-Fix-uninitialized-qp-attr-when-flush-cqe.patch
|
||||
patch74: 0074-libhns-Fix-possible-overflow-in-cq-clean.patch
|
||||
patch75: 0075-libhns-Fix-unnecessary-dca-memory-detach.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
|
||||
@ -323,6 +328,12 @@ fi
|
||||
%{_mandir}/*
|
||||
|
||||
%changelog
|
||||
* Mon Nov 27 2023 Ran Zhou <zhouran10@h-partners.com> - 41.0-21
|
||||
- Type: bugfix
|
||||
- ID: NA
|
||||
- SUG: NA
|
||||
- DESC: Corrects several minor issues found in review
|
||||
|
||||
* Wed Nov 22 2023 Ran Zhou <zhouran10@h-partners.com> - 41.0-20
|
||||
- Type: bugfix
|
||||
- ID: NA
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user