1 Star 0 Fork 46

huwentao/rdma-core

forked from src-openEuler/rdma-core 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0016-libhns-Assign-doorbell-to-zero-when-allocate-it.patch 2.32 KB
一键复制 编辑 原始数据 按行查看 历史
Juan Zhou 提交于 2024-05-10 15:46 . Some bugfixes and cleanups
From 62e56376912213cab92a4378a719d037fef61cd4 Mon Sep 17 00:00:00 2001
From: Chengchang Tang <tangchengchang@huawei.com>
Date: Thu, 18 Apr 2024 13:49:32 +0800
Subject: [PATCH] libhns: Assign doorbell to zero when allocate it
mainline inclusion
from mainline-master
commit 2af6b0f3262c432f35cb6a92de50c4e93b63b6af
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I9NZME
CVE: NA
Reference: https://github.com/linux-rdma/rdma-core/pull/1450/commits/2af6b0f3262c432f35cb6a92de50c4e93b63b6af
----------------------------------------------------------------------
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>
Signed-off-by: Junxian Huang <huangjunxian6@hisilicon.com>
Signed-off-by: Juan Zhou <zhoujuan51@h-partners.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
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/huwentao0417/rdma-core.git
git@gitee.com:huwentao0417/rdma-core.git
huwentao0417
rdma-core
rdma-core
master

搜索帮助