From: Jerin Jacob Date: Fri, 9 Jun 2017 08:37:27 +0000 (+0530) Subject: eventdev: restructure release function X-Git-Tag: spdx-start~2973 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=6d0784e4910e736609a7efa9e19a854dde99f3c5;p=dpdk.git eventdev: restructure release function 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 --- diff --git a/lib/librte_eventdev/rte_eventdev.c b/lib/librte_eventdev/rte_eventdev.c index fd0406747e..74a2614c4c 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);