From 2c94318f925114c797c8dc60d41fe8b68d90d460 Mon Sep 17 00:00:00 2001 From: Ziye Yang Date: Mon, 25 Jan 2016 18:49:26 +0800 Subject: [PATCH] Update bind.sh to bind nvme/ioat to uio_pci_generic driver This patch is used to detect the nvme and ioat devices in the tested platform and bind it to uio_pci_generic driver. Thus, when we can smoothly use pci device functions provided by DPDK instead of using libpciaccess. Change-Id: Ibfe504fd2864c9b4980eacd0adc5ff2a029b5eaf Signed-off-by: Ziye Yang --- scripts/unbind.sh | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/scripts/unbind.sh b/scripts/unbind.sh index a57b4a83ce..dd09841fac 100755 --- a/scripts/unbind.sh +++ b/scripts/unbind.sh @@ -2,9 +2,44 @@ set -e +function prep_nvme { + TMP=`mktemp` + # Get vendor_id:device_id by nvme's class_id and subcalss_id + lspci -n | awk -F " " '{if ($2 == "0108:") {print $3}}' \ + | awk -F ":" '{print $1" "$2}' > $TMP + + cat $TMP | while read device + do + echo $device > /sys/bus/pci/drivers/uio_pci_generic/new_id + done + rm $TMP +} + +function prep_ioat { + TMP=`mktemp` + #collect all the device_id info of ioat devices. + grep "PCI_DEVICE_ID_INTEL_IOAT" $rootdir/lib/ioat/ioat_pci.h \ + | awk -F"x" '{print $2}' > $TMP + vendor=8086 + + for device in `cat $TMP` + do + result=`lspci -n | grep "$vendor:$device"` + if [ "$result" ] + then + echo $vendor $device > /sys/bus/pci/drivers/uio_pci_generic/new_id + fi + done + rm $TMP +} + function configure_linux { rmmod nvme || true + rmmod uio_pci_generic || true rmmod ioatdma || true + modprobe uio_pci_generic || true + prep_nvme + prep_ioat } function configure_freebsd {