From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f44.google.com (mail-wm0-f44.google.com [74.125.82.44]) by dpdk.org (Postfix) with ESMTP id 3154A5A3E for ; Tue, 6 Jun 2017 08:03:58 +0200 (CEST) Received: by mail-wm0-f44.google.com with SMTP id x70so28709307wme.0 for ; Mon, 05 Jun 2017 23:03:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=weka.io; s=google; h=from:to:subject:date:message-id:organization:mime-version :content-transfer-encoding; bh=HHqBOQgCxlg39MKL++FEonbNDJSA57OSGciAbpk+G/g=; b=m5IJIRj2RsVD56DyuJ28Lv8M8kNfgnqaYNZrqVFwl5pHggzJcfI+/aShQynizAMbUt IW2m35Psc6hJiMio1gI7bWtBy9B1lFoq+Hh3wfHMslZG+6/9X37/cUt4DY/e30QHjBAJ 8wIOYeEVjl/9WhIk7Y85zQKCXz8K2ucKBoqKc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:organization :mime-version:content-transfer-encoding; bh=HHqBOQgCxlg39MKL++FEonbNDJSA57OSGciAbpk+G/g=; b=InPQpsiSovK+qZYdTUdX4E18ayFyXHlT0NrLbHHs6xROJQobjLPRd/7N8+gLkcnygh N3ul6/a0qJs/4AURqNtSPTe4uQ0hNAdNRkevZOIGHSLKZbTEQ47KFEq30ZtYSYsBgvgg e5eT4MuP0UMESERdMeB8IRoj8pIUaXAk7IdRIeiSuSdHFLU9S1dgS0UrMzk0p4kUED5V qukiSBQQnjHdaT/acrkM2J2Xa8WMNa3woNrbypUQqfL8n+BsM2wz8k9DWCGeSULkb7GG +iKI3ZfiQl5nUgAcQfyvP6B3gHMvxEUmmJMWEST0C6ECNN8se5O8+GdR8QL/ewnCE/Nk WX/Q== X-Gm-Message-State: AODbwcDyv0yfidEzNDW/dCKSFF9sb56RR/KrLm+IxCQMGnHRMBZ75QDl IERmXWrr7nlvdnfuEYQ= X-Received: by 10.28.99.7 with SMTP id x7mr10151134wmb.39.1496729037629; Mon, 05 Jun 2017 23:03:57 -0700 (PDT) Received: from polaris.localnet (bzq-84-109-69-99.cablep.bezeqint.net. [84.109.69.99]) by smtp.gmail.com with ESMTPSA id k56sm5188801wrk.45.2017.06.05.23.03.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Jun 2017 23:03:56 -0700 (PDT) From: Gregory Etelson To: dev@dpdk.org, "Yigit, Ferruh" , "Tan, Jianfeng" , Shijith Thotton , Stephen Hemminger , Qi Zhang Date: Tue, 06 Jun 2017 09:03:55 +0300 Message-ID: <3336123.hs2y1kGb2P@polaris> Organization: Weka.IO MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7Bit X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: [dpdk-dev] [PATCH] igb_uio: reset PCI function on process exit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 06 Jun 2017 06:03:58 -0000 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 --- 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