Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Providers/rxe: add dma-buf support #1055

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
21 changes: 21 additions & 0 deletions providers/rxe/rxe.c
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,26 @@ static struct ibv_mr *rxe_reg_mr(struct ibv_pd *pd, void *addr, size_t length,
return &vmr->ibv_mr;
}

static struct ibv_mr *rxe_reg_dmabuf_mr(struct ibv_pd *pd, uint64_t offset,
size_t length, uint64_t iova, int fd,
int access)
{
struct verbs_mr *vmr;
int ret;

vmr = malloc(sizeof(*vmr));
if (!vmr)
return NULL;

ret = ibv_cmd_reg_dmabuf_mr(pd, offset, length, iova, fd, access, vmr);
if (ret) {
free(vmr);
return NULL;
}

return &vmr->ibv_mr;
}

static int rxe_dereg_mr(struct verbs_mr *vmr)
{
int ret;
Expand Down Expand Up @@ -1706,6 +1726,7 @@ static const struct verbs_context_ops rxe_ctx_ops = {
.alloc_pd = rxe_alloc_pd,
.dealloc_pd = rxe_dealloc_pd,
.reg_mr = rxe_reg_mr,
.reg_dmabuf_mr = rxe_reg_dmabuf_mr,
.dereg_mr = rxe_dereg_mr,
.alloc_mw = rxe_alloc_mw,
.dealloc_mw = rxe_dealloc_mw,
Expand Down