From: Stephen Hemminger <sthem...@microsoft.com> Small script to rebind netvsc kernel device to Hyper-V networking PMD. The existing dev_bind.py script is PCI specific and won't work with VMBUS.
Signed-off-by: Stephen Hemminger <sthem...@microsoft.com> --- usertools/hv_uio_setup.sh | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100755 usertools/hv_uio_setup.sh diff --git a/usertools/hv_uio_setup.sh b/usertools/hv_uio_setup.sh new file mode 100755 index 000000000000..fc56ec6f9273 --- /dev/null +++ b/usertools/hv_uio_setup.sh @@ -0,0 +1,39 @@ +#! /bin/bash +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2018 Microsoft Corporation + +module=uio_hv_generic +guid="f8615163-df3e-46c5-913f-f2d2f965ed0e" + +if [ $# -ne 1 ]; then + echo "Usage: $0 ethN" + exit 1 +fi + +syspath=/sys/class/net/$1/device +devpath=$(readlink $syspath) +if [ $? -ne 0 ]; then + echo "$1 no device present" + exit 1 +fi +guid=$(basename $devpath) + +driver=$(readlink $syspath/driver) +if [ $? -ne 0 ]; then + echo "$1 driver not found" + exit 1 +fi +existing=$(basename $driver) + +if [ "$existing" != "hv_netvsc" ]; then + echo "$1 controlled by $existing" + exit 1 +fi + +if [ ! -d /sys/module/$module ]; then + modprobe $module + echo $guid >/sys/bus/vmbus/drivers/uio_hv_generic/new_id +fi + +echo $guid > /sys/bus/vmbus/drivers/$existing/unbind +echo $guid > /sys/bus/vmbus/drivers/$module/bind -- 2.15.1