aboutsummaryrefslogtreecommitdiffstats
path: root/extras
diff options
context:
space:
mode:
Diffstat (limited to 'extras')
-rwxr-xr-xextras/scripts/vfctl10
1 files changed, 10 insertions, 0 deletions
diff --git a/extras/scripts/vfctl b/extras/scripts/vfctl
index 21868b021bb..9fe6c8b02e7 100755
--- a/extras/scripts/vfctl
+++ b/extras/scripts/vfctl
@@ -4,6 +4,15 @@ function die() {
echo "ERROR: $*" >&2
exit 1
}
+function pci-unbind() {
+ echo $1 | sudo tee /sys/bus/pci/devices/$1/driver/unbind > /dev/null
+}
+function pci-bind() {
+ pci-unbind $1
+ echo $2 | sudo tee /sys/bus/pci/devices/$1/driver_override > /dev/null
+ echo $1 | sudo tee /sys/bus/pci/drivers/$2/bind > /dev/null
+ echo | sudo tee /sys/bus/pci/devices/$1/driver_override > /dev/null
+}
function show_vfs() {
path=$1
@@ -92,6 +101,7 @@ function create () {
sudo ip link set dev ${netdev} vf ${vfid} mac ${mac}
sudo ip link set dev ${netdev} vf ${vfid} trust on
sudo ip link set dev ${netdev} vf ${vfid} spoofchk off
+ pci-bind ${vf} vfio-pci
done
[ $(cat ${path}/sriov_numvfs) -gt 0 ] && show_vfs ${path} ${netdev}