aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/core/uverbs_main.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/infiniband/core/uverbs_main.c')
-rw-r--r--drivers/infiniband/core/uverbs_main.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/infiniband/core/uverbs_main.c b/drivers/infiniband/core/uverbs_main.c
index 56898b6578a4..bb9dcea8fede 100644
--- a/drivers/infiniband/core/uverbs_main.c
+++ b/drivers/infiniband/core/uverbs_main.c
@@ -72,6 +72,7 @@ DEFINE_IDR(ib_uverbs_ah_idr);
72DEFINE_IDR(ib_uverbs_cq_idr); 72DEFINE_IDR(ib_uverbs_cq_idr);
73DEFINE_IDR(ib_uverbs_qp_idr); 73DEFINE_IDR(ib_uverbs_qp_idr);
74DEFINE_IDR(ib_uverbs_srq_idr); 74DEFINE_IDR(ib_uverbs_srq_idr);
75DEFINE_IDR(ib_uverbs_xrcd_idr);
75 76
76static DEFINE_SPINLOCK(map_lock); 77static DEFINE_SPINLOCK(map_lock);
77static DECLARE_BITMAP(dev_map, IB_UVERBS_MAX_DEVICES); 78static DECLARE_BITMAP(dev_map, IB_UVERBS_MAX_DEVICES);
@@ -107,6 +108,8 @@ static ssize_t (*uverbs_cmd_table[])(struct ib_uverbs_file *file,
107 [IB_USER_VERBS_CMD_MODIFY_SRQ] = ib_uverbs_modify_srq, 108 [IB_USER_VERBS_CMD_MODIFY_SRQ] = ib_uverbs_modify_srq,
108 [IB_USER_VERBS_CMD_QUERY_SRQ] = ib_uverbs_query_srq, 109 [IB_USER_VERBS_CMD_QUERY_SRQ] = ib_uverbs_query_srq,
109 [IB_USER_VERBS_CMD_DESTROY_SRQ] = ib_uverbs_destroy_srq, 110 [IB_USER_VERBS_CMD_DESTROY_SRQ] = ib_uverbs_destroy_srq,
111 [IB_USER_VERBS_CMD_OPEN_XRCD] = ib_uverbs_open_xrcd,
112 [IB_USER_VERBS_CMD_CLOSE_XRCD] = ib_uverbs_close_xrcd,
110}; 113};
111 114
112static void ib_uverbs_add_one(struct ib_device *device); 115static void ib_uverbs_add_one(struct ib_device *device);
@@ -241,6 +244,18 @@ static int ib_uverbs_cleanup_ucontext(struct ib_uverbs_file *file,
241 kfree(uobj); 244 kfree(uobj);
242 } 245 }
243 246
247 mutex_lock(&file->device->xrcd_tree_mutex);
248 list_for_each_entry_safe(uobj, tmp, &context->xrcd_list, list) {
249 struct ib_xrcd *xrcd = uobj->object;
250 struct ib_uxrcd_object *uxrcd =
251 container_of(uobj, struct ib_uxrcd_object, uobject);
252
253 idr_remove_uobj(&ib_uverbs_xrcd_idr, uobj);
254 ib_uverbs_dealloc_xrcd(file->device, xrcd);
255 kfree(uxrcd);
256 }
257 mutex_unlock(&file->device->xrcd_tree_mutex);
258
244 list_for_each_entry_safe(uobj, tmp, &context->pd_list, list) { 259 list_for_each_entry_safe(uobj, tmp, &context->pd_list, list) {
245 struct ib_pd *pd = uobj->object; 260 struct ib_pd *pd = uobj->object;
246 261
@@ -741,6 +756,8 @@ static void ib_uverbs_add_one(struct ib_device *device)
741 756
742 kref_init(&uverbs_dev->ref); 757 kref_init(&uverbs_dev->ref);
743 init_completion(&uverbs_dev->comp); 758 init_completion(&uverbs_dev->comp);
759 uverbs_dev->xrcd_tree = RB_ROOT;
760 mutex_init(&uverbs_dev->xrcd_tree_mutex);
744 761
745 spin_lock(&map_lock); 762 spin_lock(&map_lock);
746 devnum = find_first_zero_bit(dev_map, IB_UVERBS_MAX_DEVICES); 763 devnum = find_first_zero_bit(dev_map, IB_UVERBS_MAX_DEVICES);