DPDK patches and discussions
 help / color / mirror / Atom feed
From: Hemant Agrawal <hemant.agrawal@nxp.com>
To: <anatoly.burakov@intel.com>
Cc: <dev@dpdk.org>, <shreyansh.jain@nxp.com>
Subject: [dpdk-dev] [PATCH 01/2] vfio: expose clear group function for internal usages
Date: Thu, 7 Dec 2017 15:58:12 +0530	[thread overview]
Message-ID: <1512642493-14609-1-git-send-email-hemant.agrawal@nxp.com> (raw)

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>
---
 lib/librte_eal/linuxapp/eal/eal_vfio.c         | 18 +++++++++---------
 lib/librte_eal/linuxapp/eal/eal_vfio.h         |  2 +-
 lib/librte_eal/linuxapp/eal/eal_vfio_mp_sync.c |  2 +-
 lib/librte_eal/rte_eal_version.map             |  7 +++++++
 4 files changed, 18 insertions(+), 11 deletions(-)

diff --git a/lib/librte_eal/linuxapp/eal/eal_vfio.c b/lib/librte_eal/linuxapp/eal/eal_vfio.c
index 58f0123..76184d1 100644
--- a/lib/librte_eal/linuxapp/eal/eal_vfio.c
+++ b/lib/librte_eal/linuxapp/eal/eal_vfio.c
@@ -226,7 +226,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;
@@ -329,12 +329,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;
 	}
 
@@ -348,7 +348,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;
 		}
 
@@ -370,7 +370,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);
@@ -379,7 +379,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;
 			}
 		}
@@ -395,7 +395,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;
 	}
 
@@ -407,7 +407,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);
@@ -467,7 +467,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 ba7892b..12e38cc 100644
--- a/lib/librte_eal/linuxapp/eal/eal_vfio.h
+++ b/lib/librte_eal/linuxapp/eal/eal_vfio.h
@@ -179,7 +179,7 @@ vfio_get_group_fd(int iommu_group_no);
 
 /* remove group fd from internal VFIO group fd array */
 int
-clear_group(int vfio_group_fd);
+rte_vfio_clear_group(int vfio_group_fd);
 
 int vfio_mp_sync_setup(void);
 
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 b53ed7e..e32f2e3 100644
--- a/lib/librte_eal/linuxapp/eal/eal_vfio_mp_sync.c
+++ b/lib/librte_eal/linuxapp/eal/eal_vfio_mp_sync.c
@@ -333,7 +333,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 f4f46c1..5af887b 100644
--- a/lib/librte_eal/rte_eal_version.map
+++ b/lib/librte_eal/rte_eal_version.map
@@ -236,3 +236,10 @@ EXPERIMENTAL {
 	rte_service_start_with_defaults;
 
 } DPDK_17.11;
+
+DPDK_18.02 {
+	global:
+
+	rte_vfio_clear_group;
+
+} DPDK_17.11;
\ No newline at end of file
-- 
2.7.4

             reply	other threads:[~2017-12-07 10:29 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-07 10:28 Hemant Agrawal [this message]
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 ` [dpdk-dev] [PATCH v2 1/2] " Hemant Agrawal
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=1512642493-14609-1-git-send-email-hemant.agrawal@nxp.com \
    --to=hemant.agrawal@nxp.com \
    --cc=anatoly.burakov@intel.com \
    --cc=dev@dpdk.org \
    --cc=shreyansh.jain@nxp.com \
    /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).