DPDK patches and discussions
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <sthemmin@microsoft.com>
Subject: [dpdk-dev] [RFC 2/3] usertools: add hv_uio_setup script
Date: Thu,  4 Jan 2018 15:16:35 -0800	[thread overview]
Message-ID: <20180104231636.30573-3-stephen@networkplumber.org> (raw)
In-Reply-To: <20180104231636.30573-1-stephen@networkplumber.org>

From: Stephen Hemminger <sthemmin@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 <sthemmin@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

  parent reply	other threads:[~2018-01-04 23:16 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-04 23:16 [dpdk-dev] [RFC 0/3] Hyper-V bus and network device Stephen Hemminger
2018-01-04 23:16 ` [dpdk-dev] [RFC 1/3] bus: add vmbus support Stephen Hemminger
2018-01-04 23:16 ` Stephen Hemminger [this message]
2018-01-04 23:16 ` [dpdk-dev] [RFC 3/3] net: add hyper-v network device 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=20180104231636.30573-3-stephen@networkplumber.org \
    --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).