From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f41.google.com (mail-wm0-f41.google.com [74.125.82.41]) by dpdk.org (Postfix) with ESMTP id BE8C658EC for ; Tue, 6 Jun 2017 10:09:28 +0200 (CEST) Received: by mail-wm0-f41.google.com with SMTP id x70so31143868wme.0 for ; Tue, 06 Jun 2017 01:09:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=EqSEFm7+2eRKrEm8F7cfBXeiCL/BGrDd+hVfaNKe6pA=; b=Ubck+w4irjZTWd0xbeR0BGrqqwW9BmQBCcArsNNKT07Iw6ANv9rJpdevol3TglyDts J4TRepxhP/5grhrA34HB2jO2Tzn8/R1NEjCmpM/N4fAPnDSKd/SWshOQKj6xTmaunXF/ xpRPalHbWutYMTFqhWlIMGbvkCbZCtHc6W9O4Wy03PgY9MOkDimVPDGgnpQw3Anpgvzw nm9UY7eOv1Vo1JEdYk11gRT3LD0953iocohRX0wDF85TePCSYOHlgZ3tW2d7pLC85/MM iZVzwd+kMrnegbGn2yP8cGomjRjr3xgwlqm/JqPn2/K4/IC0j1s4IGl1BD9UWQy68PDA jzaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=EqSEFm7+2eRKrEm8F7cfBXeiCL/BGrDd+hVfaNKe6pA=; b=dUyD71461q9/+FMFn4ulc8eG2JfifqGP5ooxaEXgMhauOccMovDl3l2mGGtJxejtHt u3YS6FBVLvjXJdkU2zpMDtllInzDqCwjmQFXPXTKRqHr2CpWzEpBvYwPV9EKjK0pSzs2 j+9sS7EIUa41mGYBIGwl6xQ+p4a7XFszTkuTnjNR04qpJN+opGFlAqxtmTKW57TOC9vP hmVZvVU3bbsBTTxk6ZskoXjtEaFOhpiC9W8fJguWlX7Z2dLjXP/VUust0lLWeF7lULmm O77AifL64/qPhD1mfAzth6QZPn3uCRiZjp0ur2KRiCTL+KhLGEckS8pLGc5SqT+Bzw1F 433w== X-Gm-Message-State: AODbwcBSX+BUqIttjLyndFkOTyHahFbEZhbMxAYr9vgYVjUXLseze1IO G8yA4fq/bPVuvqLI X-Received: by 10.28.175.84 with SMTP id y81mr11199614wme.25.1496736568310; Tue, 06 Jun 2017 01:09:28 -0700 (PDT) Received: from bidouze.vm.6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id o109sm5705728wrc.48.2017.06.06.01.09.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 06 Jun 2017 01:09:27 -0700 (PDT) Date: Tue, 6 Jun 2017 10:09:21 +0200 From: =?iso-8859-1?Q?Ga=EBtan?= Rivet To: Jerin Jacob Cc: dev@dpdk.org, bruce.richardson@intel.com, harry.van.haaren@intel.com, hemant.agrawal@nxp.com, gage.eads@intel.com, nipun.gupta@nxp.com Message-ID: <20170606080921.GK18840@bidouze.vm.6wind.com> References: <20170601164146.13501-1-jerin.jacob@caviumnetworks.com> <20170605125555.GJ18840@bidouze.vm.6wind.com> <20170606030547.GA20006@jerin> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20170606030547.GA20006@jerin> User-Agent: Mutt/1.5.23 (2014-03-12) Subject: Re: [dpdk-dev] [PATCH] eventdev: remove PCI dependency 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, 06 Jun 2017 08:09:29 -0000 On Tue, Jun 06, 2017 at 08:35:48AM +0530, Jerin Jacob wrote: > -----Original Message----- > > Date: Mon, 5 Jun 2017 14:55:55 +0200 > > From: Gaëtan Rivet > > To: Jerin Jacob > > Cc: dev@dpdk.org, bruce.richardson@intel.com, harry.van.haaren@intel.com, > > hemant.agrawal@nxp.com, gage.eads@intel.com, nipun.gupta@nxp.com > > Subject: Re: [dpdk-dev] [PATCH] eventdev: remove PCI dependency > > User-Agent: Mutt/1.5.23 (2014-03-12) > > > > Hi Jerin, > > Hi Gaëtan, > > > > > On Thu, Jun 01, 2017 at 10:11:46PM +0530, Jerin Jacob wrote: > > > Remove the PCI dependency from generic data structures > > > and moved the PCI specific code to rte_event_pmd_pci* > > > > > > > Thanks for working on this. > > > > Do you plan on removing rte_pci.h in rte_eventdev_pmd.h? Do you think it > > would be feasible? > > That is for PCI PMD specific probe(rte_event_pmd_pci_probe() and rte_event_pmd_pci_remove()), > More like, lib/librte_ether/rte_ethdev_pci.h functions in ethdev. > So, I think, It is OK to keep rte_pci.h for PMD specific functions. > > Ok, sure. However rte_eventdev.c includes both rte_pci.h and rte_eventdev_pmd.h. Can it be made independent from the PMD specific include? > > > > > CC: Gaetan Rivet > > > Signed-off-by: Jerin Jacob > > > --- > > > drivers/event/skeleton/skeleton_eventdev.c | 30 +++++++++----- > > > lib/librte_eventdev/rte_eventdev.c | 37 +++++++----------- > > > lib/librte_eventdev/rte_eventdev.h | 2 - > > > lib/librte_eventdev/rte_eventdev_pmd.h | 63 ++++-------------------------- > > > 4 files changed, 41 insertions(+), 91 deletions(-) > > > > > > diff --git a/drivers/event/skeleton/skeleton_eventdev.c b/drivers/event/skeleton/skeleton_eventdev.c > > > index 800bd76e0..34684aba0 100644 > > > --- a/drivers/event/skeleton/skeleton_eventdev.c > > > +++ b/drivers/event/skeleton/skeleton_eventdev.c > > > @@ -427,18 +427,28 @@ static const struct rte_pci_id pci_id_skeleton_map[] = { > > > }, > > > }; > > > > > > -static struct rte_eventdev_driver pci_eventdev_skeleton_pmd = { > > > - .pci_drv = { > > > - .id_table = pci_id_skeleton_map, > > > - .drv_flags = RTE_PCI_DRV_NEED_MAPPING, > > > - .probe = rte_event_pmd_pci_probe, > > > - .remove = rte_event_pmd_pci_remove, > > > - }, > > > - .eventdev_init = skeleton_eventdev_init, > > > - .dev_private_size = sizeof(struct skeleton_eventdev), > > > +static int > > > +event_skeleton_pci_probe(struct rte_pci_driver *pci_drv, > > > + struct rte_pci_device *pci_dev) > > > +{ > > > + return rte_event_pmd_pci_probe(pci_drv, pci_dev, > > > + sizeof(struct skeleton_eventdev), skeleton_eventdev_init); > > > +} > > > + > > > +static int > > > +event_skeleton_pci_remove(struct rte_pci_device *pci_dev) > > > +{ > > > + return rte_event_pmd_pci_remove(pci_dev, NULL); > > > +} > > > + > > > +static struct rte_pci_driver pci_eventdev_skeleton_pmd = { > > > + .id_table = pci_id_skeleton_map, > > > + .drv_flags = RTE_PCI_DRV_NEED_MAPPING, > > > + .probe = event_skeleton_pci_probe, > > > + .remove = event_skeleton_pci_remove, > > > }; > > > > > > -RTE_PMD_REGISTER_PCI(event_skeleton_pci, pci_eventdev_skeleton_pmd.pci_drv); > > > +RTE_PMD_REGISTER_PCI(event_skeleton_pci, pci_eventdev_skeleton_pmd); > > > RTE_PMD_REGISTER_PCI_TABLE(event_skeleton_pci, pci_id_skeleton_map); > > > > > > /* VDEV based event device */ > > > diff --git a/lib/librte_eventdev/rte_eventdev.c b/lib/librte_eventdev/rte_eventdev.c > > > index 20afc3f0e..91f950666 100644 > > > --- a/lib/librte_eventdev/rte_eventdev.c > > > +++ b/lib/librte_eventdev/rte_eventdev.c > > > @@ -126,8 +126,6 @@ rte_event_dev_info_get(uint8_t dev_id, struct rte_event_dev_info *dev_info) > > > dev_info->dequeue_timeout_ns = dev->data->dev_conf.dequeue_timeout_ns; > > > > > > dev_info->dev = dev->dev; > > > - if (dev->driver) > > > - dev_info->driver_name = dev->driver->pci_drv.driver.name; > > > return 0; > > > } > > > > > > @@ -1250,18 +1248,18 @@ rte_event_pmd_vdev_uninit(const char *name) > > > > > > int > > > rte_event_pmd_pci_probe(struct rte_pci_driver *pci_drv, > > > - struct rte_pci_device *pci_dev) > > > + struct rte_pci_device *pci_dev, > > > + size_t private_data_size, > > > + eventdev_pmd_pci_callback_t devinit) > > > { > > > - struct rte_eventdev_driver *eventdrv; > > > struct rte_eventdev *eventdev; > > > > > > char eventdev_name[RTE_EVENTDEV_NAME_MAX_LEN]; > > > > > > int retval; > > > > > > - eventdrv = (struct rte_eventdev_driver *)pci_drv; > > > - if (eventdrv == NULL) > > > - return -ENODEV; > > > + if (devinit == NULL) > > > + return -EINVAL; > > > > > > rte_pci_device_name(&pci_dev->addr, eventdev_name, > > > sizeof(eventdev_name)); > > > @@ -1275,7 +1273,7 @@ rte_event_pmd_pci_probe(struct rte_pci_driver *pci_drv, > > > eventdev->data->dev_private = > > > rte_zmalloc_socket( > > > "eventdev private structure", > > > - eventdrv->dev_private_size, > > > + private_data_size, > > > RTE_CACHE_LINE_SIZE, > > > rte_socket_id()); > > > > > > @@ -1285,10 +1283,9 @@ rte_event_pmd_pci_probe(struct rte_pci_driver *pci_drv, > > > } > > > > > > eventdev->dev = &pci_dev->device; > > > - eventdev->driver = eventdrv; > > > > > > /* Invoke PMD device initialization function */ > > > - retval = (*eventdrv->eventdev_init)(eventdev); > > > + retval = devinit(eventdev); > > > if (retval == 0) > > > return 0; > > > > > > @@ -1307,12 +1304,12 @@ rte_event_pmd_pci_probe(struct rte_pci_driver *pci_drv, > > > } > > > > > > int > > > -rte_event_pmd_pci_remove(struct rte_pci_device *pci_dev) > > > +rte_event_pmd_pci_remove(struct rte_pci_device *pci_dev, > > > + eventdev_pmd_pci_callback_t devuninit) > > > { > > > - const struct rte_eventdev_driver *eventdrv; > > > struct rte_eventdev *eventdev; > > > char eventdev_name[RTE_EVENTDEV_NAME_MAX_LEN]; > > > - int ret; > > > + int ret = 0; > > > > > > if (pci_dev == NULL) > > > return -EINVAL; > > > @@ -1324,22 +1321,16 @@ rte_event_pmd_pci_remove(struct rte_pci_device *pci_dev) > > > if (eventdev == NULL) > > > return -ENODEV; > > > > > > - eventdrv = (const struct rte_eventdev_driver *)pci_dev->driver; > > > - if (eventdrv == NULL) > > > - return -ENODEV; > > > - > > > /* Invoke PMD device un-init function */ > > > - if (*eventdrv->eventdev_uninit) { > > > - ret = (*eventdrv->eventdev_uninit)(eventdev); > > > - if (ret) > > > - return ret; > > > - } > > > + if (devuninit) > > > + ret = devuninit(eventdev); > > > + if (ret) > > > + return ret; > > > > > > /* Free event device */ > > > rte_event_pmd_release(eventdev); > > > > > > eventdev->dev = NULL; > > > - eventdev->driver = NULL; > > > > > > return 0; > > > } > > > diff --git a/lib/librte_eventdev/rte_eventdev.h b/lib/librte_eventdev/rte_eventdev.h > > > index 20e7293e0..c5b2b7453 100644 > > > --- a/lib/librte_eventdev/rte_eventdev.h > > > +++ b/lib/librte_eventdev/rte_eventdev.h > > > @@ -1063,8 +1063,6 @@ struct rte_eventdev { > > > /**< Functions exported by PMD */ > > > struct rte_device *dev; > > > /**< Device info. supplied by probing */ > > > - const struct rte_eventdev_driver *driver; > > > - /**< Driver for this device */ > > > > > > RTE_STD_C11 > > > uint8_t attached : 1; > > > diff --git a/lib/librte_eventdev/rte_eventdev_pmd.h b/lib/librte_eventdev/rte_eventdev_pmd.h > > > index 4005b3c98..faa6989b4 100644 > > > --- a/lib/librte_eventdev/rte_eventdev_pmd.h > > > +++ b/lib/librte_eventdev/rte_eventdev_pmd.h > > > @@ -87,60 +87,6 @@ extern "C" { > > > #define RTE_EVENTDEV_DETACHED (0) > > > #define RTE_EVENTDEV_ATTACHED (1) > > > > > > -/** > > > - * Initialisation function of a event driver invoked for each matching > > > - * event PCI device detected during the PCI probing phase. > > > - * > > > - * @param dev > > > - * The dev pointer is the address of the *rte_eventdev* structure associated > > > - * with the matching device and which has been [automatically] allocated in > > > - * the *rte_event_devices* array. > > > - * > > > - * @return > > > - * - 0: Success, the device is properly initialised by the driver. > > > - * In particular, the driver MUST have set up the *dev_ops* pointer > > > - * of the *dev* structure. > > > - * - <0: Error code of the device initialisation failure. > > > - */ > > > -typedef int (*eventdev_init_t)(struct rte_eventdev *dev); > > > - > > > -/** > > > - * Finalisation function of a driver invoked for each matching > > > - * PCI device detected during the PCI closing phase. > > > - * > > > - * @param dev > > > - * The dev pointer is the address of the *rte_eventdev* structure associated > > > - * with the matching device and which has been [automatically] allocated in > > > - * the *rte_event_devices* array. > > > - * > > > - * @return > > > - * - 0: Success, the device is properly finalised by the driver. > > > - * In particular, the driver MUST free the *dev_ops* pointer > > > - * of the *dev* structure. > > > - * - <0: Error code of the device initialisation failure. > > > - */ > > > -typedef int (*eventdev_uninit_t)(struct rte_eventdev *dev); > > > - > > > -/** > > > - * The structure associated with a PMD driver. > > > - * > > > - * Each driver acts as a PCI driver and is represented by a generic > > > - * *event_driver* structure that holds: > > > - * > > > - * - An *rte_pci_driver* structure (which must be the first field). > > > - * > > > - * - The *eventdev_init* function invoked for each matching PCI device. > > > - * > > > - * - The size of the private data to allocate for each matching device. > > > - */ > > > -struct rte_eventdev_driver { > > > - struct rte_pci_driver pci_drv; /**< The PMD is also a PCI driver. */ > > > - unsigned int dev_private_size; /**< Size of device private data. */ > > > - > > > - eventdev_init_t eventdev_init; /**< Device init function. */ > > > - eventdev_uninit_t eventdev_uninit; /**< Device uninit function. */ > > > -}; > > > - > > > /** Global structure used for maintaining state of allocated event devices */ > > > struct rte_eventdev_global { > > > uint8_t nb_devs; /**< Number of devices found */ > > > @@ -579,18 +525,23 @@ rte_event_pmd_vdev_init(const char *name, size_t dev_private_size, > > > int > > > rte_event_pmd_vdev_uninit(const char *name); > > > > > > +typedef int (*eventdev_pmd_pci_callback_t)(struct rte_eventdev *dev); > > > + > > > /** > > > * Wrapper for use by pci drivers as a .probe function to attach to a event > > > * interface. > > > */ > > > int rte_event_pmd_pci_probe(struct rte_pci_driver *pci_drv, > > > - struct rte_pci_device *pci_dev); > > > + struct rte_pci_device *pci_dev, > > > + size_t private_data_size, > > > + eventdev_pmd_pci_callback_t devinit); > > > > > > /** > > > * Wrapper for use by pci drivers as a .remove function to detach a event > > > * interface. > > > */ > > > -int rte_event_pmd_pci_remove(struct rte_pci_device *pci_dev); > > > +int rte_event_pmd_pci_remove(struct rte_pci_device *pci_dev, > > > + eventdev_pmd_pci_callback_t devuninit); > > > > > > #ifdef __cplusplus > > > } > > > -- > > > 2.13.0 > > > > > > > -- > > Gaëtan Rivet > > 6WIND -- Gaëtan Rivet 6WIND