From: "Van Haaren, Harry" <harry.van.haaren@intel.com>
To: Jerin Jacob <jerin.jacob@caviumnetworks.com>,
"dev@dpdk.org" <dev@dpdk.org>
Cc: "Richardson, Bruce" <bruce.richardson@intel.com>,
"hemant.agrawal@nxp.com" <hemant.agrawal@nxp.com>,
"Eads, Gage" <gage.eads@intel.com>
Subject: Re: [dpdk-dev] [PATCH 2/4] evendev: add vdev uninit support
Date: Tue, 7 Feb 2017 15:11:01 +0000 [thread overview]
Message-ID: <E923DB57A917B54B9182A2E928D00FA6129EEDC2@IRSMSX102.ger.corp.intel.com> (raw)
In-Reply-To: <1486358620-4075-3-git-send-email-jerin.jacob@caviumnetworks.com>
> -----Original Message-----
> From: Jerin Jacob [mailto:jerin.jacob@caviumnetworks.com]
> Sent: Monday, February 6, 2017 5:24 AM
> To: dev@dpdk.org
> Cc: Richardson, Bruce <bruce.richardson@intel.com>; hemant.agrawal@nxp.com; Eads, Gage
> <gage.eads@intel.com>; Van Haaren, Harry <harry.van.haaren@intel.com>; Jerin Jacob
> <jerin.jacob@caviumnetworks.com>
> Subject: [dpdk-dev] [PATCH 2/4] evendev: add vdev uninit support
>
> Added eventdev vdev uninit support to release the resources
> allocated in eventdev vdev init.
>
> Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
> ---
One comment below to update version.map 17.05, but once that's fixed
Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
> lib/librte_eventdev/rte_eventdev.c | 43 +++++++++++++++++++++++++---
> lib/librte_eventdev/rte_eventdev_pmd.h | 12 +++++++-
> lib/librte_eventdev/rte_eventdev_version.map | 1 +
> 3 files changed, 51 insertions(+), 5 deletions(-)
>
> diff --git a/lib/librte_eventdev/rte_eventdev.c b/lib/librte_eventdev/rte_eventdev.c
> index 2b39fb2..09fc274 100644
> --- a/lib/librte_eventdev/rte_eventdev.c
> +++ b/lib/librte_eventdev/rte_eventdev.c
> @@ -1143,6 +1143,8 @@ int
> rte_event_pmd_release(struct rte_eventdev *eventdev)
> {
> int ret;
> + char mz_name[RTE_EVENTDEV_NAME_MAX_LEN];
> + const struct rte_memzone *mz;
>
> if (eventdev == NULL)
> return -EINVAL;
> @@ -1153,8 +1155,26 @@ rte_event_pmd_release(struct rte_eventdev *eventdev)
>
> eventdev->attached = RTE_EVENTDEV_DETACHED;
> eventdev_globals.nb_devs--;
> +
> + if (rte_eal_process_type() == RTE_PROC_PRIMARY) {
> + rte_free(eventdev->data->dev_private);
> +
> + /* Generate memzone name */
> + ret = snprintf(mz_name, sizeof(mz_name), "rte_eventdev_data_%u",
> + eventdev->data->dev_id);
> + if (ret >= (int)sizeof(mz_name))
> + return -EINVAL;
> +
> + mz = rte_memzone_lookup(mz_name);
> + if (mz == NULL)
> + return -ENOMEM;
> +
> + ret = rte_memzone_free(mz);
> + if (ret)
> + return ret;
> + }
> +
> eventdev->data = NULL;
> -
> return 0;
> }
>
> @@ -1186,6 +1206,24 @@ rte_event_pmd_vdev_init(const char *name, size_t dev_private_size,
> }
>
> int
> +rte_event_pmd_vdev_uninit(const char *name)
> +{
> + struct rte_eventdev *eventdev;
> +
> + if (name == NULL)
> + return -EINVAL;
> +
> + eventdev = rte_event_pmd_get_named_dev(name);
> + if (eventdev == NULL)
> + return -ENODEV;
> +
> + /* Free the event device */
> + rte_event_pmd_release(eventdev);
> +
> + return 0;
> +}
> +
> +int
> rte_event_pmd_pci_probe(struct rte_pci_driver *pci_drv,
> struct rte_pci_device *pci_dev)
> {
> @@ -1275,9 +1313,6 @@ rte_event_pmd_pci_remove(struct rte_pci_device *pci_dev)
> /* Free event device */
> rte_event_pmd_release(eventdev);
>
> - if (rte_eal_process_type() == RTE_PROC_PRIMARY)
> - rte_free(eventdev->data->dev_private);
> eventdev->pci_dev = NULL;
> eventdev->driver = NULL;
>
> diff --git a/lib/librte_eventdev/rte_eventdev_pmd.h b/lib/librte_eventdev/rte_eventdev_pmd.h
> index 4eea618..be5c784 100644
> --- a/lib/librte_eventdev/rte_eventdev_pmd.h
> +++ b/lib/librte_eventdev/rte_eventdev_pmd.h
> @@ -198,7 +198,7 @@ rte_event_pmd_is_valid_dev(uint8_t dev_id)
> {
> struct rte_eventdev *dev;
>
> - if (dev_id >= rte_eventdev_globals->nb_devs)
> + if (dev_id >= RTE_EVENT_MAX_DEVS)
> return 0;
>
> dev = &rte_eventdevs[dev_id];
> @@ -552,6 +552,16 @@ struct rte_eventdev *
> rte_event_pmd_vdev_init(const char *name, size_t dev_private_size,
> int socket_id);
>
> +/**
> + * Destroy the given virtual event device
> + *
> + * @param name
> + * PMD type name
> + * @return
> + * - 0 on success, negative on error
> + */
> +int
> +rte_event_pmd_vdev_uninit(const char *name);
>
> /**
> * Wrapper for use by pci drivers as a .probe function to attach to a event
> diff --git a/lib/librte_eventdev/rte_eventdev_version.map
> b/lib/librte_eventdev/rte_eventdev_version.map
> index b138eb3..c572c4d 100644
> --- a/lib/librte_eventdev/rte_eventdev_version.map
> +++ b/lib/librte_eventdev/rte_eventdev_version.map
> @@ -35,6 +35,7 @@ DPDK_17.02 {
Version to 17.05 I think?
> rte_event_pmd_allocate;
> rte_event_pmd_release;
> rte_event_pmd_vdev_init;
> + rte_event_pmd_vdev_uninit;
> rte_event_pmd_pci_probe;
> rte_event_pmd_pci_remove;
>
> --
> 2.5.5
next prev parent reply other threads:[~2017-02-07 15:11 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-06 5:23 [dpdk-dev] [PATCH 0/4] add eventdev " Jerin Jacob
2017-02-06 5:23 ` [dpdk-dev] [PATCH 1/4] eventdev: fix event driver name to eventdev lookup Jerin Jacob
2017-02-07 15:04 ` Van Haaren, Harry
2017-02-08 14:38 ` Jerin Jacob
2017-02-06 5:23 ` [dpdk-dev] [PATCH 2/4] evendev: add vdev uninit support Jerin Jacob
2017-02-07 15:11 ` Van Haaren, Harry [this message]
2017-02-08 14:39 ` Jerin Jacob
2017-02-06 5:23 ` [dpdk-dev] [PATCH 3/4] event/skeleton: " Jerin Jacob
2017-02-07 15:11 ` Van Haaren, Harry
2017-02-08 14:40 ` Jerin Jacob
2017-02-06 5:23 ` [dpdk-dev] [PATCH 4/4] app/test: unit test case to exercise eventdev vdev uninit Jerin Jacob
2017-02-07 15:17 ` Van Haaren, Harry
2017-02-08 12:30 ` Jerin Jacob
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=E923DB57A917B54B9182A2E928D00FA6129EEDC2@IRSMSX102.ger.corp.intel.com \
--to=harry.van.haaren@intel.com \
--cc=bruce.richardson@intel.com \
--cc=dev@dpdk.org \
--cc=gage.eads@intel.com \
--cc=hemant.agrawal@nxp.com \
--cc=jerin.jacob@caviumnetworks.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).