diff options
author | Jason Gunthorpe <jgg@mellanox.com> | 2018-07-26 06:40:11 +0300 |
---|---|---|
committer | Jason Gunthorpe <jgg@mellanox.com> | 2018-08-01 23:55:48 +0300 |
commit | 32ed5c00ac5fdea49058fd49bf8707e101dc3dfe (patch) | |
tree | e8e6c3e38713d9693556786ac56bff9bcc20ebea /include | |
parent | aa72c9a5f986444f5e245767402ed1f3066fca2c (diff) | |
download | linux-32ed5c00ac5fdea49058fd49bf8707e101dc3dfe.tar.xz |
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')
-rw-r--r-- | include/rdma/uverbs_std_types.h | 16 | ||||
-rw-r--r-- | include/rdma/uverbs_types.h | 1 |
2 files changed, 11 insertions, 6 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) { diff --git a/include/rdma/uverbs_types.h b/include/rdma/uverbs_types.h index cfc50fcdbff6..8bae28dd2e4f 100644 --- a/include/rdma/uverbs_types.h +++ b/include/rdma/uverbs_types.h @@ -126,7 +126,6 @@ void rdma_lookup_put_uobject(struct ib_uobject *uobj, bool exclusive); struct ib_uobject *rdma_alloc_begin_uobject(const struct uverbs_obj_type *type, struct ib_uverbs_file *ufile); void rdma_alloc_abort_uobject(struct ib_uobject *uobj); -int __must_check rdma_remove_commit_uobject(struct ib_uobject *uobj); int __must_check rdma_alloc_commit_uobject(struct ib_uobject *uobj); int rdma_explicit_destroy(struct ib_uobject *uobject); |