Skip to content

Commit

Permalink
providers/irdma: Add support to re-register a memory region.
Browse files Browse the repository at this point in the history
Add API callback to support re-registering a  memory region.

Signed-off-by: Sindhu Devale <[email protected]>
Signed-off-by: Tatyana Nikolova <[email protected]>
  • Loading branch information
Sindhu-Devale authored and tatyana-en committed Oct 3, 2023
1 parent 458632c commit af372b8
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 0 deletions.
2 changes: 2 additions & 0 deletions providers/irdma/abi.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ DECLARE_DRV_CMD(irdma_get_context, IB_USER_VERBS_CMD_GET_CONTEXT,
irdma_alloc_ucontext_req, irdma_alloc_ucontext_resp);
DECLARE_DRV_CMD(irdma_ureg_mr, IB_USER_VERBS_CMD_REG_MR,
irdma_mem_reg_req, empty);
DECLARE_DRV_CMD(irdma_urereg_mr, IB_USER_VERBS_CMD_REREG_MR,
irdma_mem_reg_req, empty);
DECLARE_DRV_CMD(irdma_ucreate_ah, IB_USER_VERBS_CMD_CREATE_AH,
empty, irdma_create_ah_resp);

Expand Down
1 change: 1 addition & 0 deletions providers/irdma/umain.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ static const struct verbs_context_ops irdma_uctx_ops = {
.query_qp = irdma_uquery_qp,
.reg_dmabuf_mr = irdma_ureg_mr_dmabuf,
.reg_mr = irdma_ureg_mr,
.rereg_mr = irdma_urereg_mr,
.req_notify_cq = irdma_uarm_cq,
.resize_cq = irdma_uresize_cq,
.free_context = irdma_ufree_context,
Expand Down
2 changes: 2 additions & 0 deletions providers/irdma/umain.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ struct ibv_mr *irdma_ureg_mr_dmabuf(struct ibv_pd *pd, uint64_t offset,
size_t length, uint64_t iova, int fd,
int access);
int irdma_udereg_mr(struct verbs_mr *vmr);
int irdma_urereg_mr(struct verbs_mr *mr, int flags, struct ibv_pd *pd,
void *addr, size_t length, int access);
struct ibv_mw *irdma_ualloc_mw(struct ibv_pd *pd, enum ibv_mw_type type);
int irdma_ubind_mw(struct ibv_qp *qp, struct ibv_mw *mw,
struct ibv_mw_bind *mw_bind);
Expand Down
21 changes: 21 additions & 0 deletions providers/irdma/uverbs.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,27 @@ struct ibv_mr *irdma_ureg_mr_dmabuf(struct ibv_pd *pd, uint64_t offset,
return &umr->vmr.ibv_mr;
}

/*
* irdma_urereg_mr - re-register memory region
* @vmr: mr that was allocated
* @flags: bit mask to indicate which of the attr's of MR modified
* @pd: pd of the mr
* @addr: user address of the memory region
* @length: length of the memory
* @access: access allowed on this mr
*/
int irdma_urereg_mr(struct verbs_mr *vmr, int flags, struct ibv_pd *pd,
void *addr, size_t length, int access)
{
struct irdma_urereg_mr cmd = {};
struct ib_uverbs_rereg_mr_resp resp;

cmd.reg_type = IRDMA_MEMREG_TYPE_MEM;
return ibv_cmd_rereg_mr(vmr, flags, addr, length, (uintptr_t)addr,
access, pd, &cmd.ibv_cmd, sizeof(cmd), &resp,
sizeof(resp));
}

/**
* irdma_udereg_mr - re-register memory region
* @vmr: mr that was allocated
Expand Down

0 comments on commit af372b8

Please sign in to comment.