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

Message ID 20170621062826.21896-5-pablo.de.lara.guarch@intel.com (mailing list archive)
State Accepted, archived
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

De Lara Guarch, Pablo June 21, 2017, 6:28 a.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>
Acked-by: Declan Doherty <declan.doherty@intel.com>
---
 lib/librte_cryptodev/rte_cryptodev.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)
  

Patch

diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
index 8875304..46b9adc 100644
--- a/lib/librte_cryptodev/rte_cryptodev.c
+++ b/lib/librte_cryptodev/rte_cryptodev.c
@@ -511,15 +511,11 @@  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,
-					driver_name, strlen(driver_name));
-			else
-				cmp = strncmp(devs[i].data->name,
-					driver_name, strlen(driver_name));
+			cmp = strncmp(devs[i].device->driver->name,
+					driver_name,
+					strlen(driver_name));
 
 			if (cmp == 0)
 				devices[count++] = devs[i].data->dev_id;