@@ -67,6 +67,7 @@ static const struct verbs_context_ops hns_common_ops = {
.cq_event = hns_roce_u_cq_event,
.create_cq = hns_roce_u_create_cq,
.create_qp = hns_roce_u_create_qp,
+ .dealloc_mw = hns_roce_u_dealloc_mw,
.dealloc_pd = hns_roce_u_free_pd,
.dereg_mr = hns_roce_u_dereg_mr,
.destroy_cq = hns_roce_u_destroy_cq,
@@ -276,6 +276,7 @@ int hns_roce_u_rereg_mr(struct verbs_mr *mr, int flags, struct ibv_pd *pd,
int hns_roce_u_dereg_mr(struct verbs_mr *mr);
struct ibv_mw *hns_roce_u_alloc_mw(struct ibv_pd *pd, enum ibv_mw_type type);
+int hns_roce_u_dealloc_mw(struct ibv_mw *mw);
struct ibv_cq *hns_roce_u_create_cq(struct ibv_context *context, int cqe,
struct ibv_comp_channel *channel,
@@ -194,6 +194,19 @@ struct ibv_mw *hns_roce_u_alloc_mw(struct ibv_pd *pd, enum ibv_mw_type type)
return mw;
}
+int hns_roce_u_dealloc_mw(struct ibv_mw *mw)
+{
+ int ret;
+
+ ret = ibv_cmd_dealloc_mw(mw);
+ if (ret)
+ return ret;
+
+ free(mw);
+
+ return 0;
+}
+
static int align_cq_size(int req)
{
int nent;
This patch adds memory window (mw) deallocation support in user space driver. Signed-off-by: Yixian Liu <liuyixian@huawei.com> --- providers/hns/hns_roce_u.c | 1 + providers/hns/hns_roce_u.h | 1 + providers/hns/hns_roce_u_verbs.c | 13 +++++++++++++ 3 files changed, 15 insertions(+)