common/mlx5: glue MR registration with IOVA

Add support for rdma-core API to register IOVA MR.
The API gets the process VA, size, and IOVA and returns a memory region
with space pointed by a specific IOVA.

So any access in this MR should come with an address that is relative to
the IOVA specified in the API.

Fixes: cc07a42da2 ("vdpa/mlx5: prepare memory regions")
Cc: stable@dpdk.org

Signed-off-by: Michael Baum <michaelba@nvidia.com>
Signed-off-by: Matan Azrad <matan@nvidia.com>
This commit is contained in:
Michael Baum 2021-11-09 14:36:08 +02:00 committed by Thomas Monjalon
parent 2ff801515e
commit 6ebd062e06
3 changed files with 23 additions and 0 deletions

View File

@ -200,6 +200,8 @@ has_sym_args = [
'MLX5DV_DR_ACTION_FLAGS_ASO_CT_DIRECTION_INITIATOR' ],
[ 'HAVE_MLX5_DR_ALLOW_DUPLICATE', 'infiniband/mlx5dv.h',
'mlx5dv_dr_domain_allow_duplicate_rules' ],
[ 'HAVE_MLX5_IBV_REG_MR_IOVA', 'infiniband/verbs.h',
'ibv_reg_mr_iova' ],
]
config = configuration_data()
foreach arg:has_sym_args

View File

@ -224,6 +224,23 @@ mlx5_glue_reg_mr(struct ibv_pd *pd, void *addr, size_t length, int access)
return ibv_reg_mr(pd, addr, length, access);
}
static struct ibv_mr *
mlx5_glue_reg_mr_iova(struct ibv_pd *pd, void *addr, size_t length,
uint64_t iova, int access)
{
#ifdef HAVE_MLX5_IBV_REG_MR_IOVA
return ibv_reg_mr_iova(pd, addr, length, iova, access);
#else
(void)pd;
(void)addr;
(void)length;
(void)iova;
(void)access;
errno = ENOTSUP;
return NULL;
#endif
}
static struct ibv_mr *
mlx5_glue_alloc_null_mr(struct ibv_pd *pd)
{
@ -1412,6 +1429,7 @@ const struct mlx5_glue *mlx5_glue = &(const struct mlx5_glue) {
.destroy_qp = mlx5_glue_destroy_qp,
.modify_qp = mlx5_glue_modify_qp,
.reg_mr = mlx5_glue_reg_mr,
.reg_mr_iova = mlx5_glue_reg_mr_iova,
.alloc_null_mr = mlx5_glue_alloc_null_mr,
.dereg_mr = mlx5_glue_dereg_mr,
.create_counter_set = mlx5_glue_create_counter_set,

View File

@ -197,6 +197,9 @@ struct mlx5_glue {
int attr_mask);
struct ibv_mr *(*reg_mr)(struct ibv_pd *pd, void *addr,
size_t length, int access);
struct ibv_mr *(*reg_mr_iova)(struct ibv_pd *pd, void *addr,
size_t length, uint64_t iova,
int access);
struct ibv_mr *(*alloc_null_mr)(struct ibv_pd *pd);
int (*dereg_mr)(struct ibv_mr *mr);
struct ibv_counter_set *(*create_counter_set)