All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Monjalon <thomas@monjalon.net>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>,
	Gregory Etelson <getelson@nvidia.com>,
	Dariusz Sosnowski <dsosnowski@nvidia.com>,
	Viacheslav Ovsiienko <viacheslavo@nvidia.com>,
	Bing Zhao <bingz@nvidia.com>, Ori Kam <orika@nvidia.com>,
	Suanming Mou <suanmingm@nvidia.com>,
	Matan Azrad <matan@nvidia.com>
Subject: [PATCH v3 04/10] common/mlx5: add null MR functions
Date: Thu, 28 May 2026 14:46:31 +0200	[thread overview]
Message-ID: <20260528124758.1984528-5-thomas@monjalon.net> (raw)
In-Reply-To: <20260528124758.1984528-1-thomas@monjalon.net>

From: Gregory Etelson <getelson@nvidia.com>

Add functions to allocate and free a null Memory Region (MR)
using ibverbs on Linux.

There is no implementation for DevX on Windows.

Signed-off-by: Gregory Etelson <getelson@nvidia.com>
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
 drivers/common/mlx5/linux/mlx5_common_verbs.c | 35 +++++++++++++++++++
 drivers/common/mlx5/mlx5_common_mr.h          |  9 +++++
 drivers/common/mlx5/windows/mlx5_common_os.c  | 16 +++++++++
 3 files changed, 60 insertions(+)

diff --git a/drivers/common/mlx5/linux/mlx5_common_verbs.c b/drivers/common/mlx5/linux/mlx5_common_verbs.c
index 2322d9d033..6d44e1f566 100644
--- a/drivers/common/mlx5/linux/mlx5_common_verbs.c
+++ b/drivers/common/mlx5/linux/mlx5_common_verbs.c
@@ -161,3 +161,38 @@ mlx5_os_set_reg_mr_cb(mlx5_reg_mr_t *reg_mr_cb, mlx5_dereg_mr_t *dereg_mr_cb)
 	*reg_mr_cb = mlx5_common_verbs_reg_mr;
 	*dereg_mr_cb = mlx5_common_verbs_dereg_mr;
 }
+
+RTE_EXPORT_INTERNAL_SYMBOL(mlx5_os_alloc_null_mr)
+struct mlx5_pmd_mr *
+mlx5_os_alloc_null_mr(struct rte_device *dev, void *pd)
+{
+	struct ibv_mr *ibv_mr;
+	struct mlx5_pmd_mr *null_mr;
+
+	null_mr = mlx5_malloc(MLX5_MEM_ZERO, sizeof(*null_mr), 0, dev->numa_node);
+	if (!null_mr)
+		return NULL;
+	ibv_mr = mlx5_glue->alloc_null_mr(pd);
+	if (!ibv_mr) {
+		mlx5_free(null_mr);
+		return NULL;
+	}
+	*null_mr = (struct mlx5_pmd_mr) {
+		.lkey = rte_cpu_to_be_32(ibv_mr->lkey),
+		.addr = ibv_mr->addr,
+		.len = ibv_mr->length,
+		.obj = (void *)ibv_mr,
+	};
+	return null_mr;
+}
+
+RTE_EXPORT_INTERNAL_SYMBOL(mlx5_os_free_null_mr)
+void
+mlx5_os_free_null_mr(struct mlx5_pmd_mr *null_mr)
+{
+	if (!null_mr)
+		return;
+	if (null_mr->obj)
+		claim_zero(mlx5_glue->dereg_mr(null_mr->obj));
+	mlx5_free(null_mr);
+}
diff --git a/drivers/common/mlx5/mlx5_common_mr.h b/drivers/common/mlx5/mlx5_common_mr.h
index cf7c685e9b..00f3d832c3 100644
--- a/drivers/common/mlx5/mlx5_common_mr.h
+++ b/drivers/common/mlx5/mlx5_common_mr.h
@@ -21,6 +21,8 @@
 #include "mlx5_common_mp.h"
 #include "mlx5_common_defs.h"
 
