summaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/core/uverbs.h
diff options
context:
space:
mode:
authorYishai Hadas <yishaih@mellanox.com>2020-05-19 10:27:07 +0300
committerJason Gunthorpe <jgg@mellanox.com>2020-05-21 20:34:53 -0300
commitcda9ee494248b890973f5d31cf7851c0d21755b9 (patch)
tree7fc742f2de7f1dba4a7a101fa4145a6bfcb71cd9 /drivers/infiniband/core/uverbs.h
parent98a8890f73489416a1ea49a644565a244d3f729a (diff)
downloadlinux-cda9ee494248b890973f5d31cf7851c0d21755b9.tar.bz2
IB/uverbs: Extend CQ to get its own asynchronous event FD
Extend CQ to get its own asynchronous event FD. The event FD is an optional attribute, in case wasn't given the ufile event FD will be used. Link: https://lore.kernel.org/r/20200519072711.257271-4-leon@kernel.org Signed-off-by: Yishai Hadas <yishaih@mellanox.com> Signed-off-by: Leon Romanovsky <leonro@mellanox.com> Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
Diffstat (limited to 'drivers/infiniband/core/uverbs.h')
-rw-r--r--drivers/infiniband/core/uverbs.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/drivers/infiniband/core/uverbs.h b/drivers/infiniband/core/uverbs.h
index 34c155f88317..53a10479958b 100644
--- a/drivers/infiniband/core/uverbs.h
+++ b/drivers/infiniband/core/uverbs.h
@@ -297,6 +297,24 @@ static inline u32 make_port_cap_flags(const struct ib_port_attr *attr)
return res;
}
+static inline struct ib_uverbs_async_event_file *
+ib_uverbs_get_async_event(struct uverbs_attr_bundle *attrs,
+ u16 id)
+{
+ struct ib_uobject *async_ev_file_uobj;
+ struct ib_uverbs_async_event_file *async_ev_file;
+
+ async_ev_file_uobj = uverbs_attr_get_uobject(attrs, id);
+ if (IS_ERR(async_ev_file_uobj))
+ async_ev_file = READ_ONCE(attrs->ufile->default_async_file);
+ else
+ async_ev_file = container_of(async_ev_file_uobj,
+ struct ib_uverbs_async_event_file,
+ uobj);
+ if (async_ev_file)
+ uverbs_uobject_get(&async_ev_file->uobj);
+ return async_ev_file;
+}
void copy_port_attr_to_resp(struct ib_port_attr *attr,
struct ib_uverbs_query_port_resp *resp,