aboutsummaryrefslogtreecommitdiffstats
path: root/include/rdma/ib_verbs.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/rdma/ib_verbs.h')
-rw-r--r--include/rdma/ib_verbs.h24
1 files changed, 22 insertions, 2 deletions
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index a3ceed3a040a..80debf5982ac 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -2579,9 +2579,10 @@ struct ib_device {
2579 2579
2580 const struct uapi_definition *driver_def; 2580 const struct uapi_definition *driver_def;
2581 enum rdma_driver_id driver_id; 2581 enum rdma_driver_id driver_id;
2582
2582 /* 2583 /*
2583 * Provides synchronization between device unregistration and netlink 2584 * Positive refcount indicates that the device is currently
2584 * commands on a device. To be used only by core. 2585 * registered and cannot be unregistered.
2585 */ 2586 */
2586 refcount_t refcount; 2587 refcount_t refcount;
2587 struct completion unreg_completion; 2588 struct completion unreg_completion;
@@ -3926,6 +3927,25 @@ static inline bool ib_access_writable(int access_flags)
3926int ib_check_mr_status(struct ib_mr *mr, u32 check_mask, 3927int ib_check_mr_status(struct ib_mr *mr, u32 check_mask,
3927 struct ib_mr_status *mr_status); 3928 struct ib_mr_status *mr_status);
3928 3929
3930/**
3931 * ib_device_try_get: Hold a registration lock
3932 * device: The device to lock
3933 *
3934 * A device under an active registration lock cannot become unregistered. It
3935 * is only possible to obtain a registration lock on a device that is fully
3936 * registered, otherwise this function returns false.
3937 *
3938 * The registration lock is only necessary for actions which require the
3939 * device to still be registered. Uses that only require the device pointer to
3940 * be valid should use get_device(&ibdev->dev) to hold the memory.
3941 *
3942 */
3943static inline bool ib_device_try_get(struct ib_device *dev)
3944{
3945 return refcount_inc_not_zero(&dev->refcount);
3946}
3947
3948void ib_device_put(struct ib_device *device);
3929struct net_device *ib_get_net_dev_by_params(struct ib_device *dev, u8 port, 3949struct net_device *ib_get_net_dev_by_params(struct ib_device *dev, u8 port,
3930 u16 pkey, const union ib_gid *gid, 3950 u16 pkey, const union ib_gid *gid,
3931 const struct sockaddr *addr); 3951 const struct sockaddr *addr);