DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] igb_uio: allow multi-process access
@ 2017-12-09  1:57 Xiao Wang
  2017-12-12  1:38 ` Stephen Hemminger
                   ` (2 more replies)
  0 siblings, 3 replies; 13+ messages in thread
From: Xiao Wang @ 2017-12-09  1:57 UTC (permalink / raw)
  To: ferruh.yigit; +Cc: dev, Xiao Wang

In some case, one device are accessed by different processes via
different BARs, so one uio device may be opened by more than one
process, for this case we just need to enable interrupt once, and
pci_clear_master only when the last process closed.

Fixes: 5f6ff30dc507 ("igb_uio: fix interrupt enablement after FLR in VM")

Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
---
 lib/librte_eal/linuxapp/igb_uio/igb_uio.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/lib/librte_eal/linuxapp/igb_uio/igb_uio.c b/lib/librte_eal/linuxapp/igb_uio/igb_uio.c
index a3a98c1..c239d98 100644
--- a/lib/librte_eal/linuxapp/igb_uio/igb_uio.c
+++ b/lib/librte_eal/linuxapp/igb_uio/igb_uio.c
@@ -45,6 +45,7 @@ struct rte_uio_pci_dev {
 	struct uio_info info;
 	struct pci_dev *pdev;
 	enum rte_intr_mode mode;
+	uint32_t ref_cnt;
 };
 
 static char *intr_mode;
@@ -336,6 +337,9 @@ struct rte_uio_pci_dev {
 	struct pci_dev *dev = udev->pdev;
 	int err;
 
+	if (++(udev->ref_cnt) > 1)
+		return 0;
+
 	/* set bus master, which was cleared by the reset function */
 	pci_set_master(dev);
 
@@ -354,6 +358,9 @@ struct rte_uio_pci_dev {
 	struct rte_uio_pci_dev *udev = info->priv;
 	struct pci_dev *dev = udev->pdev;
 
+	if (--(udev->ref_cnt) > 0)
+		return 0;
+
 	/* disable interrupts */
 	igbuio_pci_disable_interrupts(udev);
 
-- 
1.8.3.1

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2018-03-08 21:17 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-09  1:57 [dpdk-dev] [PATCH] igb_uio: allow multi-process access Xiao Wang
2017-12-12  1:38 ` Stephen Hemminger
2017-12-18 15:53   ` Wang, Xiao W
2017-12-19 15:42 ` [dpdk-dev] [PATCH v2] " Xiao Wang
2017-12-19  9:04   ` Tiwei Bie
2017-12-19  9:23     ` Wang, Xiao W
2017-12-19 15:39   ` Stephen Hemminger
2017-12-19 17:58   ` [dpdk-dev] [PATCH v3] " Xiao Wang
2017-12-20  2:17     ` Tiwei Bie
2018-01-01 22:00     ` [dpdk-dev] [PATCH v4] " Xiao Wang
2018-01-16 19:43       ` Ferruh Yigit
2018-01-16 23:37         ` Thomas Monjalon
2018-03-08 21:17 ` [dpdk-dev] [PATCH] " Stephen Hemminger

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).