]> git.droids-corp.org - dpdk.git/commitdiff
cryptodev: add function to retrieve device name
authorPablo de Lara <pablo.de.lara.guarch@intel.com>
Tue, 3 Oct 2017 02:32:54 +0000 (03:32 +0100)
committerPablo de Lara <pablo.de.lara.guarch@intel.com>
Thu, 12 Oct 2017 14:14:45 +0000 (15:14 +0100)
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>
lib/librte_cryptodev/rte_cryptodev.c
lib/librte_cryptodev/rte_cryptodev.h
lib/librte_cryptodev/rte_cryptodev_version.map

index a2393950bd6ca6de8134735e4417f3f88d76e5a1..e48d562b44413b47ae9f5a7add2eba0e9cd8f754 100644 (file)
@@ -1381,6 +1381,17 @@ rte_cryptodev_driver_id_get(const char *name)
        return -1;
 }
 
+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)
 {
index 5225a5b858eb2fe686327dc5c50ae50f422f1a0e..fd0e3f1972ef9dfef80e84106bf819e08b733810 100644 (file)
@@ -462,6 +462,19 @@ rte_cryptodev_create_vdev(const char *name, const char *args);
 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.
index e9ba88ac5be6af3626e6d5a0f104729d41a5c05e..919b6cc7bb1b08ea34c432d94673c5570b058ea8 100644 (file)
@@ -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;