From mboxrd@z Thu Jan 1 00:00:00 1970 From: Gregory Etelson Subject: i40e igb_uio: reset pci on process exit Date: Wed, 24 May 2017 14:22:11 +0300 Message-ID: <106841857.Z7q1jSDIte@polaris> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7Bit Cc: Ferruh Yigit , Qi Zhang , Wenzhuo Lu To: dev@dpdk.org Return-path: Received: from mail-wm0-f45.google.com (mail-wm0-f45.google.com [74.125.82.45]) by dpdk.org (Postfix) with ESMTP id DB8E97CB9 for ; Wed, 24 May 2017 13:22:13 +0200 (CEST) Received: by mail-wm0-f45.google.com with SMTP id 7so60617787wmo.1 for ; Wed, 24 May 2017 04:22:13 -0700 (PDT) List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Hello, My tests show if DPDK process attached to i40e VF through igb_uio exists without calling rte_eth_dev_close() then new instance attached to that VF could experience IO failures. I came up with the following patch to ensure igb_uio will always reset PCI on process exit. However, I would like to hear experts opinion to be sure __pci_reset_function resets i40e VF properly. Thank you. Regards, Gregory diff --git a/lib/librte_eal/linuxapp/igb_uio/igb_uio.c b/lib/librte_eal/linuxapp/igb_uio/igb_uio.c index b9d427c..7d7ff9d 100644 --- a/lib/librte_eal/linuxapp/igb_uio/igb_uio.c +++ b/lib/librte_eal/linuxapp/igb_uio/igb_uio.c @@ -170,6 +170,19 @@ struct rte_uio_pci_dev { return IRQ_HANDLED; } +static int +igbuio_pci_release(struct uio_info *info, struct inode *inode) +{ + int ret; + struct rte_uio_pci_dev *udev = info->priv; + struct pci_dev *dev = udev->pdev; + ret = __pci_reset_function(dev); + dev_info(&dev->dev, "pci_reset_function %s \n", + ret == 0 ? "succeded" : "failed"); + return 0; +} + + #ifdef CONFIG_XEN_DOM0 static int igbuio_dom0_mmap_phys(struct uio_info *info, struct vm_area_struct *vma) @@ -372,6 +385,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())