From c170a0802eb8781757578440007eace9bfc3e407 Mon Sep 17 00:00:00 2001 From: Juraj Linkeš Date: Fri, 13 Nov 2020 13:46:20 +0100 Subject: vpp_device: fix vpp device kernel driver binding MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Attempt to unbind a driver from a device only if it is bound to a driver. Remove the dynamic addition of an existing device ID to a driver. From the docs [0]: Writing a device ID to this file will attempt to dynamically add a new device ID to a PCI device driver. Since we assume the VFs are bound to the kernel driver when VPP Device topology creation is done, it implies that the kernel driver supports the device ID of those VFs, removing the need to add the support. [0]: https://www.kernel.org/doc/Documentation/ABI/testing/sysfs-bus-pci Change-Id: I20f3ca071a5a84a06ff358ba514532248a8f9ad0 Signed-off-by: Juraj Linkeš (cherry picked from commit 71d7150a65a7c006bf46b2c1001dbaa00b5681fb) --- resources/libraries/bash/function/device.sh | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/resources/libraries/bash/function/device.sh b/resources/libraries/bash/function/device.sh index a94244e52c..8eb0702bbd 100644 --- a/resources/libraries/bash/function/device.sh +++ b/resources/libraries/bash/function/device.sh @@ -98,15 +98,11 @@ function bind_interfaces_to_driver () { pci_path="/sys/bus/pci/devices/${ADDR}" drv_path="/sys/bus/pci/drivers/${DRIVER}" - vd=$(cat ${pci_path}/vendor ${pci_path}/device) || { - die "Failed to retrieve interface details!" - } - set +e - echo ${vd} | sudo tee ${drv_path}/new_id - set -e - echo ${ADDR} | sudo tee ${pci_path}/driver/unbind || { - die "Failed to unbind interface ${ADDR}!" - } + if [ -d "${pci_path}/driver" ]; then + echo ${ADDR} | sudo tee ${pci_path}/driver/unbind || { + die "Failed to unbind interface ${ADDR}!" + } + fi echo ${ADDR} | sudo tee ${drv_path}/bind || { die "Failed to bind interface ${ADDR}!" } -- cgit 1.2.3-korg