From: Matan Azrad <matan@nvidia.com>
To: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
Cc: <dev@dpdk.org>, Thomas Monjalon <thomas@monjalon.net>,
Michael Baum <michaelba@oss.nvidia.com>, <stable@dpdk.org>,
Michael Baum <michaelba@nvidia.com>
Subject: [dpdk-stable] [PATCH v3 1/5] common/mlx5: glue MR registration with IOVA
Date: Tue, 9 Nov 2021 14:36:08 +0200 [thread overview]
Message-ID: <20211109123612.2301442-2-matan@nvidia.com> (raw)
In-Reply-To: <20211109123612.2301442-1-matan@nvidia.com>
From: Michael Baum <michaelba@oss.nvidia.com>
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 | 2 ++
drivers/common/mlx5/linux/mlx5_glue.c | 18 ++++++++++++++++++
drivers/common/mlx5/linux/mlx5_glue.h | 3 +++
3 files changed, 23 insertions(+)
diff --git a/drivers/common/mlx5/linux/meson.build b/drivers/common/mlx5/linux/meson.build
index 2dcd27b778..7909f23e21 100644
--- a/drivers/common/mlx5/linux/meson.build
+++ b/drivers/common/mlx5/linux/meson.build
@@ -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
diff --git a/drivers/common/mlx5/linux/mlx5_glue.c b/drivers/common/mlx5/linux/mlx5_glue.c
index 037ca961a0..bc6622053f 100644
--- a/drivers/common/mlx5/linux/mlx5_glue.c
+++ b/drivers/common/mlx5/linux/mlx5_glue.c
@@ -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,
diff --git a/drivers/common/mlx5/linux/mlx5_glue.h b/drivers/common/mlx5/linux/mlx5_glue.h
index f39ef2dac7..4e6d31f263 100644
--- a/drivers/common/mlx5/linux/mlx5_glue.h
+++ b/drivers/common/mlx5/linux/mlx5_glue.h
@@ -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)
--
2.25.1
next prev parent reply other threads:[~2021-11-09 12:36 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20211107152919.2158802-1-matan@nvidia.com>
2021-11-07 15:29 ` [dpdk-stable] [PATCH " Matan Azrad
2021-11-07 15:29 ` [dpdk-stable] [PATCH 2/5] common/mlx5: add wrapped MR create API Matan Azrad
2021-11-07 15:29 ` [dpdk-stable] [PATCH 3/5] vdpa/mlx5: workaround dirty bitmap MR creation Matan Azrad
2021-11-07 15:29 ` [dpdk-stable] [PATCH 4/5] vdpa/mlx5: workaround guest MR registrations Matan Azrad
2021-11-07 15:29 ` [dpdk-stable] [PATCH 5/5] net/mlx5: workaround counter memory region creation Matan Azrad
[not found] ` <20211108172113.2241853-1-matan@nvidia.com>
2021-11-08 17:21 ` [dpdk-stable] [PATCH v2 1/5] common/mlx5: glue MR registration with IOVA Matan Azrad
2021-11-08 17:21 ` [dpdk-stable] [PATCH v2 2/5] common/mlx5: add wrapped MR create API Matan Azrad
2021-11-08 17:21 ` [dpdk-stable] [PATCH v2 3/5] vdpa/mlx5: workaround dirty bitmap MR creation Matan Azrad
2021-11-08 19:38 ` Thomas Monjalon
2021-11-08 17:21 ` [dpdk-stable] [PATCH v2 4/5] vdpa/mlx5: workaround guest MR registrations Matan Azrad
2021-11-08 17:21 ` [dpdk-stable] [PATCH v2 5/5] net/mlx5: workaround MR creation for flow counter Matan Azrad
[not found] ` <20211109123612.2301442-1-matan@nvidia.com>
2021-11-09 12:36 ` Matan Azrad [this message]
2021-11-09 12:36 ` [dpdk-stable] [PATCH v3 2/5] common/mlx5: add wrapped MR create API Matan Azrad
2021-11-09 12:36 ` [dpdk-stable] [PATCH v3 3/5] vdpa/mlx5: workaround dirty bitmap MR creation Matan Azrad
2021-11-09 12:36 ` [dpdk-stable] [PATCH v3 4/5] vdpa/mlx5: workaround guest MR registrations Matan Azrad
2021-11-09 12:36 ` [dpdk-stable] [PATCH v3 5/5] net/mlx5: workaround MR creation for flow counter Matan Azrad
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211109123612.2301442-2-matan@nvidia.com \
--to=matan@nvidia.com \
--cc=dev@dpdk.org \
--cc=michaelba@nvidia.com \
--cc=michaelba@oss.nvidia.com \
--cc=stable@dpdk.org \
--cc=thomas@monjalon.net \
--cc=viacheslavo@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).