[PATCH 2/4] nvme: add support for mlx5 RDMA devices
Max Gurtovoy
mgurtovoy at nvidia.com
Sun Sep 28 04:51:23 PDT 2025
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 at 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
More information about the Linux-nvme
mailing list