DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] cryptodev: add function to retrieve device name
@ 2017-10-03  2:32 Pablo de Lara
  2017-10-06  8:44 ` Sergio Gonzalez Monroy
  0 siblings, 1 reply; 3+ messages in thread
From: Pablo de Lara @ 2017-10-03  2:32 UTC (permalink / raw)
  To: declan.doherty; +Cc: dev, Pablo de Lara

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 <pablo.de.lara.guarch@intel.com>
---
 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH] cryptodev: add function to retrieve device name
  2017-10-03  2:32 [dpdk-dev] [PATCH] cryptodev: add function to retrieve device name Pablo de Lara
@ 2017-10-06  8:44 ` Sergio Gonzalez Monroy
  2017-10-06 11:16   ` De Lara Guarch, Pablo
  0 siblings, 1 reply; 3+ messages in thread
From: Sergio Gonzalez Monroy @ 2017-10-06  8:44 UTC (permalink / raw)
  To: Pablo de Lara, declan.doherty; +Cc: dev

On 03/10/2017 03:32, Pablo de Lara wrote:
> 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 <pablo.de.lara.guarch@intel.com>
> ---

Acked-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH] cryptodev: add function to retrieve device name
  2017-10-06  8:44 ` Sergio Gonzalez Monroy
@ 2017-10-06 11:16   ` De Lara Guarch, Pablo
  0 siblings, 0 replies; 3+ messages in thread
From: De Lara Guarch, Pablo @ 2017-10-06 11:16 UTC (permalink / raw)
  To: Gonzalez Monroy, Sergio, Doherty, Declan; +Cc: dev



> -----Original Message-----
> From: Gonzalez Monroy, Sergio
> Sent: Friday, October 6, 2017 9:45 AM
> To: De Lara Guarch, Pablo <pablo.de.lara.guarch@intel.com>; Doherty,
> Declan <declan.doherty@intel.com>
> Cc: dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH] cryptodev: add function to retrieve device
> name
> 
> On 03/10/2017 03:32, Pablo de Lara wrote:
> > 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 <pablo.de.lara.guarch@intel.com>
> > ---
> 
> Acked-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>

Applied to dpdk-next-crypto.

Pablo

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-10-06 11:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-03  2:32 [dpdk-dev] [PATCH] cryptodev: add function to retrieve device name Pablo de Lara
2017-10-06  8:44 ` Sergio Gonzalez Monroy
2017-10-06 11:16   ` De Lara Guarch, Pablo

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