[dpdk-dev,04/12] cryptodev: simplify device list retrieval logic

Message ID 1495639634-74846-5-git-send-email-pablo.de.lara.guarch@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Pablo de Lara Guarch
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

De Lara Guarch, Pablo May 24, 2017, 3:27 p.m. UTC
  rte_cryptodev_devices_get() function returns an array of devices
sharing the same driver.

Instead of having two different paths depending on the device being
virtual or physical, retrieve the driver name from rte_device structure.

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
---
 lib/librte_cryptodev/rte_cryptodev.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)
  

Comments

Doherty, Declan June 20, 2017, 2:35 p.m. UTC | #1
On 24/05/2017 4:27 PM, Pablo de Lara wrote:
> rte_cryptodev_devices_get() function returns an array of devices
> sharing the same driver.
>
> Instead of having two different paths depending on the device being
> virtual or physical, retrieve the driver name from rte_device structure.
>
> Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
> ---
...
>

this should be squashed with the previous patch


Acked-by: Declan Doherty <declan.doherty@intel.com>
  
De Lara Guarch, Pablo June 20, 2017, 5:29 p.m. UTC | #2
> -----Original Message-----

> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Declan Doherty

> Sent: Tuesday, June 20, 2017 3:36 PM

> To: De Lara Guarch, Pablo <pablo.de.lara.guarch@intel.com>;

> thomas@monjalon.net

> Cc: dev@dpdk.org

> Subject: Re: [dpdk-dev] [PATCH 04/12] cryptodev: simplify device list retrieval

> logic

> 

> On 24/05/2017 4:27 PM, Pablo de Lara wrote:

> > rte_cryptodev_devices_get() function returns an array of devices

> > sharing the same driver.

> >

> > Instead of having two different paths depending on the device being

> > virtual or physical, retrieve the driver name from rte_device structure.

> >

> > Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>

> > ---

> ...

> >

> 

> this should be squashed with the previous patch


As said, I will fix the previous one and leave this as it is.

Thanks,
Pablo
  

Patch

diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
index 6880661..53534ac 100644
--- a/lib/librte_cryptodev/rte_cryptodev.c
+++ b/lib/librte_cryptodev/rte_cryptodev.c
@@ -533,15 +533,10 @@  rte_cryptodev_devices_get(const char *driver_name, uint8_t *devices,
 	for (i = 0; i < max_devs && count < nb_devices;	i++) {
 
 		if (devs[i].attached == RTE_CRYPTODEV_ATTACHED) {
-			const struct rte_cryptodev_driver *drv = devs[i].driver;
 			int cmp;
 
-			if (drv)
-				cmp = strncmp(drv->pci_drv.driver.name,
-						dev_name, strlen(dev_name));
-			else
-				cmp = strncmp(devs[i].data->name,
-						dev_name, strlen(dev_name));
+			cmp = strncmp(devs[i].device->driver->name, driver_name,
+						strlen(driver_name));
 
 			if (cmp == 0)
 				devices[count++] = devs[i].data->dev_id;