From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <sthemmin@microsoft.com>
Subject: [dpdk-dev] [PATCH 2/3] usertools: add hv_uio_setup script
Date: Thu, 5 Apr 2018 12:13:04 -0700 [thread overview]
Message-ID: <20180405191305.26813-3-sthemmin@microsoft.com> (raw)
In-Reply-To: <20180405191305.26813-1-sthemmin@microsoft.com>
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@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
next prev parent reply other threads:[~2018-04-05 19:13 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-05 19:13 [dpdk-dev] [PATCH 0/3] add Hyper-V bus and network driver Stephen Hemminger
2018-04-05 19:13 ` [dpdk-dev] [PATCH 1/3] bus/vmbus: add hyper-v virtual bus support Stephen Hemminger
2018-04-05 19:13 ` Stephen Hemminger [this message]
2018-04-05 20:43 ` [dpdk-dev] [PATCH 2/3] usertools: add hv_uio_setup script Thomas Monjalon
2018-04-05 21:03 ` Stephen Hemminger
2018-04-05 21:13 ` Thomas Monjalon
2018-04-05 21:18 ` Stephen Hemminger
2018-04-05 21:20 ` Stephen Hemminger
2018-04-05 22:39 ` Stephen Hemminger
2018-04-05 21:07 ` Bruce Richardson
2018-04-05 21:10 ` Thomas Monjalon
2018-04-05 22:43 ` Stephen Hemminger
2018-04-05 23:57 ` Ananyev, Konstantin
2018-04-06 0:22 ` Stephen Hemminger
2018-04-06 8:38 ` Bruce Richardson
2018-04-05 19:13 ` [dpdk-dev] [PATCH 3/3] net/netvsc: add hyper-v netvsc network device Stephen Hemminger
2018-04-05 20:52 ` Thomas Monjalon
2018-04-05 20:59 ` Stephen Hemminger
2018-04-05 21:07 ` Thomas Monjalon
2018-04-05 21:19 ` Stephen Hemminger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180405191305.26813-3-sthemmin@microsoft.com \
--to=stephen@networkplumber.org \
--cc=dev@dpdk.org \
--cc=sthemmin@microsoft.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).