Commit aa429c80 authored by Jim Harris's avatar Jim Harris Committed by Ben Walker
Browse files

test/nvmf: add tcp support

parent 02c1c5a6
Loading
Loading
Loading
Loading
+18 −10
Original line number Diff line number Diff line
@@ -141,7 +141,7 @@ function nvmfcleanup()
	sync
	set +e
	for i in {1..20}; do
		modprobe -v -r nvme-rdma nvme-fabrics
		modprobe -v -r nvme-$TEST_TRANSPORT nvme-fabrics
		if [ $? -eq 0 ]; then
			set -e
			return
@@ -152,7 +152,7 @@ function nvmfcleanup()

	# So far unable to remove the kernel modules. Try
	# one more time and let it fail.
	modprobe -v -r nvme-rdma nvme-fabrics
	modprobe -v -r nvme-$TEST_TRANSPORT nvme-fabrics
}

function nvmftestinit()
@@ -163,14 +163,20 @@ function nvmftestinit()
	fi
	if [ "$TEST_MODE" == "iso" ]; then
		$rootdir/scripts/setup.sh
		if [ "$TEST_TRANSPORT" == "rdma" ]; then
			rdma_device_init
		fi
	fi
	if [ "$TEST_TRANSPORT" == "rdma" ]; then
		RDMA_IP_LIST=$(get_available_rdma_ips)
		NVMF_FIRST_TARGET_IP=$(echo "$RDMA_IP_LIST" | head -n 1)
		if [ -z $NVMF_FIRST_TARGET_IP ]; then
			echo "no NIC for nvmf test"
			exit 0
		fi
	elif [ "$TEST_TRANSPORT" == "tcp" ]; then
		NVMF_FIRST_TARGET_IP=127.0.0.1
	fi
}

function nvmfappstart()
@@ -180,7 +186,7 @@ function nvmfappstart()
	nvmfpid=$!
	trap "process_shm --id $NVMF_APP_SHM_ID; nvmftestfini; exit 1" SIGINT SIGTERM EXIT
	waitforlisten $nvmfpid
	modprobe nvme-rdma
	modprobe nvme-$TEST_TRANSPORT
	timing_exit start_nvmf_tgt
}

@@ -189,8 +195,10 @@ function nvmftestfini()
	killprocess $nvmfpid
	if [ "$TEST_MODE" == "iso" ]; then
		$rootdir/scripts/setup.sh reset
		if [ "$TEST_TRANSPORT" == "rdma" ]; then
			rdma_device_init
		fi
	fi
}

function rdma_device_init()