DPDK patches and discussions
 help / color / mirror / Atom feed
From: Hemant Agrawal <hemant.agrawal@nxp.com>
To: <dev@dpdk.org>
Cc: <thomas@monjalon.net>, <anatoly.burakov@intel.com>
Subject: [dpdk-dev] [PATCH v2 1/2] vfio: expose clear group function for internal usages
Date: Mon, 15 Jan 2018 10:41:25 +0530	[thread overview]
Message-ID: <1515993086-22134-1-git-send-email-hemant.agrawal@nxp.com> (raw)
In-Reply-To: <1512642493-14609-1-git-send-email-hemant.agrawal@nxp.com>

other vfio based module e.g. fslmc will also need to use
the clear_group call.
So, exposing it and renaming it to *rte_vfio_clear_group*

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
---
 lib/librte_eal/bsdapp/eal/eal.c                |  5 +++++
 lib/librte_eal/common/include/rte_vfio.h       |  4 ++++
 lib/librte_eal/linuxapp/eal/eal_vfio.c         | 18 +++++++++---------
 lib/librte_eal/linuxapp/eal/eal_vfio.h         |  4 ----
 lib/librte_eal/linuxapp/eal/eal_vfio_mp_sync.c |  2 +-
 lib/librte_eal/rte_eal_version.map             |  1 +
 6 files changed, 20 insertions(+), 14 deletions(-)

diff --git a/lib/librte_eal/bsdapp/eal/eal.c b/lib/librte_eal/bsdapp/eal/eal.c
index 369a682..7239243 100644
--- a/lib/librte_eal/bsdapp/eal/eal.c
+++ b/lib/librte_eal/bsdapp/eal/eal.c
@@ -778,3 +778,8 @@ int rte_vfio_noiommu_is_enabled(void)
 {
 	return 0;
 }
+
+int rte_vfio_clear_group(int vfio_group_fd)
+{
+	return 0;
+}
diff --git a/lib/librte_eal/common/include/rte_vfio.h b/lib/librte_eal/common/include/rte_vfio.h
index a69c4ff..daa0dbd 100644
--- a/lib/librte_eal/common/include/rte_vfio.h
+++ b/lib/librte_eal/common/include/rte_vfio.h
@@ -148,6 +148,10 @@ int rte_vfio_is_enabled(const char *modname);
  */
 int rte_vfio_noiommu_is_enabled(void);
 
+/* remove group fd from internal VFIO group fd array */
+int
+rte_vfio_clear_group(int vfio_group_fd);
+
 #endif /* VFIO_PRESENT */
 
 #endif /* _RTE_VFIO_H_ */
diff --git a/lib/librte_eal/linuxapp/eal/eal_vfio.c b/lib/librte_eal/linuxapp/eal/eal_vfio.c
index 681eab5..5371ec2 100644
--- a/lib/librte_eal/linuxapp/eal/eal_vfio.c
+++ b/lib/librte_eal/linuxapp/eal/eal_vfio.c
@@ -197,7 +197,7 @@ vfio_group_device_count(int vfio_group_fd)
 }
 
 int
-clear_group(int vfio_group_fd)
+rte_vfio_clear_group(int vfio_group_fd)
 {
 	int i;
 	int socket_fd, ret;
@@ -300,12 +300,12 @@ rte_vfio_setup_device(const char *sysfs_base, const char *dev_addr,
 		RTE_LOG(ERR, EAL, "  %s cannot get group status, "
 				"error %i (%s)\n", dev_addr, errno, strerror(errno));
 		close(vfio_group_fd);
-		clear_group(vfio_group_fd);
+		rte_vfio_clear_group(vfio_group_fd);
 		return -1;
 	} else if (!(group_status.flags & VFIO_GROUP_FLAGS_VIABLE)) {
 		RTE_LOG(ERR, EAL, "  %s VFIO group is not viable!\n", dev_addr);
 		close(vfio_group_fd);
-		clear_group(vfio_group_fd);
+		rte_vfio_clear_group(vfio_group_fd);
 		return -1;
 	}
 
@@ -319,7 +319,7 @@ rte_vfio_setup_device(const char *sysfs_base, const char *dev_addr,
 			RTE_LOG(ERR, EAL, "  %s cannot add VFIO group to container, "
 					"error %i (%s)\n", dev_addr, errno, strerror(errno));
 			close(vfio_group_fd);
-			clear_group(vfio_group_fd);
+			rte_vfio_clear_group(vfio_group_fd);
 			return -1;
 		}
 
@@ -341,7 +341,7 @@ rte_vfio_setup_device(const char *sysfs_base, const char *dev_addr,
 					"  %s failed to select IOMMU type\n",
 					dev_addr);
 				close(vfio_group_fd);
-				clear_group(vfio_group_fd);
+				rte_vfio_clear_group(vfio_group_fd);
 				return -1;
 			}
 			ret = t->dma_map_func(vfio_cfg.vfio_container_fd);
