mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-07-22 02:17:36 -04:00
RDMA/core: Introduce generic buffer descriptor infrastructure for umem
Introduce a per-attribute UVERBS_ATTR_UMEM model so each uverbs command's umem set is explicit in its UAPI definition. Add driver-facing wrapper helpers that pin a umem on demand from an attribute or a VA addr; the driver owns the returned umem and releases it from its destroy/error paths. Link: https://patch.msgid.link/r/20260529134312.2836341-4-jiri@resnulli.us Signed-off-by: Jiri Pirko <jiri@nvidia.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
This commit is contained in:
committed by
Jason Gunthorpe
parent
28fb701c64
commit
3cfdff484d
@@ -273,4 +273,31 @@ struct ib_uverbs_gid_entry {
|
||||
__u32 netdev_ifindex; /* It is 0 if there is no netdev associated with it */
|
||||
};
|
||||
|
||||
enum ib_uverbs_buffer_type {
|
||||
IB_UVERBS_BUFFER_TYPE_DMABUF,
|
||||
IB_UVERBS_BUFFER_TYPE_VA,
|
||||
};
|
||||
|
||||
/*
|
||||
* Describes a single buffer backed by dma-buf or user virtual address.
|
||||
* Used as the payload of a per-attribute UVERBS_ATTR_UMEM-typed attribute.
|
||||
*
|
||||
* @type: buffer type from enum ib_uverbs_buffer_type
|
||||
* @fd: dma-buf file descriptor (valid for IB_UVERBS_BUFFER_TYPE_DMABUF)
|
||||
* @flags: required flags; the kernel rejects the call with -EINVAL if any
|
||||
* bit is not understood. No bits are defined yet.
|
||||
* @optional_flags: advisory flags; bits the kernel does not understand are
|
||||
* silently ignored. No bits are defined yet.
|
||||
* @addr: offset within dma-buf, or user virtual address for VA
|
||||
* @length: buffer length in bytes
|
||||
*/
|
||||
struct ib_uverbs_buffer_desc {
|
||||
__u32 type;
|
||||
__s32 fd;
|
||||
__u32 flags;
|
||||
__u32 optional_flags;
|
||||
__aligned_u64 addr;
|
||||
__aligned_u64 length;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user