[PATCH rdma-core 4/6] libhns: Add destroy srq verbs for hip08 user mode

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This patch mainly implement the verbs of destroying srq
for hip08 userspace library.

Signed-off-by: Lijun Ou <oulijun@xxxxxxxxxx>
---
 providers/hns/hns_roce_u.c       |  1 +
 providers/hns/hns_roce_u.h       |  1 +
 providers/hns/hns_roce_u_verbs.c | 19 +++++++++++++++++++
 3 files changed, 21 insertions(+)

diff --git a/providers/hns/hns_roce_u.c b/providers/hns/hns_roce_u.c
index 9b46e25..58256ee 100644
--- a/providers/hns/hns_roce_u.c
+++ b/providers/hns/hns_roce_u.c
@@ -81,6 +81,7 @@ static const struct verbs_context_ops hns_common_ops = {
 	.create_srq = hns_roce_u_create_srq,
 	.modify_srq = hns_roce_u_modify_srq,
 	.query_srq = hns_roce_u_query_srq,
+	.destroy_srq = hns_roce_u_destroy_srq,
 };
 
 static struct verbs_context *hns_roce_alloc_context(struct ibv_device *ibdev,
diff --git a/providers/hns/hns_roce_u.h b/providers/hns/hns_roce_u.h
index 2b307e3..5248a53 100644
--- a/providers/hns/hns_roce_u.h
+++ b/providers/hns/hns_roce_u.h
@@ -306,6 +306,7 @@ struct ibv_srq *hns_roce_u_create_srq(struct ibv_pd *pd,
 int hns_roce_u_modify_srq(struct ibv_srq *srq, struct ibv_srq_attr *srq_attr,
 			  int srq_attr_mask);
 int hns_roce_u_query_srq(struct ibv_srq *srq, struct ibv_srq_attr *srq_attr);
+int hns_roce_u_destroy_srq(struct ibv_srq *srq);
 struct ibv_qp *hns_roce_u_create_qp(struct ibv_pd *pd,
 				    struct ibv_qp_init_attr *attr);
 
diff --git a/providers/hns/hns_roce_u_verbs.c b/providers/hns/hns_roce_u_verbs.c
index 5106a35..6f54066 100644
--- a/providers/hns/hns_roce_u_verbs.c
+++ b/providers/hns/hns_roce_u_verbs.c
@@ -596,6 +596,25 @@ int hns_roce_u_query_srq(struct ibv_srq *srq, struct ibv_srq_attr *srq_attr)
 	return ibv_cmd_query_srq(srq, srq_attr, &cmd, sizeof(cmd));
 }
 
+int hns_roce_u_destroy_srq(struct ibv_srq *srq)
+{
+	int ret;
+
+	ret = ibv_cmd_destroy_srq(srq);
+	if (ret)
+		return ret;
+
+	hns_roce_free_db(to_hr_ctx(srq->context), to_hr_srq(srq)->db,
+			 HNS_ROCE_QP_TYPE_DB);
+	hns_roce_free_buf(&to_hr_srq(srq)->buf);
+	free(to_hr_srq(srq)->wrid);
+	hns_roce_free_buf(&to_hr_srq(srq)->idx_que.buf);
+	free(to_hr_srq(srq)->idx_que.bitmap);
+	free(to_hr_srq(srq));
+
+	return 0;
+}
+
 static int hns_roce_verify_qp(struct ibv_qp_init_attr *attr,
 			      struct hns_roce_context *context)
 {
-- 
2.8.1




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux