Skip to content

Commit

Permalink
rdma: Add support for running the rdma tests over hardware
Browse files Browse the repository at this point in the history
Signed-off-by: Kamal Heib <[email protected]>
  • Loading branch information
Kamalheib committed Feb 16, 2022
1 parent f51ee53 commit fc51b21
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 7 deletions.
17 changes: 15 additions & 2 deletions common/multipath-over-rdma
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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" | {
Expand Down Expand Up @@ -579,7 +592,7 @@ configure_null_blk() {
}

setup_rdma() {
start_soft_rdma
start_rdma
(
echo "RDMA interfaces:"
cd /sys/class/infiniband &&
Expand All @@ -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
}

Expand Down
8 changes: 5 additions & 3 deletions tests/nvme/rc
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down Expand Up @@ -131,7 +133,7 @@ _cleanup_nvmet() {
fi
modprobe -r nvmet 2>/dev/null
if [[ "${nvme_trtype}" == "rdma" ]]; then
stop_soft_rdma
stop_rdma
fi
}

Expand All @@ -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")
Expand Down
5 changes: 4 additions & 1 deletion tests/nvmeof-mp/rc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion tests/srp/rc
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ group_requires() {
ib_uverbs
null_blk
rdma_cm
rdma_rxe
scsi_debug
scsi_dh_alua
scsi_dh_emc
Expand All @@ -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
Expand Down

0 comments on commit fc51b21

Please sign in to comment.