DPDK patches and discussions
 help / color / mirror / Atom feed
From: Anatoly Burakov <anatoly.burakov@intel.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH] vfio: open VFIO container at startup rather than during init
Date: Tue, 17 Jun 2014 10:12:04 +0100	[thread overview]
Message-ID: <4bf447650cc99e316e6427e3a1c134dd417af4ec.1402996488.git.anatoly.burakov@intel.com> (raw)


Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
 lib/librte_eal/linuxapp/eal/eal_pci_vfio.c | 15 ++-------------
 1 file changed, 2 insertions(+), 13 deletions(-)

diff --git a/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c b/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c
index 4de6061..9eb5dcd 100644
--- a/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c
+++ b/lib/librte_eal/linuxapp/eal/eal_pci_vfio.c
@@ -523,17 +523,6 @@ pci_vfio_map_resource(struct rte_pci_device *dev)
 	rte_snprintf(pci_addr, sizeof(pci_addr), PCI_PRI_FMT,
 			loc->domain, loc->bus, loc->devid, loc->function);
 
-	/* get container fd (needs to be done only once per initialization) */
-	if (vfio_cfg.vfio_container_fd == -1) {
-		int vfio_container_fd = pci_vfio_get_container_fd();
-		if (vfio_container_fd < 0) {
-			RTE_LOG(ERR, EAL, "  %s cannot open VFIO container!\n", pci_addr);
-			return -1;
-		}
-
-		vfio_cfg.vfio_container_fd = vfio_container_fd;
-	}
-
 	/* get group number */
 	iommu_group_no = pci_vfio_get_group_no(pci_addr);
 
@@ -770,10 +759,10 @@ pci_vfio_enable(void)
 		vfio_cfg.vfio_groups[i].fd = -1;
 		vfio_cfg.vfio_groups[i].group_no = -1;
 	}
-	vfio_cfg.vfio_container_fd = -1;
+	vfio_cfg.vfio_container_fd = pci_vfio_get_container_fd();
 
 	/* check if we have VFIO driver enabled */
-	if (access(VFIO_DIR, F_OK) == 0)
+	if (vfio_cfg.vfio_container_fd != -1)
 		vfio_cfg.vfio_enabled = 1;
 	else
 		RTE_LOG(INFO, EAL, "VFIO driver not loaded or wrong permissions\n");
-- 
1.8.1.4

             reply	other threads:[~2014-06-17  9:12 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-17  9:12 Anatoly Burakov [this message]
2014-06-17 16:50 ` Richardson, Bruce
2014-06-17 16:55 ` Thomas Monjalon
2014-06-18  8:57   ` Burakov, Anatoly
2014-06-18 10:08     ` Dumitrescu, Cristian
2014-06-18 10:26       ` Burakov, Anatoly
2014-06-18 11:00         ` Neil Horman
2014-06-18 11:02           ` Burakov, Anatoly
2014-06-18 11:07             ` Neil Horman
2014-06-18 13:07 ` [dpdk-dev] [PATCH v2 0/2] Fix issues with VFIO Anatoly Burakov
2014-06-18 13:07   ` [dpdk-dev] [PATCH v2 1/2] vfio: open VFIO container at startup rather than during init Anatoly Burakov
2014-06-18 13:07   ` [dpdk-dev] [PATCH v2 2/2] vfio: more verbose error messages Anatoly Burakov
2014-06-18 13:44   ` [dpdk-dev] [PATCH v2 0/2] Fix issues with VFIO Neil Horman
2014-06-18 15:07   ` [dpdk-dev] [PATCH v3 " Anatoly Burakov
2014-06-18 15:07     ` [dpdk-dev] [PATCH v3 1/2] vfio: open VFIO container at startup rather than during init Anatoly Burakov
2014-06-18 15:07     ` [dpdk-dev] [PATCH v3 2/2] vfio: more verbose error messages Anatoly Burakov
2014-06-18 17:55     ` [dpdk-dev] [PATCH v3 0/2] Fix issues with VFIO Richardson, Bruce
2014-06-18 23:09       ` Thomas Monjalon
2014-06-18 18:51     ` Neil Horman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4bf447650cc99e316e6427e3a1c134dd417af4ec.1402996488.git.anatoly.burakov@intel.com \
    --to=anatoly.burakov@intel.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).