From fc51b21cfc14c48b4b6f04988528b872d6b66504 Mon Sep 17 00:00:00 2001 From: Kamal Heib Date: Wed, 16 Feb 2022 13:52:04 +0200 Subject: [PATCH] rdma: Add support for running the rdma tests over hardware Signed-off-by: Kamal Heib --- common/multipath-over-rdma | 17 +++++++++++++++-- tests/nvme/rc | 8 +++++--- tests/nvmeof-mp/rc | 5 ++++- tests/srp/rc | 5 ++++- 4 files changed, 28 insertions(+), 7 deletions(-) diff --git a/common/multipath-over-rdma b/common/multipath-over-rdma index cef05ec9..6194ee6b 100644 --- a/common/multipath-over-rdma +++ b/common/multipath-over-rdma @@ -13,6 +13,7 @@ fio_aux_path=/tmp/fio-state-files memtotal=$(sed -n 's/^MemTotal:[[:blank:]]*\([0-9]*\)[[:blank:]]*kB$/\1/p' /proc/meminfo) max_ramdisk_size=$((1<<25)) use_siw=${use_siw:-""} +use_hw_rdma=${use_hw_rdma:-""} ramdisk_size=$((memtotal*(1024/16))) # in bytes if [ $ramdisk_size -gt $max_ramdisk_size ]; then ramdisk_size=$max_ramdisk_size @@ -438,6 +439,18 @@ stop_soft_rdma() { } >>"$FULL" } +start_rdma() { + if [ -z "$use_hw_rdma" ]; then + start_soft_rdma + fi +} + +stop_rdma() { + if [ -z "$use_hw_rdma" ]; then + stop_soft_rdma + fi +} + # Look up the block device below the filesystem for directory $1. block_dev_of_dir() { df "$1" | { @@ -579,7 +592,7 @@ configure_null_blk() { } setup_rdma() { - start_soft_rdma + start_rdma ( echo "RDMA interfaces:" cd /sys/class/infiniband && @@ -598,7 +611,7 @@ teardown_uncond() { killall -9 multipathd >&/dev/null rm -f /etc/multipath.conf stop_target - stop_soft_rdma + stop_rdma _exit_null_blk } diff --git a/tests/nvme/rc b/tests/nvme/rc index 1c27cdee..fde973a3 100644 --- a/tests/nvme/rc +++ b/tests/nvme/rc @@ -30,7 +30,9 @@ _nvme_requires() { _have_modules nvmet nvme-core nvme-rdma nvmet-rdma _have_configfs _have_program rdma - _have_modules rdma_rxe || _have_modules siw + if [ -z "$use_hw_rdma" ]; then + _have_modules rdma_rxe || _have_modules siw + fi ;; *) SKIP_REASON="unsupported nvme_trtype=${nvme_trtype}" @@ -131,7 +133,7 @@ _cleanup_nvmet() { fi modprobe -r nvmet 2>/dev/null if [[ "${nvme_trtype}" == "rdma" ]]; then - stop_soft_rdma + stop_rdma fi } @@ -143,7 +145,7 @@ _setup_nvmet() { fi modprobe nvme-"${nvme_trtype}" if [[ "${nvme_trtype}" == "rdma" ]]; then - start_soft_rdma + start_rdma for i in $(rdma_network_interfaces) do ipv4_addr=$(get_ipv4_addr "$i") diff --git a/tests/nvmeof-mp/rc b/tests/nvmeof-mp/rc index dcb2e3c7..58247b27 100755 --- a/tests/nvmeof-mp/rc +++ b/tests/nvmeof-mp/rc @@ -35,13 +35,16 @@ and multipathing has been enabled in the nvme_core kernel module" ib_umad nvme-rdma nvmet-rdma - rdma_rxe scsi_dh_alua scsi_dh_emc scsi_dh_rdac ) _have_modules "${required_modules[@]}" || return + if [ -z "$use_hw_rdma" ]; then + _have_modules rdma_rxe || _have_modules siw + fi + for p in mkfs.ext4 mkfs.xfs multipath multipathd pidof rdma fio; do _have_program "$p" || return done diff --git a/tests/srp/rc b/tests/srp/rc index d44082af..d954f66d 100755 --- a/tests/srp/rc +++ b/tests/srp/rc @@ -46,7 +46,6 @@ group_requires() { ib_uverbs null_blk rdma_cm - rdma_rxe scsi_debug scsi_dh_alua scsi_dh_emc @@ -59,6 +58,10 @@ group_requires() { ) _have_modules "${required_modules[@]}" || return + if [ -z "$use_hw_rdma" ]; then + _have_modules rdma_rxe || _have_modules siw + fi + for p in mkfs.ext4 mkfs.xfs multipath multipathd pidof rdma \ sg_reset fio; do _have_program "$p" || return