Skip to content

Commit 8272067

Browse files
committed
rdma: Add support for running the rdma tests over hardware
The blktests are using soft-RoCE (rdma_rxe) and soft-iWARP (siw) to run RDMA related tests, this change add support for run nvme-rdma and SRP tests with real RDMA hardware, this is needed to make sure that we don't have issues when using real RDMA hardware. Signed-off-by: Kamal Heib <kheib@redhat.com>
1 parent b6a7ca0 commit 8272067

File tree

4 files changed

+37
-8
lines changed

4 files changed

+37
-8
lines changed

Documentation/running-tests.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ The NVMe tests can be additionally parameterized via environment variables.
113113
### Running nvme-rdma and SRP tests
114114

115115
These tests will use the siw (soft-iWARP) driver by default. The rdma_rxe
116-
(soft-RoCE) driver is also supported.
116+
(soft-RoCE) driver and hardware RDMA drivers are also supported.
117117

118118
```sh
119119
To use the siw driver:
@@ -123,6 +123,13 @@ nvme_trtype=rdma ./check nvme/
123123
To use the rdma_rxe driver:
124124
use_rxe=1 nvme_trtype=rdma ./check nvme/
125125
use_rxe=1 ./check srp/
126+
127+
To use hardware RDMA drivers, set up hardware RDMA beforehand:
128+
use_hw_rdma=1 nvme_trtype=rdma ./check nvme/
129+
use_hw_rdma=1 ./check srp/
130+
131+
Note: The variables use_rxe and use_hw_rdma must not be enabled at the same time.
132+
Also, Need to make sure to unload the hardware RDMA drivers when testing siw or rdma_rxe.
126133
```
127134

128135
### Normal user

common/multipath-over-rdma

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ fio_aux_path=/tmp/fio-state-files
1313
memtotal=$(sed -n 's/^MemTotal:[[:blank:]]*\([0-9]*\)[[:blank:]]*kB$/\1/p' /proc/meminfo)
1414
max_ramdisk_size=$((1<<25))
1515
use_rxe=${use_rxe:-""}
16+
use_hw_rdma=${use_hw_rdma:-""}
1617
ramdisk_size=$((memtotal*(1024/16))) # in bytes
1718
if [ $ramdisk_size -gt $max_ramdisk_size ]; then
1819
ramdisk_size=$max_ramdisk_size
@@ -439,6 +440,23 @@ stop_soft_rdma() {
439440
} >>"$FULL"
440441
}
441442

443+
start_rdma() {
444+
if [[ -n "$use_rxe" && -n "$use_hw_rdma" ]]; then
445+
echo "The variables use_rxe and use_hw_rdma must not be enable at the same time."
446+
return 1
447+
fi
448+
449+
if [ -z "$use_hw_rdma" ]; then
450+
start_soft_rdma
451+
fi
452+
}
453+
454+
stop_rdma() {
455+
if [ -z "$use_hw_rdma" ]; then
456+
stop_soft_rdma
457+
fi
458+
}
459+
442460
# Look up the block device below the filesystem for directory $1.
443461
block_dev_of_dir() {
444462
df "$1" | {
@@ -580,7 +598,7 @@ configure_null_blk() {
580598
}
581599

582600
setup_rdma() {
583-
start_soft_rdma
601+
start_rdma
584602
(
585603
echo "RDMA interfaces:"
586604
cd /sys/class/infiniband &&
@@ -599,7 +617,7 @@ teardown_uncond() {
599617
killall -9 multipathd >&/dev/null
600618
rm -f /etc/multipath.conf
601619
stop_target
602-
stop_soft_rdma
620+
stop_rdma
603621
_exit_null_blk
604622
}
605623

tests/nvme/rc

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ _nvme_requires() {
4646
_have_program rdma
4747
if [ -n "$use_rxe" ]; then
4848
_have_driver rdma_rxe
49-
else
49+
elif [ -z "$use_hw_rdma" ]; then
5050
_have_driver siw
5151
fi
5252
;;
@@ -372,7 +372,7 @@ _cleanup_nvmet() {
372372
fi
373373
modprobe -rq nvmet 2>/dev/null
374374
if [[ "${nvme_trtype}" == "rdma" ]]; then
375-
stop_soft_rdma
375+
stop_rdma
376376
fi
377377

378378
_cleanup_blkdev
@@ -386,7 +386,7 @@ _setup_nvmet() {
386386
fi
387387
modprobe -q nvme-"${nvme_trtype}"
388388
if [[ "${nvme_trtype}" == "rdma" ]]; then
389-
start_soft_rdma
389+
start_rdma
390390
for i in $(rdma_network_interfaces)
391391
do
392392
if [[ "${nvme_adrfam}" == "ipv6" ]]; then
@@ -554,7 +554,11 @@ _nvme_connect_subsys() {
554554
ARGS+=(--ctrl-loss-tmo="${ctrl_loss_tmo}")
555555
fi
556556

557-
nvme connect "${ARGS[@]}" 2> /dev/null
557+
if ! nvme connect "${ARGS[@]}" 2> /dev/null; then
558+
if [[ -n "$use_hw_rdma" ]]; then
559+
echo "Check RDMA hardware set up; use_hw_rdma is enabledand 'nvme connect' failed."
560+
fi
561+
fi
558562

559563
# Wait until device file and uuid/wwid sysfs attributes get ready for
560564
# all namespaces.

tests/srp/rc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ group_requires() {
5353
_have_module rdma_cm
5454
if [ -n "$use_rxe" ]; then
5555
_have_module rdma_rxe
56-
else
56+
elif [ -z "$use_hw_rdma" ]; then
5757
_have_module siw
5858
_have_kver 5 5
5959
_have_iproute2 190404

0 commit comments

Comments
 (0)