test/nvmf: configure all nics when running NVMF tests.

Change-Id: Ia40f0817320ac7f12312299633a7c40136c2e806
Signed-off-by: Seth Howell <seth.howell@intel.com>
Reviewed-on: https://review.gerrithub.io/371219
Tested-by: SPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: Ben Walker <benjamin.walker@intel.com>
Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com>
This commit is contained in:
Seth Howell 2017-07-25 12:02:08 -07:00 committed by Daniel Verkamp
parent 80c91e4e46
commit 36fb7fcd23
2 changed files with 39 additions and 17 deletions

View File

@ -33,10 +33,14 @@ function load_ib_rdma_modules()
function detect_soft_roce_nics() function detect_soft_roce_nics()
{ {
if hash rxe_cfg; then if hash rxe_cfg; then
interface="$(ifconfig | grep "RUNNING" -m 1 | awk '{print $1}' | sed s/://)"
rxe_cfg add $interface
rxe_cfg start rxe_cfg start
export SOFT_ROCE=true rdma_nics=$(get_rdma_if_list)
all_nics=$(ifconfig -s | awk '{print $1}')
all_nics=("${all_nics[@]/"Iface"}")
non_rdma_nics=$(echo "$rdma_nics $all_nics" | sort | uniq -u)
for nic in $non_rdma_nics; do
rxe_cfg add $nic || true
done
fi fi
} }
@ -86,34 +90,40 @@ function detect_rdma_nics()
function allocate_nic_ips() function allocate_nic_ips()
{ {
# If a Soft-RoCE nic was allocated, it already has an ip address atached to it
# and we use it in preference to any other RDMA nics attached to the device.
if [ $SOFT_ROCE == true ]; then
return 0
fi
let count=$NVMF_IP_LEAST_ADDR let count=$NVMF_IP_LEAST_ADDR
for nic_type in `ls /sys/class/infiniband`; do for nic_name in $get_rdma_if_list; do
for nic_name in `ls /sys/class/infiniband/${nic_type}/device/net`; do ip="$(get_ip_address $nic_name)"
if [ -z $ip ]; then
ifconfig $nic_name $NVMF_IP_PREFIX.$count netmask 255.255.255.0 up 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 let count=$count+1
done fi
# dump configuration for debug log
ifconfig $nic_name
done done
} }
function get_available_rdma_ips() function get_available_rdma_ips()
{ {
nic_list="" for nic_name in $get_rdma_if_list; do
ifconfig $nic_name | grep "inet " | awk '{print $2}'
done
}
function get_rdma_if_list()
{
for nic_type in `ls /sys/class/infiniband`; do for nic_type in `ls /sys/class/infiniband`; do
for nic_name in `ls /sys/class/infiniband/${nic_type}/device/net`; do for nic_name in `ls /sys/class/infiniband/${nic_type}/device/net`; do
ifconfig $nic_name | grep "inet " | awk '{print $2}' echo "$nic_name"
done done
done done
} }
function get_ip_address()
{
interface=$1
ifconfig $interface | grep "inet " | awk '{print $2}'
}
function nvmfcleanup() function nvmfcleanup()
{ {
sync sync
@ -126,3 +136,14 @@ function rdma_device_init()
detect_rdma_nics detect_rdma_nics
allocate_nic_ips allocate_nic_ips
} }
function revert_soft_roce()
{
if hash rxe_cfg; then
interfaces="$(ifconfig -s | awk '{print $1}')"
for interface in $interfaces; do
rxe_cfg remove $interface || true
done
rxe_cfg stop || true
fi
}

View File

@ -50,4 +50,5 @@ kill_stub
# TODO: enable nvme device detachment for multi-process so that # TODO: enable nvme device detachment for multi-process so that
# we can use the stub for this test # we can use the stub for this test
run_test test/nvmf/rpc/rpc.sh run_test test/nvmf/rpc/rpc.sh
revert_soft_roce
timing_exit nvmf_tgt timing_exit nvmf_tgt