Linux-NVME Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Max Gurtovoy <mgurtovoy@nvidia.com>
To: <dwagner@suse.de>, <johannes.thumshirn@wdc.com>, <kch@nvidia.com>,
	<linux-nvme@lists.infradead.org>
Cc: <israelr@nvidia.com>, <shinichiro.kawasaki@wdc.com>, <hch@lst.de>,
	<kbusch@kernel.org>, <sagi@grimberg.me>,
	Max Gurtovoy <mgurtovoy@nvidia.com>
Subject: [PATCH 2/4] nvme: add support for mlx5 RDMA devices
Date: Sun, 28 Sep 2025 14:51:23 +0300	[thread overview]
Message-ID: <20250928115125.38383-3-mgurtovoy@nvidia.com> (raw)
In-Reply-To: <20250928115125.38383-1-mgurtovoy@nvidia.com>

Until now, the tests for RDMA transport were only supported on top of
software RDMA devices (rxe/siw). This commit adds support for running
tests on top of mlx5 hardware RDMA devices, allowing for more
comprehensive testing of NVMe-oF RDMA functionality.

Prerequisites:
- RDMA network interfaces must be configured prior to running tests
- User should set USE_MLX5=1 environment variable to use mlx5 devices

Signed-off-by: Max Gurtovoy <mgurtovoy@nvidia.com>
---
 common/multipath-over-rdma |  7 +++++++
 common/nvme                | 16 +++++++++++++---
 2 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/common/multipath-over-rdma b/common/multipath-over-rdma
index e157e0a..9367662 100644
--- a/common/multipath-over-rdma
+++ b/common/multipath-over-rdma
@@ -98,6 +98,13 @@ rdma_network_interfaces() {
 		sort -u
 }
 
+# Lists RDMA capable network interface names associated with mlx5 devices, e.g. ib0 ib1.
+rdma_mlx5_network_interfaces() {
+	rdma link show | grep mlx5 |
+		sed -n 's/^.*[[:blank:]]netdev[[:blank:]]\+\([^[:blank:]]*\)[[:blank:]]*/\1/p' |
+		sort -u
+}
+
 # Check whether any stacked block device holds block device $1. If so, echo
 # the name of the holder.
 held_by() {
diff --git a/common/nvme b/common/nvme
index 3d43790..01d054d 100644
--- a/common/nvme
+++ b/common/nvme
@@ -218,7 +218,9 @@ _cleanup_nvmet() {
 	fi
 	modprobe -rq nvmet 2>/dev/null
 	if [[ "${nvme_trtype}" == "rdma" ]]; then
-		stop_soft_rdma
+		if [ -z "$USE_MLX5" ]; then
+			stop_soft_rdma
+		fi
 	fi
 
 	_cleanup_blkdev
@@ -243,8 +245,14 @@ _setup_nvmet() {
 	fi
 	modprobe -q nvme-"${nvme_trtype}"
 	if [[ "${nvme_trtype}" == "rdma" ]]; then
-		start_soft_rdma
-		for i in $(rdma_network_interfaces)
+		local interfaces
+		if [ -z "$USE_MLX5" ]; then
+			start_soft_rdma
+			interfaces="$(rdma_network_interfaces)"
+		else
+			interfaces="$(rdma_mlx5_network_interfaces)"
+		fi
+		for i in $interfaces
 		do
 			if [[ "${nvme_adrfam}" == "ipv6" ]]; then
 				ipv6_addr=$(get_ipv6_ll_addr "$i")
@@ -1180,6 +1188,8 @@ _nvme_requires() {
 		_have_program rdma
 		if [ -n "$USE_RXE" ]; then
 			_have_driver rdma_rxe
+		elif [ -n "$USE_MLX5" ]; then
+			_have_driver mlx5_ib
 		else
 			_have_driver siw
 		fi
-- 
2.18.1



  parent reply	other threads:[~2025-09-28 11:51 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-28 11:51 [PATCH 0/4] NVMe: add support for mlx5 RDMA HW and test enhancements Max Gurtovoy
2025-09-28 11:51 ` [PATCH 1/4] nvme/061: increase nvmf state wait timeout to 10s Max Gurtovoy
2025-09-30  1:44   ` Chaitanya Kulkarni
2025-09-28 11:51 ` Max Gurtovoy [this message]
2025-09-30  1:44   ` [PATCH 2/4] nvme: add support for mlx5 RDMA devices Chaitanya Kulkarni
2025-09-30  3:38   ` Shinichiro Kawasaki
2025-09-28 11:51 ` [PATCH 3/4] nvme/002: extend test to support TCP and RDMA transports Max Gurtovoy
2025-09-30  1:43   ` Chaitanya Kulkarni
2025-09-28 11:51 ` [PATCH 4/4] nvmet: add --qid-max support for subsystem creation and setup Max Gurtovoy
2025-09-30  1:43   ` Chaitanya Kulkarni
2025-09-30  3:41   ` Shinichiro Kawasaki
2025-09-30  3:46 ` [PATCH 0/4] NVMe: add support for mlx5 RDMA HW and test enhancements Shinichiro Kawasaki

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=20250928115125.38383-3-mgurtovoy@nvidia.com \
    --to=mgurtovoy@nvidia.com \
    --cc=dwagner@suse.de \
    --cc=hch@lst.de \
    --cc=israelr@nvidia.com \
    --cc=johannes.thumshirn@wdc.com \
    --cc=kbusch@kernel.org \
    --cc=kch@nvidia.com \
    --cc=linux-nvme@lists.infradead.org \
    --cc=sagi@grimberg.me \
    --cc=shinichiro.kawasaki@wdc.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