From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jerin Jacob Subject: Re: [PATCH] eventdev: update get id from name to include PCI devices Date: Sun, 17 Jun 2018 20:01:51 +0530 Message-ID: <20180617143150.GB27164@jerin> References: <20180615034524.28623-1-pbhagavatula@caviumnetworks.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: dev@dpdk.org To: Pavan Nikhilesh Return-path: Received: from NAM01-BY2-obe.outbound.protection.outlook.com (mail-by2nam01on0086.outbound.protection.outlook.com [104.47.34.86]) by dpdk.org (Postfix) with ESMTP id 253531B481 for ; Sun, 17 Jun 2018 16:32:09 +0200 (CEST) Content-Disposition: inline In-Reply-To: <20180615034524.28623-1-pbhagavatula@caviumnetworks.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" -----Original Message----- > Date: Fri, 15 Jun 2018 09:15:24 +0530 > From: Pavan Nikhilesh > To: jerin.jacob@caviumnetworks.com > Cc: dev@dpdk.org, Pavan Nikhilesh > Subject: [dpdk-dev] [PATCH] eventdev: update get id from name to include > PCI devices > X-Mailer: git-send-email 2.17.1 > > Currently, rte_event_dev_get_dev_id works only for virtual devices(vdev) > update the function to include devices probed through pci. > > Signed-off-by: Pavan Nikhilesh Acked-by: Jerin Jacob > --- > lib/librte_eventdev/rte_eventdev.c | 15 ++++++++++----- > 1 file changed, 10 insertions(+), 5 deletions(-) > > diff --git a/lib/librte_eventdev/rte_eventdev.c b/lib/librte_eventdev/rte_eventdev.c > index 7ca9fd145..801810edd 100644 > --- a/lib/librte_eventdev/rte_eventdev.c > +++ b/lib/librte_eventdev/rte_eventdev.c > @@ -57,16 +57,21 @@ int > rte_event_dev_get_dev_id(const char *name) > { > int i; > + uint8_t cmp; > > if (!name) > return -EINVAL; > > - for (i = 0; i < rte_eventdev_globals->nb_devs; i++) > - if ((strcmp(rte_event_devices[i].data->name, name) > - == 0) && > - (rte_event_devices[i].attached == > - RTE_EVENTDEV_ATTACHED)) > + for (i = 0; i < rte_eventdev_globals->nb_devs; i++) { > + cmp = (strncmp(rte_event_devices[i].data->name, name, > + RTE_EVENTDEV_NAME_MAX_LEN) == 0) || > + (rte_event_devices[i].dev ? (strncmp( > + rte_event_devices[i].dev->driver->name, name, > + RTE_EVENTDEV_NAME_MAX_LEN) == 0) : 0); > + if (cmp && (rte_event_devices[i].attached == > + RTE_EVENTDEV_ATTACHED)) > return i; > + } > return -ENODEV; > } > > -- > 2.17.1 >