DPDK patches and discussions
 help / color / mirror / Atom feed
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
Date: Sun, 17 Jun 2018 20:01:51 +0530	[thread overview]
Message-ID: <20180617143150.GB27164@jerin> (raw)
In-Reply-To: <20180615034524.28623-1-pbhagavatula@caviumnetworks.com>

-----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
> 

  reply	other threads:[~2018-06-17 14:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-15  3:45 Pavan Nikhilesh
2018-06-17 14:31 ` Jerin Jacob [this message]
2018-06-24 11:26   ` 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=20180617143150.GB27164@jerin \
    --to=jerin.jacob@caviumnetworks.com \
    --cc=dev@dpdk.org \
    --cc=pbhagavatula@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).