libibverbs: Add DMA-buf fd export for ibv_buf#1770
Open
jpirko wants to merge 3 commits into
Open
Conversation
added 3 commits
July 14, 2026 16:41
Add ibv_export_buf_dmabuf_fd() so applications can obtain a caller-owned DMA-buf file descriptor from provider-aware buffers that are backed by DMA-buf memory. Signed-off-by: Jiri Pirko <jiri@nvidia.com>
Allow Python users to retrieve a caller-owned DMA-buf file descriptor from a Buf's backing memory. Signed-off-by: Jiri Pirko <jiri@nvidia.com>
Add buffer API checks for successful fd export on DMA-buf backed buffers and ENODATA on ordinary memory buffers. Signed-off-by: Jiri Pirko <jiri@nvidia.com>
10000TB
reviewed
Jul 18, 2026
|
|
||
| int ibv_export_buf_dmabuf_fd(struct ibv_buf *buf) | ||
| { | ||
| if (buf->dmabuf_fd < 0) { |
There was a problem hiding this comment.
I wonder how do you feel about a potential view that this conflates (1) *buf is backed by VA, and (2) dmabuf *buf has a bad fd ?
Thinking of sth like enum ibv_buf_alloc_type alloc_type; as part of ibv_buf, so we return EOPNOTSUPP on .type != IBV_BUF_ALLOC_TYPE_DMABUF, and ENODATA on bad dmabuf fd.
But not having a .type within ibv_but does keep it simple, and distinguishing between (1) and (2) may not add much value.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add
ibv_export_buf_dmabuf_fd()so applications can pass DMA-buf-backed provider allocations to APIs that import DMA-buf file descriptors.Expose it through pyverbs, document the API, and add test coverage.