* [dpdk-dev] [PATCH] eventdev: update get id from name to include PCI devices
@ 2018-06-15 3:45 Pavan Nikhilesh
2018-06-17 14:31 ` Jerin Jacob
0 siblings, 1 reply; 3+ messages in thread
From: Pavan Nikhilesh @ 2018-06-15 3:45 UTC (permalink / raw)
To: jerin.jacob; +Cc: dev, Pavan Nikhilesh
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 <pbhagavatula@caviumnetworks.com>
---
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [dpdk-dev] [PATCH] eventdev: update get id from name to include PCI devices
2018-06-15 3:45 [dpdk-dev] [PATCH] eventdev: update get id from name to include PCI devices Pavan Nikhilesh
@ 2018-06-17 14:31 ` Jerin Jacob
2018-06-24 11:26 ` Jerin Jacob
0 siblings, 1 reply; 3+ messages in thread
From: Jerin Jacob @ 2018-06-17 14:31 UTC (permalink / raw)
To: Pavan Nikhilesh; +Cc: dev
-----Original Message-----
> Date: Fri, 15 Jun 2018 09:15:24 +0530
> From: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
> To: jerin.jacob@caviumnetworks.com
> Cc: dev@dpdk.org, Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
> 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 <pbhagavatula@caviumnetworks.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
> ---
> 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
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [dpdk-dev] [PATCH] eventdev: update get id from name to include PCI devices
2018-06-17 14:31 ` Jerin Jacob
@ 2018-06-24 11:26 ` Jerin Jacob
0 siblings, 0 replies; 3+ messages in thread
From: Jerin Jacob @ 2018-06-24 11:26 UTC (permalink / raw)
To: Pavan Nikhilesh; +Cc: dev
-----Original Message-----
> Date: Sun, 17 Jun 2018 20:01:51 +0530
> From: Jerin Jacob <jerin.jacob@caviumnetworks.com>
> To: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
> CC: dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH] eventdev: update get id from name to
> include PCI devices
> User-Agent: Mutt/1.10.0 (2018-05-17)
>
>
> -----Original Message-----
> > Date: Fri, 15 Jun 2018 09:15:24 +0530
> > From: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
> > To: jerin.jacob@caviumnetworks.com
> > Cc: dev@dpdk.org, Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
> > 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 <pbhagavatula@caviumnetworks.com>
>
>
> Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Applied to dpdk-next-eventdev/master. Thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-06-24 11:27 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-15 3:45 [dpdk-dev] [PATCH] eventdev: update get id from name to include PCI devices Pavan Nikhilesh
2018-06-17 14:31 ` Jerin Jacob
2018-06-24 11:26 ` Jerin Jacob
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).