rdma-core/0056-libhns-assign-doorbell-to-zero-when-allocate-it.patch

77 lines
2.0 KiB
Diff
Raw Normal View History

From 82f027c27a2dc9eddc5c7d8859d5c8e0a8105b71 Mon Sep 17 00:00:00 2001
From: Chengchang Tang <tangchengchang@huawei.com>
Date: Tue, 26 Sep 2023 19:19:09 +0800
Subject: [PATCH 4/5] libhns: assign doorbell to zero when allocate it
driver inclusion
category: cleanup
bugzilla: https://gitee.com/src-openeuler/rdma-core/issues/I83BP0
----------------------------------------------------------
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 f5acac2..73a71de 100644
--- a/providers/hns/hns_roce_u_db.c
+++ b/providers/hns/hns_roce_u_db.c
@@ -115,6 +115,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 e7a7388..7b58dd0 100644
--- a/providers/hns/hns_roce_u_verbs.c
+++ b/providers/hns/hns_roce_u_verbs.c
@@ -596,8 +596,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;
@@ -938,8 +936,6 @@ static struct ibv_srq *create_srq(struct ibv_context *context,
if (!srq->db)
goto err_srq_buf;
- *srq->db = 0;
-
ret = exec_srq_create_cmd(context, srq, init_attr);
if (ret)
goto err_srq_db;
@@ -1591,8 +1587,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) {
@@ -1604,8 +1598,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.25.1