diff options
author | Luca Boccassi <luca.boccassi@gmail.com> | 2019-03-20 14:45:09 +0000 |
---|---|---|
committer | Luca Boccassi <luca.boccassi@gmail.com> | 2019-03-20 14:45:37 +0000 |
commit | f7a9461e29147c47ce2bb81bd157ac1833cf5eb1 (patch) | |
tree | 6f3b4f4850cf9f116acc1dda3f0515259673e13b /lib/librte_eal/linuxapp/igb_uio | |
parent | 8e6d9d118f6105a3627b64a7949e1fb0b145879e (diff) |
New upstream version 16.11.9upstream/16.11.9upstream-16.11-stable
Change-Id: Ia1ac246c53e5050b6a29d6952fb668ad6c782996
Signed-off-by: Luca Boccassi <luca.boccassi@gmail.com>
Diffstat (limited to 'lib/librte_eal/linuxapp/igb_uio')
-rw-r--r-- | lib/librte_eal/linuxapp/igb_uio/igb_uio.c | 31 |
1 files changed, 31 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 9f00f07a..59d6a093 100644 --- a/lib/librte_eal/linuxapp/igb_uio/igb_uio.c +++ b/lib/librte_eal/linuxapp/igb_uio/igb_uio.c @@ -170,6 +170,33 @@ igbuio_pci_irqhandler(int irq, struct uio_info *info) return IRQ_HANDLED; } +/** + * This gets called while opening uio device file. + */ +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; + + /* set bus master, which was cleared by the reset function */ + pci_set_master(dev); + + return 0; +} + +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; + + /* stop the device from further DMA */ + pci_clear_master(dev); + + return 0; +} + #ifdef CONFIG_XEN_DOM0 static int igbuio_dom0_mmap_phys(struct uio_info *info, struct vm_area_struct *vma) @@ -370,6 +397,8 @@ igbuio_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) udev->info.version = "0.1"; udev->info.handler = igbuio_pci_irqhandler; udev->info.irqcontrol = igbuio_pci_irqcontrol; + udev->info.open = igbuio_pci_open; + udev->info.release = igbuio_pci_release; #ifdef CONFIG_XEN_DOM0 /* check if the driver run on Xen Dom0 */ if (xen_initial_domain()) @@ -460,6 +489,8 @@ igbuio_pci_remove(struct pci_dev *dev) { struct rte_uio_pci_dev *udev = pci_get_drvdata(dev); + igbuio_pci_release(&udev->info, NULL); + sysfs_remove_group(&dev->dev.kobj, &dev_attr_grp); uio_unregister_device(&udev->info); igbuio_pci_release_iomem(&udev->info); |