]> git.droids-corp.org - dpdk.git/commitdiff
common/mlx5: glue MR registration with IOVA
authorMichael Baum <michaelba@nvidia.com>
Tue, 9 Nov 2021 12:36:08 +0000 (14:36 +0200)
committerThomas Monjalon <thomas@monjalon.net>
Wed, 10 Nov 2021 14:48:53 +0000 (15:48 +0100)
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: cc07a42da250 ("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>
drivers/common/mlx5/linux/meson.build
drivers/common/mlx5/linux/mlx5_glue.c
drivers/common/mlx5/linux/mlx5_glue.h

index 2dcd27b7786ff30032cac334ba8f9289d591014f..7909f23e21dc2a45ed2e02088d1ac01e42c0aea6 100644 (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
index 037ca961a06076c11dc9a6df48d3b0faff8e1d95..bc6622053fcec771c3d27ba18f843359a3cc7eaf 100644 (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,
index f39ef2dac78eb14467b1189b4f4d850f9b3a0282..4e6d31f263e82e42dca9b3027a65734831c16f72 100644 (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)