test/nvmf: only run RDMA NIC setup once
Change-Id: I69607670de95652f997712ad3e7441718c97e3ab Signed-off-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
parent
e6a5bb1067
commit
c4bb610d93
@ -2,6 +2,7 @@
|
||||
|
||||
rootdir=$(readlink -f $(dirname $0))
|
||||
source "$rootdir/scripts/autotest_common.sh"
|
||||
source "$rootdir/test/nvmf/common.sh"
|
||||
|
||||
set -xe
|
||||
|
||||
@ -43,6 +44,10 @@ timing_enter afterboot
|
||||
./scripts/setup.sh
|
||||
timing_exit afterboot
|
||||
|
||||
timing_enter nvmf_setup
|
||||
rdma_device_init
|
||||
timing_exit nvmf_setup
|
||||
|
||||
#####################
|
||||
# Unit Tests
|
||||
#####################
|
||||
|
@ -8,7 +8,7 @@ NVMF_FIRST_TARGET_IP=$NVMF_IP_PREFIX.$NVMF_IP_LEAST_ADDR
|
||||
function load_ib_rdma_modules()
|
||||
{
|
||||
if [ `uname` != Linux ]; then
|
||||
exit 0
|
||||
return 0
|
||||
fi
|
||||
|
||||
modprobe ib_cm
|
||||
@ -23,13 +23,17 @@ function load_ib_rdma_modules()
|
||||
|
||||
function detect_mellanox_nics()
|
||||
{
|
||||
if ! hash lspci; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
nvmf_nic_bdfs=`lspci | grep Ethernet | grep Mellanox | awk -F ' ' '{print "0000:"$1}'`
|
||||
mlx_core_driver="mlx4_core"
|
||||
mlx_ib_driver="mlx4_ib"
|
||||
mlx_en_driver="mlx4_en"
|
||||
|
||||
if [ -z "$nvmf_nic_bdfs" ]; then
|
||||
exit 0
|
||||
return 0
|
||||
fi
|
||||
|
||||
# for nvmf target loopback test, suppose we only have one type of card.
|
||||
@ -68,8 +72,6 @@ function detect_mellanox_nics()
|
||||
# The mlx4 driver takes an extra few seconds to load after modprobe returns,
|
||||
# otherwise ifconfig operations will do nothing.
|
||||
sleep 5
|
||||
|
||||
trap - SIGINT SIGTERM EXIT
|
||||
}
|
||||
|
||||
function detect_rdma_nics()
|
||||
@ -84,16 +86,12 @@ function allocate_nic_ips()
|
||||
for nic_type in `ls /sys/class/infiniband`; do
|
||||
for nic_name in `ls /sys/class/infiniband/${nic_type}/device/net`; do
|
||||
ifconfig $nic_name $NVMF_IP_PREFIX.$count netmask 255.255.255.0 up
|
||||
|
||||
# dump configuration for debug log
|
||||
ifconfig $nic_name
|
||||
let count=$count+1
|
||||
done
|
||||
done
|
||||
|
||||
# check whether the IP is configured
|
||||
result=`ifconfig | grep $NVMF_IP_PREFIX`
|
||||
if [ -z "$result" ]; then
|
||||
echo "no NIC for nvmf test"
|
||||
exit 0
|
||||
fi
|
||||
}
|
||||
|
||||
function nvmfcleanup()
|
||||
@ -109,3 +107,7 @@ function rdma_device_init()
|
||||
allocate_nic_ips
|
||||
}
|
||||
|
||||
function rdma_nic_available()
|
||||
{
|
||||
ifconfig | grep -q $NVMF_IP_PREFIX
|
||||
}
|
||||
|
@ -5,14 +5,17 @@ rootdir=$(readlink -f $testdir/../../..)
|
||||
source $rootdir/scripts/autotest_common.sh
|
||||
source $rootdir/test/nvmf/common.sh
|
||||
|
||||
set -e
|
||||
|
||||
if ! hash nvme; then
|
||||
echo "nvme command not found; skipping discovery test"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
rdma_device_init
|
||||
|
||||
set -e
|
||||
if ! rdma_nic_available; then
|
||||
echo "no NIC for nvmf test"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
timing_enter discovery
|
||||
|
||||
|
@ -31,10 +31,13 @@ function filesystem_test()
|
||||
done
|
||||
}
|
||||
|
||||
rdma_device_init
|
||||
|
||||
set -e
|
||||
|
||||
if ! rdma_nic_available; then
|
||||
echo "no NIC for nvmf test"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
timing_enter fs_test
|
||||
|
||||
# Start up the NVMf target in another process
|
||||
|
@ -5,10 +5,13 @@ rootdir=$(readlink -f $testdir/../../..)
|
||||
source $rootdir/scripts/autotest_common.sh
|
||||
source $rootdir/test/nvmf/common.sh
|
||||
|
||||
rdma_device_init
|
||||
|
||||
set -e
|
||||
|
||||
if ! rdma_nic_available; then
|
||||
echo "no NIC for nvmf test"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
timing_enter fio
|
||||
|
||||
# Start up the NVMf target in another process
|
||||
|
Loading…
x
Reference in New Issue
Block a user