[dpdk-dev] [PATCH 2/3] usertools: add hv_uio_setup script
Stephen Hemminger
stephen at networkplumber.org
Thu Apr 5 21:13:04 CEST 2018
Small script to rebind netvsc kernel device to Hyper-V
networking PMD. It could be integrated in dpdk-bind, but dpdk-bind
is focused on PCI, and that would get messy.
Eventually, this functionality will be built into netvsc driver
(see vdev_netvsc as an example).
Signed-off-by: Stephen Hemminger <sthemmin at microsoft.com>
---
usertools/hv_uio_setup.sh | 40 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 40 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..9885a0e80828
--- /dev/null
+++ b/usertools/hv_uio_setup.sh
@@ -0,0 +1,40 @@
+#! /bin/bash
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2018 Microsoft Corporation
+
+module=uio_hv_generic
+# Hyper-V network device GUID
+net_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
+dev_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 $net_guid >/sys/bus/vmbus/drivers/uio_hv_generic/new_id
+fi
+
+echo $dev_guid > /sys/bus/vmbus/drivers/$existing/unbind
+echo $dev_guid > /sys/bus/vmbus/drivers/$module/bind
--
2.16.3
More information about the dev
mailing list