test/nvmf: detect mlx_4 and mlx_5 NICS into 2 funcs
This helps us simplify the detection of Mellanox NICS and paves the way for a more modular detection scheme for PCIe connected NICs. Change-Id: I93f16f469c569977c43d6e20fd4616299fa8c723 Signed-off-by: Seth Howell <seth.howell@intel.com> Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/446965 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com>
This commit is contained in:
parent
8985c5b6be
commit
5dff03721b
@ -42,9 +42,25 @@ function detect_soft_roce_nics()
|
||||
fi
|
||||
}
|
||||
|
||||
function detect_mellanox_nics()
|
||||
|
||||
function detect_mlx_5_nics()
|
||||
{
|
||||
nvmf_nic_bdfs=`lspci | grep Ethernet | grep Mellanox | awk -F ' ' '{print "0000:"$1}'`
|
||||
nvmf_nic_bdfs=`lspci | grep Ethernet | grep Mellanox | grep ConnectX-5 | awk -F ' ' '{print "0000:"$1}'`
|
||||
mlx_core_driver="mlx5_core"
|
||||
mlx_ib_driver="mlx5_ib"
|
||||
|
||||
if [ -z "$nvmf_nic_bdfs" ]; then
|
||||
echo "No NICs"
|
||||
return 0
|
||||
fi
|
||||
|
||||
modprobe $mlx_core_driver
|
||||
modprobe $mlx_ib_driver
|
||||
}
|
||||
|
||||
function detect_mlx_4_nics()
|
||||
{
|
||||
nvmf_nic_bdfs=`lspci | grep Ethernet | grep Mellanox | grep ConnectX-4 | awk -F ' ' '{print "0000:"$1}'`
|
||||
mlx_core_driver="mlx4_core"
|
||||
mlx_ib_driver="mlx4_ib"
|
||||
mlx_en_driver="mlx4_en"
|
||||
@ -54,23 +70,9 @@ function detect_mellanox_nics()
|
||||
return 0
|
||||
fi
|
||||
|
||||
# for nvmf target loopback test, suppose we only have one type of card.
|
||||
for nvmf_nic_bdf in $nvmf_nic_bdfs
|
||||
do
|
||||
result=`lspci -vvv -s $nvmf_nic_bdf | grep 'Kernel modules' | awk -F ' ' '{print $3}'`
|
||||
if [ "$result" == "mlx5_core" ]; then
|
||||
mlx_core_driver="mlx5_core"
|
||||
mlx_ib_driver="mlx5_ib"
|
||||
mlx_en_driver=""
|
||||
fi
|
||||
break;
|
||||
done
|
||||
|
||||
modprobe $mlx_core_driver
|
||||
modprobe $mlx_ib_driver
|
||||
if [ -n "$mlx_en_driver" ]; then
|
||||
modprobe $mlx_en_driver
|
||||
fi
|
||||
}
|
||||
|
||||
function detect_pci_nics()
|
||||
@ -81,9 +83,10 @@ function detect_pci_nics()
|
||||
return 0
|
||||
fi
|
||||
|
||||
mellanox_nics=$(detect_mellanox_nics)
|
||||
mlx_4_nics=$(detect_mlx_4_nics)
|
||||
mlx_5_nics=$(detect_mlx_5_nics)
|
||||
|
||||
if [ "$mellanox_nics" == "No NICs" ]; then
|
||||
if [ "$mlx_4_nics" == "No NICs" -a "$mlx_5_nics" == "No NICs" ]; then
|
||||
echo "No NICs"
|
||||
return 0
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user