From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 34E507D62 for ; Wed, 24 May 2017 17:27:03 +0200 (CEST) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 May 2017 08:27:00 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.38,386,1491289200"; d="scan'208";a="265893662" Received: from silpixa00381631.ir.intel.com (HELO silpixa00381631.ger.corp.intel.com) ([10.237.222.122]) by fmsmga004.fm.intel.com with ESMTP; 24 May 2017 08:26:59 -0700 From: Pablo de Lara To: declan.doherty@intel.com, thomas@monjalon.net Cc: dev@dpdk.org, Pablo de Lara Date: Wed, 24 May 2017 16:27:06 +0100 Message-Id: <1495639634-74846-5-git-send-email-pablo.de.lara.guarch@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1495639634-74846-1-git-send-email-pablo.de.lara.guarch@intel.com> References: <1495639634-74846-1-git-send-email-pablo.de.lara.guarch@intel.com> Subject: [dpdk-dev] [PATCH 04/12] cryptodev: simplify device list retrieval logic X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 May 2017 15:27:04 -0000 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 --- lib/librte_cryptodev/rte_cryptodev.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) 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; -- 2.7.4