From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id 728899E7 for ; Tue, 7 Feb 2017 16:11:56 +0100 (CET) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga105.jf.intel.com with ESMTP; 07 Feb 2017 07:11:55 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,346,1477983600"; d="scan'208";a="1123275102" Received: from irsmsx101.ger.corp.intel.com ([163.33.3.153]) by fmsmga002.fm.intel.com with ESMTP; 07 Feb 2017 07:11:54 -0800 Received: from irsmsx102.ger.corp.intel.com ([169.254.2.230]) by IRSMSX101.ger.corp.intel.com ([169.254.1.112]) with mapi id 14.03.0248.002; Tue, 7 Feb 2017 15:11:01 +0000 From: "Van Haaren, Harry" To: Jerin Jacob , "dev@dpdk.org" CC: "Richardson, Bruce" , "hemant.agrawal@nxp.com" , "Eads, Gage" Thread-Topic: [dpdk-dev] [PATCH 2/4] evendev: add vdev uninit support Thread-Index: AQHSgDlYYabxQJbzSkGJ/l/pNT/wpaFdpnsA Date: Tue, 7 Feb 2017 15:11:01 +0000 Message-ID: References: <1486358620-4075-1-git-send-email-jerin.jacob@caviumnetworks.com> <1486358620-4075-3-git-send-email-jerin.jacob@caviumnetworks.com> In-Reply-To: <1486358620-4075-3-git-send-email-jerin.jacob@caviumnetworks.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiZTQ4ZmVlYTctOGQzOC00NTEzLTg1YmUtNjE1NmRjMDE4ZTI1IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6ImNoWkwza3JYMXlndHlEYjlaQ09zVHBMUmJYd1RQMWZ1NlFoZDArdnVLRWc9In0= x-ctpclassification: CTP_IC x-originating-ip: [163.33.239.182] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH 2/4] evendev: add vdev uninit support X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Feb 2017 15:11:57 -0000 > -----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 ; hemant.agrawal@nxp.co= m; Eads, Gage > ; Van Haaren, Harry ; Je= rin Jacob > > Subject: [dpdk-dev] [PATCH 2/4] evendev: add vdev uninit support >=20 > Added eventdev vdev uninit support to release the resources > allocated in eventdev vdev init. >=20 > Signed-off-by: Jerin Jacob > --- One comment below to update version.map 17.05, but once that's fixed Acked-by: Harry van Haaren > 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(-) >=20 > 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; >=20 > if (eventdev =3D=3D NULL) > return -EINVAL; > @@ -1153,8 +1155,26 @@ rte_event_pmd_release(struct rte_eventdev *eventde= v) >=20 > eventdev->attached =3D RTE_EVENTDEV_DETACHED; > eventdev_globals.nb_devs--; > + > + if (rte_eal_process_type() =3D=3D RTE_PROC_PRIMARY) { > + rte_free(eventdev->data->dev_private); > + > + /* Generate memzone name */ > + ret =3D snprintf(mz_name, sizeof(mz_name), "rte_eventdev_data_%u", > + eventdev->data->dev_id); > + if (ret >=3D (int)sizeof(mz_name)) > + return -EINVAL; > + > + mz =3D rte_memzone_lookup(mz_name); > + if (mz =3D=3D NULL) > + return -ENOMEM; > + > + ret =3D rte_memzone_free(mz); > + if (ret) > + return ret; > + } > + > eventdev->data =3D NULL; > - > return 0; > } >=20 > @@ -1186,6 +1206,24 @@ rte_event_pmd_vdev_init(const char *name, size_t d= ev_private_size, > } >=20 > int > +rte_event_pmd_vdev_uninit(const char *name) > +{ > + struct rte_eventdev *eventdev; > + > + if (name =3D=3D NULL) > + return -EINVAL; > + > + eventdev =3D rte_event_pmd_get_named_dev(name); > + if (eventdev =3D=3D 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); >=20 > - if (rte_eal_process_type() =3D=3D RTE_PROC_PRIMARY) > - rte_free(eventdev->data->dev_private); > eventdev->pci_dev =3D NULL; > eventdev->driver =3D NULL; >=20 > 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; >=20 > - if (dev_id >=3D rte_eventdev_globals->nb_devs) > + if (dev_id >=3D RTE_EVENT_MAX_DEVS) > return 0; >=20 > dev =3D &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); >=20 > +/** > + * 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); >=20 > /** > * Wrapper for use by pci drivers as a .probe function to attach to a ev= ent > 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; >=20 > -- > 2.5.5