+struct rte_device;
+
 /* mlx5 PMD MR struct. */
 struct mlx5_pmd_mr {
 	uint32_t	     lkey;
@@ -258,6 +260,13 @@ __rte_internal
 void
 mlx5_os_set_reg_mr_cb(mlx5_reg_mr_t *reg_mr_cb, mlx5_dereg_mr_t *dereg_mr_cb);
 
+__rte_internal
+struct mlx5_pmd_mr *
+mlx5_os_alloc_null_mr(struct rte_device *dev, void *pd);
+__rte_internal
+void
+mlx5_os_free_null_mr(struct mlx5_pmd_mr *null_mr);
+
 __rte_internal
 int
 mlx5_mr_mempool_register(struct mlx5_common_device *cdev,
diff --git a/drivers/common/mlx5/windows/mlx5_common_os.c b/drivers/common/mlx5/windows/mlx5_common_os.c
index 16fcc5f9fc..692517a9bf 100644
--- a/drivers/common/mlx5/windows/mlx5_common_os.c
+++ b/drivers/common/mlx5/windows/mlx5_common_os.c
@@ -454,6 +454,22 @@ mlx5_os_set_reg_mr_cb(mlx5_reg_mr_t *reg_mr_cb, mlx5_dereg_mr_t *dereg_mr_cb)
 	*dereg_mr_cb = mlx5_os_dereg_mr;
 }
 
+RTE_EXPORT_INTERNAL_SYMBOL(mlx5_os_alloc_null_mr)
+struct mlx5_pmd_mr *
+mlx5_os_alloc_null_mr(struct rte_device *dev, void *pd)
+{
+	RTE_SET_USED(dev);
+	RTE_SET_USED(pd);
+	return NULL;
+}
+
+RTE_EXPORT_INTERNAL_SYMBOL(mlx5_os_free_null_mr)
+void
+mlx5_os_free_null_mr(struct mlx5_pmd_mr *null_mr)
+{
+	RTE_SET_USED(null_mr);
+}
+
 /*
  * In Windows, no need to wrap the MR, no known issue for it in kernel.
  * Use the regular function to create direct MR.
-- 
2.54.0


  parent reply	other threads:[~2026-05-28 12:48 UTC|newest]

Thread overview: 99+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-02 16:09 [PATCH 1/2] ethdev: support selective Rx data Gregory Etelson
2026-02-02 16:09 ` [PATCH 2/2] app/testpmd: " Gregory Etelson
2026-02-02 17:37   ` Stephen Hemminger
2026-02-02 18:17 ` [PATCH 1/2] ethdev: " Stephen Hemminger
2026-05-09 21:56 ` [PATCH v2 00/10] selective Rx Thomas Monjalon
2026-05-09 21:56   ` [PATCH v2 01/10] app/testpmd: print Rx split capabilities Thomas Monjalon
2026-05-09 21:56   ` [PATCH v2 02/10] ethdev: introduce selective Rx Thomas Monjalon
2026-05-09 21:56   ` [PATCH v2 03/10] app/testpmd: support " Thomas Monjalon
2026-05-09 21:56   ` [PATCH v2 04/10] common/mlx5: add null MR functions Thomas Monjalon
2026-05-09 21:56   ` [PATCH v2 05/10] net/mlx5: fix Rx split segment counter type Thomas Monjalon
2026-05-09 21:56   ` [PATCH v2 06/10] net/mlx5: support selective Rx Thomas Monjalon
2026-05-09 21:56   ` [PATCH v2 07/10] net/mlx5: reindent previous changes Thomas Monjalon
2026-05-09 21:56   ` [PATCH v2 08/10] common/mlx5: remove callbacks for MR registration Thomas Monjalon
2026-05-09 21:57   ` [PATCH v2 09/10] dts: fix topology capability comparison Thomas Monjalon
2026-05-09 21:57   ` [PATCH v2 10/10] dts: add selective Rx tests Thomas Monjalon
2026-05-10 16:19   ` [PATCH v2 00/10] selective Rx Stephen Hemminger
2026-05-28 12:46 ` [PATCH v3 " Thomas Monjalon
2026-05-28 12:46   ` [PATCH v3 01/10] app/testpmd: print Rx split capabilities Thomas Monjalon
2026-05-28 12:46   ` [PATCH v3 02/10] ethdev: introduce selective Rx Thomas Monjalon
2026-05-28 12:46   ` [PATCH v3 03/10] app/testpmd: support " Thomas Monjalon
2026-05-28 12:46   ` Thomas Monjalon [this message]
2026-05-28 12:46   ` [PATCH v3 05/10] net/mlx5: fix Rx split segment counter type Thomas Monjalon
2026-05-28 12:46   ` [PATCH v3 06/10] net/mlx5: support selective Rx Thomas Monjalon
2026-05-28 12:46   ` [PATCH v3 07/10] net/mlx5: reindent previous changes Thomas Monjalon
2026-05-28 12:46   ` [PATCH v3 08/10] common/mlx5: remove callbacks for MR registration Thomas Monjalon
2026-05-28 12:46   ` [PATCH v3 09/10] dts: fix topology capability comparison Thomas Monjalon
2026-05-28 12:46   ` [PATCH v3 10/10] dts: add selective Rx tests Thomas Monjalon
2026-05-29 13:33 ` [PATCH v4 00/10] selective Rx Thomas Monjalon
2026-05-29 13:33   ` [PATCH v4 01/10] app/testpmd: print Rx split capabilities Thomas Monjalon
2026-05-29 13:33   ` [PATCH v4 02/10] ethdev: introduce selective Rx Thomas Monjalon
2026-06-01  8:07     ` Andrew Rybchenko
2026-05-29 13:33   ` [PATCH v4 03/10] app/testpmd: support " Thomas Monjalon
2026-05-29 13:33   ` [PATCH v4 04/10] common/mlx5: add null MR functions Thomas Monjalon
2026-05-29 13:33   ` [PATCH v4 05/10] net/mlx5: fix Rx split segment counter type Thomas Monjalon
2026-05-29 13:34   ` [PATCH v4 06/10] net/mlx5: support selective Rx Thomas Monjalon
2026-06-02 13:53     ` Stephen Hemminger
2026-06-02 21:37       ` Thomas Monjalon
2026-05-29 13:34   ` [PATCH v4 07/10] net/mlx5: reindent previous changes Thomas Monjalon
2026-05-29 13:34   ` [PATCH v4 08/10] common/mlx5: remove callbacks for MR registration Thomas Monjalon
2026-05-29 13:34   ` [PATCH v4 09/10] dts: fix topology capability comparison Thomas Monjalon
2026-05-29 13:34   ` [PATCH v4 10/10] dts: add selective Rx tests Thomas Monjalon
2026-06-02 21:38 ` [PATCH v5 00/10] selective Rx Thomas Monjalon
2026-06-02 21:38   ` [PATCH v5 01/10] app/testpmd: print Rx split capabilities Thomas Monjalon
2026-06-02 21:38   ` [PATCH v5 02/10] ethdev: introduce selective Rx Thomas Monjalon
2026-06-02 21:38   ` [PATCH v5 03/10] app/testpmd: support " Thomas Monjalon
2026-06-02 21:38   ` [PATCH v5 04/10] common/mlx5: add null MR functions Thomas Monjalon
2026-06-02 21:38   ` [PATCH v5 05/10] net/mlx5: fix Rx split segment counter type Thomas Monjalon
2026-06-02 21:38   ` [PATCH v5 06/10] net/mlx5: support selective Rx Thomas Monjalon
2026-06-02 21:38   ` [PATCH v5 07/10] net/mlx5: reindent previous changes Thomas Monjalon
2026-06-02 21:38   ` [PATCH v5 08/10] common/mlx5: remove callbacks for MR registration Thomas Monjalon
2026-06-02 21:38   ` [PATCH v5 09/10] dts: fix topology capability comparison Thomas Monjalon
2026-06-02 21:38   ` [PATCH v5 10/10] dts: add selective Rx tests Thomas Monjalon
2026-06-02 21:49 ` [PATCH v6 00/10] selective Rx Thomas Monjalon
2026-06-02 21:49   ` [PATCH v6 01/10] app/testpmd: print Rx split capabilities Thomas Monjalon
2026-06-02 21:49   ` [PATCH v6 02/10] ethdev: introduce selective Rx Thomas Monjalon
2026-06-02 21:49   ` [PATCH v6 03/10] app/testpmd: support " Thomas Monjalon
2026-06-02 21:49   ` [PATCH v6 04/10] common/mlx5: add null MR functions Thomas Monjalon
2026-06-02 21:49   ` [PATCH v6 05/10] net/mlx5: fix Rx split segment counter type Thomas Monjalon
2026-06-02 21:49   ` [PATCH v6 06/10] net/mlx5: support selective Rx Thomas Monjalon
2026-06-02 21:49   ` [PATCH v6 07/10] net/mlx5: reindent previous changes Thomas Monjalon
2026-06-02 21:49   ` [PATCH v6 08/10] common/mlx5: remove callbacks for MR registration Thomas Monjalon
2026-06-02 21:49   ` [PATCH v6 09/10] dts: fix topology capability comparison Thomas Monjalon
2026-06-02 21:49   ` [PATCH v6 10/10] dts: add selective Rx tests Thomas Monjalon
2026-06-03 17:31   ` [PATCH v6 00/10] selective Rx Stephen Hemminger
2026-06-03 18:23 ` [PATCH v7 " Thomas Monjalon
2026-06-03 18:23   ` [PATCH v7 01/10] app/testpmd: print Rx split capabilities Thomas Monjalon
2026-06-03 18:23   ` [PATCH v7 02/10] ethdev: introduce selective Rx Thomas Monjalon
2026-06-03 18:23   ` [PATCH v7 03/10] app/testpmd: support " Thomas Monjalon
2026-06-03 18:23   ` [PATCH v7 04/10] common/mlx5: add null MR functions Thomas Monjalon
2026-06-03 18:23   ` [PATCH v7 05/10] net/mlx5: fix Rx split segment counter type Thomas Monjalon
2026-06-03 18:23   ` [PATCH v7 06/10] net/mlx5: support selective Rx Thomas Monjalon
2026-06-03 18:23   ` [PATCH v7 07/10] net/mlx5: reindent previous changes Thomas Monjalon
2026-06-03 18:23   ` [PATCH v7 08/10] common/mlx5: remove callbacks for MR registration Thomas Monjalon
2026-06-03 18:23   ` [PATCH v7 09/10] dts: fix topology capability comparison Thomas Monjalon
2026-06-03 18:23   ` [PATCH v7 10/10] dts: add selective Rx tests Thomas Monjalon
2026-06-04 19:30 ` [PATCH v8 0/9] selective Rx Thomas Monjalon
2026-06-04 19:30   ` [PATCH v8 1/9] app/testpmd: print Rx split capabilities Thomas Monjalon
2026-06-04 19:30   ` [PATCH v8 2/9] ethdev: introduce selective Rx Thomas Monjalon
2026-06-04 19:30   ` [PATCH v8 3/9] app/testpmd: support " Thomas Monjalon
2026-06-04 19:30   ` [PATCH v8 4/9] common/mlx5: add null MR functions Thomas Monjalon
2026-06-04 19:30   ` [PATCH v8 5/9] net/mlx5: fix Rx split segment counter type Thomas Monjalon
2026-06-04 19:30   ` [PATCH v8 6/9] net/mlx5: support selective Rx Thomas Monjalon
2026-06-04 19:30   ` [PATCH v8 7/9] common/mlx5: remove callbacks for MR registration Thomas Monjalon
2026-06-04 19:31   ` [PATCH v8 8/9] dts: fix topology capability comparison Thomas Monjalon
2026-06-04 19:31   ` [PATCH v8 9/9] dts: add selective Rx tests Thomas Monjalon
2026-06-05 21:28     ` Stephen Hemminger
2026-06-05 23:31       ` Thomas Monjalon
2026-06-05 23:33 ` [PATCH v9 00/10] selective Rx Thomas Monjalon
2026-06-05 23:33   ` [PATCH v9 01/10] app/testpmd: print Rx split capabilities Thomas Monjalon
2026-06-05 23:33   ` [PATCH v9 02/10] ethdev: introduce selective Rx Thomas Monjalon
2026-06-05 23:33   ` [PATCH v9 03/10] app/testpmd: support " Thomas Monjalon
2026-06-05 23:33   ` [PATCH v9 04/10] common/mlx5: add null MR functions Thomas Monjalon
2026-06-05 23:33   ` [PATCH v9 05/10] net/mlx5: fix Rx split segment counter type Thomas Monjalon
2026-06-05 23:33   ` [PATCH v9 06/10] net/mlx5: support selective Rx Thomas Monjalon
2026-06-05 23:33   ` [PATCH v9 07/10] common/mlx5: remove callbacks for MR registration Thomas Monjalon
2026-06-05 23:33   ` [PATCH v9 08/10] dts: fix topology capability comparison Thomas Monjalon
2026-06-05 23:33   ` [PATCH v9 09/10] dts: use specific types for Rx/Tx offloads Thomas Monjalon
2026-06-05 23:33   ` [PATCH v9 10/10] dts: add selective Rx tests Thomas Monjalon
2026-06-07 18:15   ` [PATCH v9 00/10] selective Rx Stephen Hemminger

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=20260528124758.1984528-5-thomas@monjalon.net \
    --to=thomas@monjalon.net \
    --cc=bingz@nvidia.com \
    --cc=dev@dpdk.org \
    --cc=dsosnowski@nvidia.com \
    --cc=getelson@nvidia.com \
    --cc=matan@nvidia.com \
    --cc=orika@nvidia.com \
    --cc=stephen@networkplumber.org \
    --cc=suanmingm@nvidia.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.