aboutsummaryrefslogtreecommitdiffstats
path: root/include/rdma/uverbs_std_types.h
diff options
context:
space:
mode:
authorJason Gunthorpe <jgg@mellanox.com>2018-07-25 21:40:11 -0600
committerJason Gunthorpe <jgg@mellanox.com>2018-08-01 14:55:48 -0600
commit32ed5c00ac5fdea49058fd49bf8707e101dc3dfe (patch)
treee8e6c3e38713d9693556786ac56bff9bcc20ebea /include/rdma/uverbs_std_types.h
parentIB/uverbs: Remove rdma_explicit_destroy() from the ioctl methods (diff)
downloadlinux-dev-32ed5c00ac5fdea49058fd49bf8707e101dc3dfe.tar.xz
linux-dev-32ed5c00ac5fdea49058fd49bf8707e101dc3dfe.zip
IB/uverbs: Make the write path destroy methods use the same flow as ioctl
The ridiculous dance with uobj_remove_commit() is not needed, the write path can follow the same flow as ioctl - lock and destroy the HW object then use the data left over in the uobject to form the response to userspace. Two helpers are introduced to make this flow straightforward for the caller. Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Diffstat (limited to 'include/rdma/uverbs_std_types.h')
-rw-r--r--include/rdma/uverbs_std_types.h16
1 files changed, 11 insertions, 5 deletions
diff --git a/include/rdma/uverbs_std_types.h b/include/rdma/uverbs_std_types.h
index 076f085d2dcf..c2f89e41cbd2 100644
--- a/include/rdma/uverbs_std_types.h
+++ b/include/rdma/uverbs_std_types.h
@@ -84,6 +84,17 @@ int __uobj_perform_destroy(const struct uverbs_obj_type *type, u32 id,
__uobj_perform_destroy(uobj_get_type(_type), _uobj_check_id(_id), \
_ufile, _success_res)
+struct ib_uobject *__uobj_get_destroy(const struct uverbs_obj_type *type,
+ u32 id, struct ib_uverbs_file *ufile);
+
+#define uobj_get_destroy(_type, _id, _ufile) \
+ __uobj_get_destroy(uobj_get_type(_type), _uobj_check_id(_id), _ufile)
+
+static inline void uobj_put_destroy(struct ib_uobject *uobj)
+{
+ rdma_lookup_put_uobject(uobj, true);
+}
+
static inline void uobj_put_read(struct ib_uobject *uobj)
{
rdma_lookup_put_uobject(uobj, false);
@@ -97,11 +108,6 @@ static inline void uobj_put_write(struct ib_uobject *uobj)
rdma_lookup_put_uobject(uobj, true);
}
-static inline int __must_check uobj_remove_commit(struct ib_uobject *uobj)
-{
- return rdma_remove_commit_uobject(uobj);
-}
-
static inline int __must_check uobj_alloc_commit(struct ib_uobject *uobj,
int success_res)
{