From 8985c5b6beab4e7325f8cd04d74d3374436925dd Mon Sep 17 00:00:00 2001 From: Seth Howell Date: Fri, 1 Mar 2019 13:35:34 -0700 Subject: [PATCH] test/nvmf: add new function detect_pci_nics Change-Id: I5d433dc78bd0e7ff24dddee73c1e159607175084 Signed-off-by: Seth Howell Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/446720 Tested-by: SPDK CI Jenkins Reviewed-by: Jim Harris Reviewed-by: Ben Walker --- test/nvmf/common.sh | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/test/nvmf/common.sh b/test/nvmf/common.sh index 22ac9bf53..0294017ff 100755 --- a/test/nvmf/common.sh +++ b/test/nvmf/common.sh @@ -44,11 +44,6 @@ function detect_soft_roce_nics() function detect_mellanox_nics() { - if ! hash lspci; then - echo "No NICs" - 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" @@ -76,15 +71,30 @@ function detect_mellanox_nics() if [ -n "$mlx_en_driver" ]; then modprobe $mlx_en_driver fi +} - # The mlx4 driver takes an extra few seconds to load after modprobe returns, - # otherwise iproute2 operations will do nothing. +function detect_pci_nics() +{ + + if ! hash lspci; then + echo "No NICs" + return 0 + fi + + mellanox_nics=$(detect_mellanox_nics) + + if [ "$mellanox_nics" == "No NICs" ]; then + echo "No NICs" + return 0 + fi + + # Provide time for drivers to properly load. sleep 5 } function detect_rdma_nics() { - nics=$(detect_mellanox_nics) + nics=$(detect_pci_nics) if [ "$nics" == "No NICs" ]; then detect_soft_roce_nics fi