From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 426931B300 for ; Tue, 3 Oct 2017 12:32:27 +0200 (CEST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 03 Oct 2017 03:32:26 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,474,1500966000"; d="scan'208";a="1201612870" Received: from silpixa00399464.ir.intel.com (HELO silpixa00399464.ger.corp.intel.com) ([10.237.222.157]) by fmsmga001.fm.intel.com with ESMTP; 03 Oct 2017 03:32:25 -0700 From: Pablo de Lara To: declan.doherty@intel.com Cc: dev@dpdk.org, Pablo de Lara Date: Tue, 3 Oct 2017 03:32:54 +0100 Message-Id: <20171003023254.62621-1-pablo.de.lara.guarch@intel.com> X-Mailer: git-send-email 2.9.4 Subject: [dpdk-dev] [PATCH] cryptodev: add function to retrieve device name 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: Tue, 03 Oct 2017 10:32:28 -0000 Currently, in order to get the name of a crypto device, a user needs to access to it using the crypto device structure. It is a better practise to have a function to retrieve this name, given a device id. Signed-off-by: Pablo de Lara --- lib/librte_cryptodev/rte_cryptodev.c | 11 +++++++++++ lib/librte_cryptodev/rte_cryptodev.h | 13 +++++++++++++ lib/librte_cryptodev/rte_cryptodev_version.map | 7 +++++++ 3 files changed, 31 insertions(+) diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c index a239395..e48d562 100644 --- a/lib/librte_cryptodev/rte_cryptodev.c +++ b/lib/librte_cryptodev/rte_cryptodev.c @@ -1382,6 +1382,17 @@ rte_cryptodev_driver_id_get(const char *name) } const char * +rte_cryptodev_name_get(uint8_t dev_id) +{ + struct rte_cryptodev *dev = rte_cryptodev_pmd_get_dev(dev_id); + + if (dev == NULL) + return NULL; + + return dev->data->name; +} + +const char * rte_cryptodev_driver_name_get(uint8_t driver_id) { struct cryptodev_driver *driver; diff --git a/lib/librte_cryptodev/rte_cryptodev.h b/lib/librte_cryptodev/rte_cryptodev.h index 5225a5b..fd0e3f1 100644 --- a/lib/librte_cryptodev/rte_cryptodev.h +++ b/lib/librte_cryptodev/rte_cryptodev.h @@ -463,6 +463,19 @@ extern int rte_cryptodev_get_dev_id(const char *name); /** + * Get the crypto device name given a device identifier. + * + * @param dev_id + * The identifier of the device + * + * @return + * - Returns crypto device name. + * - Returns NULL if crypto device is not present. + */ +extern const char * +rte_cryptodev_name_get(uint8_t dev_id); + +/** * Get the total number of crypto devices that have been successfully * initialised. * diff --git a/lib/librte_cryptodev/rte_cryptodev_version.map b/lib/librte_cryptodev/rte_cryptodev_version.map index e9ba88a..919b6cc 100644 --- a/lib/librte_cryptodev/rte_cryptodev_version.map +++ b/lib/librte_cryptodev/rte_cryptodev_version.map @@ -79,3 +79,10 @@ DPDK_17.08 { rte_crypto_aead_operation_strings; } DPDK_17.05; + +DPDK_17.11 { + global: + + rte_cryptodev_name_get; + +} DPDK_17.08; -- 2.9.4