From e3580da16745d45a816ae910930e20fdbf044e9e Mon Sep 17 00:00:00 2001 From: Liang Yan Date: Tue, 1 Nov 2016 22:36:41 +0800 Subject: [PATCH] test: Use lspci to discover default kernel drivers Instead of searching /sys for devices and checking which driver happens to be loaded, use lspci. The lspci tool is a bit smarter - it knows which driver is loaded now but also which driver is the default driver the kernel wants to load for that type of device. It's that default that we need. Change-Id: I1dc01ab6eac233e85f42316567bde2f4ed2203c6 Signed-off-by: Liang Yan --- test/nvmf/common.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/nvmf/common.sh b/test/nvmf/common.sh index ba781ba3f..e4b8d7755 100755 --- a/test/nvmf/common.sh +++ b/test/nvmf/common.sh @@ -40,7 +40,7 @@ function detect_mellanox_nics() # for nvmf target loopback test, suppose we only have one type of card. for nvmf_nic_bdf in $nvmf_nic_bdfs do - result=`find /sys -name $nvmf_nic_bdf | grep driver | awk -F / '{ print $6 }'` + 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"