History

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.

Jiri Pirko committed 5 months ago

Commit 3cfdff41 parent 28fb7015 files · +346 −0Browse files

Showing the changes to include/uapi (1 of 5 files). Show all

Unified · Split

include/uapi/rdma/ib_user_ioctl_verbs.h+27−0
@@ -273,4 +273,31 @@ struct ib_uverbs_gid_entry { · 272 unmodified lines
273 __u32 netdev_ifindex; /* It is 0 if there is no netdev associated with it */273 __u32 netdev_ifindex; /* It is 0 if there is no netdev associated with it */
274};274};
275 275
276enum ib_uverbs_buffer_type {
277 IB_UVERBS_BUFFER_TYPE_DMABUF,
278 IB_UVERBS_BUFFER_TYPE_VA,
279};
280
281/*
282 * Describes a single buffer backed by dma-buf or user virtual address.
283 * Used as the payload of a per-attribute UVERBS_ATTR_UMEM-typed attribute.
284 *
285 * @type: buffer type from enum ib_uverbs_buffer_type
286 * @fd: dma-buf file descriptor (valid for IB_UVERBS_BUFFER_TYPE_DMABUF)
287 * @flags: required flags; the kernel rejects the call with -EINVAL if any
288 * bit is not understood. No bits are defined yet.
289 * @optional_flags: advisory flags; bits the kernel does not understand are
290 * silently ignored. No bits are defined yet.
291 * @addr: offset within dma-buf, or user virtual address for VA
292 * @length: buffer length in bytes
293 */
294struct ib_uverbs_buffer_desc {
295 __u32 type;
296 __s32 fd;
297 __u32 flags;
298 __u32 optional_flags;
299 __aligned_u64 addr;
300 __aligned_u64 length;
301};
302
276#endif303#endif