@@ -76,6 +76,7 @@ static const struct verbs_context_ops hns_common_ops = {
.reg_mr = hns_roce_u_reg_mr,
.rereg_mr = hns_roce_u_rereg_mr,
.alloc_mw = hns_roce_u_alloc_mw,
+ .dealloc_mw = hns_roce_u_dealloc_mw,
};
static struct verbs_context *hns_roce_alloc_context(struct ibv_device *ibdev,
@@ -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 ret;
+}
+
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(+)