rdma-core/0016-libhns-assign-doorbell-to-zero-when-allocate-it.patch
Ran Zhou e56042b4e2 Support reporting wc as software mode.
When HW is in resetting stage, we could not poll back all the
expected work completions as the HW won't generate cqe anymore.
This patch allows driver to compose the expected wc instead of the HW
during resetting stage. Once the hardware finished resetting, we can
poll cq from hardware again.

Signed-off-by: Ran Zhou <zhouran10@h-partners.com>
(cherry picked from commit 5494e44cf97e65d858c8f7376c0424a833dc8323)
2024-03-28 20:21:14 +08:00

77 lines
2.0 KiB
Diff

From 2c11318d6a06ba6afd6efd91b2881b9fa05f35f6 Mon Sep 17 00:00:00 2001
From: Chengchang Tang <tangchengchang@huawei.com>
Date: Tue, 26 Sep 2023 19:19:09 +0800
Subject: [PATCH 16/18] libhns: assign doorbell to zero when allocate it
driver inclusion
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I98HQV
--------------------------------------------------------------------------
Clear the doorbell when getting it to avoid clearing it in each
function that uses hns_roce_alloc_db()
Signed-off-by: Chengchang Tang <tangchengchang@huawei.com>
---
providers/hns/hns_roce_u_db.c | 2 ++
providers/hns/hns_roce_u_verbs.c | 8 --------
2 files changed, 2 insertions(+), 8 deletions(-)
diff --git a/providers/hns/hns_roce_u_db.c b/providers/hns/hns_roce_u_db.c
index 0314254..bbef988 100644
--- a/providers/hns/hns_roce_u_db.c
+++ b/providers/hns/hns_roce_u_db.c
@@ -116,6 +116,8 @@ found:
out:
pthread_mutex_unlock((pthread_mutex_t *)&ctx->db_list_mutex);
+ if (db)
+ *((unsigned int *)db) = 0;
return db;
}
diff --git a/providers/hns/hns_roce_u_verbs.c b/providers/hns/hns_roce_u_verbs.c
index 3f23715..69bcc13 100644
--- a/providers/hns/hns_roce_u_verbs.c
+++ b/providers/hns/hns_roce_u_verbs.c
@@ -576,8 +576,6 @@ static struct ibv_cq_ex *create_cq(struct ibv_context *context,
goto err_db;
}
- *cq->db = 0;
-
ret = hns_roce_init_cq_swc(cq, attr);
if (ret)
goto err_swc;
@@ -921,8 +919,6 @@ static struct ibv_srq *create_srq(struct ibv_context *context,
if (!srq->rdb)
goto err_srq_buf;
- *srq->rdb = 0;
-
ret = exec_srq_create_cmd(context, srq, init_attr);
if (ret)
goto err_srq_db;
@@ -1505,8 +1501,6 @@ static int qp_alloc_db(struct ibv_qp_init_attr_ex *attr, struct hns_roce_qp *qp,
qp->sdb = hns_roce_alloc_db(ctx, HNS_ROCE_QP_TYPE_DB);
if (!qp->sdb)
return -ENOMEM;
-
- *qp->sdb = 0;
}
if (attr->cap.max_recv_sge) {
@@ -1518,8 +1512,6 @@ static int qp_alloc_db(struct ibv_qp_init_attr_ex *attr, struct hns_roce_qp *qp,
return -ENOMEM;
}
-
- *qp->rdb = 0;
}
return 0;
--
2.33.0