summaryrefslogtreecommitdiffstats
path: root/build-root/deb
diff options
context:
space:
mode:
authorPeter Ginchev <pginchev@cisco.com>2016-10-11 15:34:24 +0300
committerPeter Ginchev <pginchev@cisco.com>2016-10-11 19:56:16 +0300
commitdfa9c5bb9a6e9548267f3456724a5a1a7f342b06 (patch)
tree7e24be70a8781698be9e41c26bba2a361c5e870d /build-root/deb
parentf588f35d665425324af87378e09b40920e44a548 (diff)
Rebind kernel drivers on VPP uninstall
Change-Id: Icb0ce47134146c3a212b234f088c682982480128 Signed-off-by: Peter Ginchev <pginchev@cisco.com>
Diffstat (limited to 'build-root/deb')
-rw-r--r--build-root/deb/debian/vpp.postrm21
1 files changed, 21 insertions, 0 deletions
diff --git a/build-root/deb/debian/vpp.postrm b/build-root/deb/debian/vpp.postrm
new file mode 100644
index 00000000..ac16a459
--- /dev/null
+++ b/build-root/deb/debian/vpp.postrm
@@ -0,0 +1,21 @@
+#!/bin/sh -e
+
+removed=
+
+# Unbind user-mode PCI drivers
+pci_dirs=`find /sys/bus/pci/drivers -type d -name igb_uio -o -name uio_pci_generic -o -name vfio-pci`
+for d in $pci_dirs; do
+ for f in ${d}/*; do
+ [ -e "${f}/config" ] || continue
+ echo 1 > ${f}/remove
+ basename `dirname ${f}` | xargs echo -n "Removing driver"; echo " for PCI ID" `basename ${f}`
+ removed=y
+ done
+done
+if [ -n "${removed}" ]; then
+ echo "There are changes in PCI drivers, rescaning"
+ echo 1 > /sys/bus/pci/rescan
+else
+ echo "There weren't PCI devices binded"
+fi
+