[dpdk-dev] i40e igb_uio: reset pci on process exit

Shijith Thotton shijith.thotton at caviumnetworks.com
Mon May 29 11:48:59 CEST 2017


On Fri, May 26, 2017 at 07:14:55PM +0300, Gregory Etelson wrote:
>    I did not look into VFIO driver yet
> 
>     
> 
>    Regards,
> 
>    Gregory
> 
>     
> 
>    On Friday, 26 May 2017 18:53:21 IDT Stephen Hemminger wrote:
> 
>    > On Fri, 26 May 2017 09:17:33 +0300
> 
>    > Gregory Etelson <gregory at weka.io> wrote:
> 
>    >
> 
>    > > Thank you.
> 
>    > >
> 
>    > > Regards,
> 
>    > > Gregory
> 
>    > >
> 
>    > > On Friday, 26 May 2017 09:05:11 IDT Shijith Thotton wrote:
> 
>    > > > On Fri, May 26, 2017 at 07:30:58AM +0300, Gregory Etelson wrote:
> 
>    > > >
> 
>    > > > Hi Gregory,
> 
>    > > >
> 
>    > > > The patch is useful for LiquidIO PMD as we can avoid VF FLR request
>    to
> 
>    > > > PF. One comment inline..
> 
>    > > >
> 
>    > > > [..]
> 
>    > > > > > >
> 
>    > > > > > > +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);
> 
>    > > >
> 
>    > > > s/__pci_reset_function/pci_reset_function
> 
>    > > >
> 
>    > > > > > > + dev_info(&dev->dev, "pci_reset_function %s \n",
> 
>    > > > > > > + ret == 0 ? "succeded" : "failed");
> 
>    > > > > > > + return 0;
> 
>    > > > > > > +}
> 
>    > > > [..]
> 
>    > > >
> 
>    > > > Thanks,
> 
>    > > > Shijith
> 
>    > > >
> 
>    > >
> 
>    >
> 
>    > What does VFIO do?
> 
>    >
> 
>    > It looks like in vfio case pci_enable is held off until open and
>    pci_disable is done
> 
>    > on close. There are other things that may need to be done to make close
>    work
> 
>    > correctly. Like turning of msix. Also reset may not always be possible.
>

Better follow VFIO as Stephen advised. VFIO does pci reset inside open[1] and
tries to reset device during release[2]. 

1. elixir.free-electrons.com/linux/latest/source/drivers/vfio/pci/vfio_pci.c#L229
2. elixir.free-electrons.com/linux/latest/source/drivers/vfio/pci/vfio_pci.c#L361

static int
igbuio_pci_open(struct uio_info *info, struct inode *inode)
{
       struct rte_uio_pci_dev *udev = info->priv;
       struct pci_dev *dev = udev->pdev;

       return pci_reset_function(dev);
}

and.. 
	udev->info.open = igbuio_pci_open;



More information about the dev mailing list