From: Gregory Etelson <gregory@weka.io>
To: dev@dpdk.org, "Yigit, Ferruh" <ferruh.yigit@intel.com>,
"Tan, Jianfeng" <jianfeng.tan@intel.com>,
Shijith Thotton <shijith.thotton@caviumnetworks.com>,
Stephen Hemminger <stephen@networkplumber.org>,
Qi Zhang <qi.z.zhang@intel.com>
Subject: [dpdk-dev] [PATCH] igb_uio: reset PCI function on process exit
Date: Tue, 06 Jun 2017 09:03:55 +0300 [thread overview]
Message-ID: <3336123.hs2y1kGb2P@polaris> (raw)
re-bind PCI function to igb_uio
after process termination
tested adapters: Intel 10G, Intel 40G
known issues: ENA adapters on AWS I3 instances fail to reset PCI function
Signed-off-by: Gregory Etelson <gregory@weka.io>
---
lib/librte_eal/linuxapp/igb_uio/igb_uio.c | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
diff --git a/lib/librte_eal/linuxapp/igb_uio/igb_uio.c b/lib/librte_eal/linuxapp/igb_uio/igb_uio.c
index b9d427c..f09ca0d 100644
--- a/lib/librte_eal/linuxapp/igb_uio/igb_uio.c
+++ b/lib/librte_eal/linuxapp/igb_uio/igb_uio.c
@@ -317,6 +317,17 @@ struct rte_uio_pci_dev {
return (iom != 0 || iop != 0) ? ret : -ENOENT;
}
+static int
+igbuio_pci_release(struct uio_info *info, struct inode *inode)
+{
+ struct rte_uio_pci_dev *udev = info->priv;
+ struct pci_dev *dev = udev->pdev;
+
+ int ret = __pci_reset_function(dev);
+ dev_info(&udev->pdev->dev, "PCI reset %s\n", !ret ? "done" : "failed");
+ return 0;
+}
+
#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0)
static int __devinit
#else
@@ -372,6 +383,7 @@ struct rte_uio_pci_dev {
udev->info.version = "0.1";
udev->info.handler = igbuio_pci_irqhandler;
udev->info.irqcontrol = igbuio_pci_irqcontrol;
+ udev->info.release = igbuio_pci_release;
#ifdef CONFIG_XEN_DOM0
/* check if the driver run on Xen Dom0 */
if (xen_initial_domain())
--
1.7.1
next reply other threads:[~2017-06-06 6:03 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-06 6:03 Gregory Etelson [this message]
2017-10-06 21:36 ` Ferruh Yigit
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=3336123.hs2y1kGb2P@polaris \
--to=gregory@weka.io \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@intel.com \
--cc=jianfeng.tan@intel.com \
--cc=qi.z.zhang@intel.com \
--cc=shijith.thotton@caviumnetworks.com \
--cc=stephen@networkplumber.org \
/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).