[dpdk-dev] [PATCH v4 2/4] eventdev: restructure event PMD release function

Jerin Jacob jerin.jacob at caviumnetworks.com
Fri Jun 9 10:37:27 CEST 2017


Remove rte_event_dev_close() from rte_event_pmd_release() function so
that  rte_event_pmd_release() can be used in stateless way. This will
enable rte_event_pmd_vdev_uninit() function to avoid using
eventdev_globals  global variable and the need for exposing the a
global variable to PMD.

Signed-off-by: Jerin Jacob <jerin.jacob at caviumnetworks.com>
---
 lib/librte_eventdev/rte_eventdev.c | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/lib/librte_eventdev/rte_eventdev.c b/lib/librte_eventdev/rte_eventdev.c
index fd0406747..74a2614c4 100644
--- a/lib/librte_eventdev/rte_eventdev.c
+++ b/lib/librte_eventdev/rte_eventdev.c
@@ -1171,10 +1171,6 @@ rte_event_pmd_release(struct rte_eventdev *eventdev)
 	if (eventdev == NULL)
 		return -EINVAL;
 
-	ret = rte_event_dev_close(eventdev->data->dev_id);
-	if (ret < 0)
-		return ret;
-
 	eventdev->attached = RTE_EVENTDEV_DETACHED;
 	eventdev_globals.nb_devs--;
 
@@ -1230,6 +1226,7 @@ rte_event_pmd_vdev_init(const char *name, size_t dev_private_size,
 int
 rte_event_pmd_vdev_uninit(const char *name)
 {
+	int ret;
 	struct rte_eventdev *eventdev;
 
 	if (name == NULL)
@@ -1239,6 +1236,10 @@ rte_event_pmd_vdev_uninit(const char *name)
 	if (eventdev == NULL)
 		return -ENODEV;
 
+	ret = rte_event_dev_close(eventdev->data->dev_id);
+	if (ret < 0)
+		return ret;
+
 	/* Free the event device */
 	rte_event_pmd_release(eventdev);
 
@@ -1293,11 +1294,7 @@ rte_event_pmd_pci_probe(struct rte_pci_driver *pci_drv,
 			(unsigned int) pci_dev->id.vendor_id,
 			(unsigned int) pci_dev->id.device_id);
 
-	if (rte_eal_process_type() == RTE_PROC_PRIMARY)
-		rte_free(eventdev->data->dev_private);
-
-	eventdev->attached = RTE_EVENTDEV_DETACHED;
-	eventdev_globals.nb_devs--;
+	rte_event_pmd_release(eventdev);
 
 	return -ENXIO;
 }
@@ -1320,6 +1317,10 @@ rte_event_pmd_pci_remove(struct rte_pci_device *pci_dev,
 	if (eventdev == NULL)
 		return -ENODEV;
 
+	ret = rte_event_dev_close(eventdev->data->dev_id);
+	if (ret < 0)
+		return ret;
+
 	/* Invoke PMD device un-init function */
 	if (devuninit)
 		ret = devuninit(eventdev);
-- 
2.13.1



More information about the dev mailing list