@@ -350,7 +350,7 @@ rte_vfio_setup_device(const char *sysfs_base, const char *dev_addr,
 					"  %s DMA remapping failed, error %i (%s)\n",
 					dev_addr, errno, strerror(errno));
 				close(vfio_group_fd);
-				clear_group(vfio_group_fd);
+				rte_vfio_clear_group(vfio_group_fd);
 				return -1;
 			}
 		}
@@ -366,7 +366,7 @@ rte_vfio_setup_device(const char *sysfs_base, const char *dev_addr,
 		RTE_LOG(WARNING, EAL, "Getting a vfio_dev_fd for %s failed\n",
 				dev_addr);
 		close(vfio_group_fd);
-		clear_group(vfio_group_fd);
+		rte_vfio_clear_group(vfio_group_fd);
 		return -1;
 	}
 
@@ -378,7 +378,7 @@ rte_vfio_setup_device(const char *sysfs_base, const char *dev_addr,
 				strerror(errno));
 		close(*vfio_dev_fd);
 		close(vfio_group_fd);
-		clear_group(vfio_group_fd);
+		rte_vfio_clear_group(vfio_group_fd);
 		return -1;
 	}
 	vfio_group_device_get(vfio_group_fd);
@@ -438,7 +438,7 @@ rte_vfio_release_device(const char *sysfs_base, const char *dev_addr,
 			return -1;
 		}
 
-		if (clear_group(vfio_group_fd) < 0) {
+		if (rte_vfio_clear_group(vfio_group_fd) < 0) {
 			RTE_LOG(INFO, EAL, "Error when clearing group for %s\n",
 					   dev_addr);
 			return -1;
diff --git a/lib/librte_eal/linuxapp/eal/eal_vfio.h b/lib/librte_eal/linuxapp/eal/eal_vfio.h
index b34d5d0..359589e 100644
--- a/lib/librte_eal/linuxapp/eal/eal_vfio.h
+++ b/lib/librte_eal/linuxapp/eal/eal_vfio.h
@@ -148,10 +148,6 @@ vfio_get_group_no(const char *sysfs_base,
 int
 vfio_get_group_fd(int iommu_group_no);
 
-/* remove group fd from internal VFIO group fd array */
-int
-clear_group(int vfio_group_fd);
-
 int vfio_mp_sync_setup(void);
 
 #define SOCKET_REQ_CONTAINER 0x100
diff --git a/lib/librte_eal/linuxapp/eal/eal_vfio_mp_sync.c b/lib/librte_eal/linuxapp/eal/eal_vfio_mp_sync.c
index 9b474dc..7cc3c15 100644
--- a/lib/librte_eal/linuxapp/eal/eal_vfio_mp_sync.c
+++ b/lib/librte_eal/linuxapp/eal/eal_vfio_mp_sync.c
@@ -304,7 +304,7 @@ vfio_mp_sync_thread(void __rte_unused * arg)
 				continue;
 			}
 
-			ret = clear_group(vfio_data);
+			ret = rte_vfio_clear_group(vfio_data);
 
 			if (ret < 0)
 				vfio_mp_sync_send_request(conn_sock, SOCKET_NO_FD);
diff --git a/lib/librte_eal/rte_eal_version.map b/lib/librte_eal/rte_eal_version.map
index 3fa1e13..7088b72 100644
--- a/lib/librte_eal/rte_eal_version.map
+++ b/lib/librte_eal/rte_eal_version.map
@@ -205,6 +205,7 @@ DPDK_18.02 {
 
 	rte_hypervisor_get;
 	rte_hypervisor_get_name;
+	rte_vfio_clear_group;
 
 } DPDK_17.11;
 
-- 
2.7.4

  parent reply	other threads:[~2018-01-15  5:12 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-07 10:28 [dpdk-dev] [PATCH 01/2] " Hemant Agrawal
2017-12-07 10:28 ` [dpdk-dev] [PATCH 02/2] bus/fslmc: clear the vfio group on error Hemant Agrawal
2018-01-12 15:27 ` [dpdk-dev] [PATCH 01/2] vfio: expose clear group function for internal usages Burakov, Anatoly
2018-01-12 16:36 ` Thomas Monjalon
2018-01-14 13:05   ` Hemant Agrawal
2018-01-15  5:11 ` Hemant Agrawal [this message]
2018-01-15  5:11   ` [dpdk-dev] [PATCH v2 2/2] bus/fslmc: clear the vfio group on error Hemant Agrawal
2018-01-16 23:43   ` [dpdk-dev] [PATCH v2 1/2] vfio: expose clear group function for internal usages Thomas Monjalon

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=1515993086-22134-1-git-send-email-hemant.agrawal@nxp.com \
    --to=hemant.agrawal@nxp.com \
    --cc=anatoly.burakov@intel.com \
    --cc=dev@dpdk.org \
    --cc=thomas@monjalon.net \
    /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).