Commit 90d32235 authored by Michal Berger's avatar Michal Berger Committed by Tomasz Zawadzki
Browse files

test/nvmf: Check if selected net devices are in proper state



Even if we detect all the interfaces attached to a proper NIC, we
still need to verify if they are operational. If not, we are better
with removing them and potentially falling through to phy-fallback
instead of failing the entire test.

Change-Id: I09c4467038aff86a0877c198116ca823ffdbe228
Signed-off-by: default avatarMichal Berger <michal.berger@intel.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/23000


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarJim Harris <jim.harris@samsung.com>
Reviewed-by: default avatarTomasz Zawadzki <tomasz.zawadzki@intel.com>
parent 21828e4a
Loading
Loading
Loading
Loading
+13 −2
Original line number Diff line number Diff line
@@ -286,7 +286,7 @@ function gather_supported_nvmf_pci_devs() {
	cache_pci_bus_sysfs
	xtrace_restore

	local intel=0x8086 mellanox=0x15b3 pci
	local intel=0x8086 mellanox=0x15b3 pci net_dev

	local -a pci_devs=()
	local -a pci_net_devs=()
@@ -381,10 +381,21 @@ function gather_supported_nvmf_pci_devs() {
	# are any net devices bound to the controllers.
	for pci in "${pci_devs[@]}"; do
		pci_net_devs=("/sys/bus/pci/devices/$pci/net/"*)

		# Check if available devices are in proper operational state. If not, remove them from the main list.
		# This check is valid for TCP only since for RDMA we use infiniband which don't rely on actual UP
		# state of the device.
		if [[ $TEST_TRANSPORT == tcp ]]; then
			for net_dev in "${!pci_net_devs[@]}"; do
				[[ $(< "${pci_net_devs[net_dev]}/operstate") == up ]] || unset -v "pci_net_devs[net_dev]"
			done
		fi

		if ((${#pci_net_devs[@]} == 0)); then
			echo "No net devices associated with $pci"
			echo "No operational net devices associated with $pci"
			continue
		fi

		pci_net_devs=("${pci_net_devs[@]##*/}")
		echo "Found net devices under $pci: ${pci_net_devs[*]}"
		net_devs+=("${pci_net_devs[@]}")