Added API to retrieve the device id provided the device name.
Signed-off-by: Fiona Trahe <fiona.trahe@intel.com>
Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Signed-off-by: Shally Verma <shally.verma@caviumnetworks.com>
Signed-off-by: Ashish Gupta <ashish.gupta@caviumnetworks.com>
}
+int __rte_experimental
+rte_compressdev_get_dev_id(const char *name)
+{
+ unsigned int i;
+
+ if (name == NULL)
+ return -1;
+
+ for (i = 0; i < rte_compressdev_globals->nb_devs; i++)
+ if ((strcmp(rte_compressdev_globals->devs[i].data->name, name)
+ == 0) &&
+ (rte_compressdev_globals->devs[i].attached ==
+ RTE_COMPRESSDEV_ATTACHED))
+ return i;
+
+ return -1;
+}
+
uint8_t __rte_experimental
rte_compressdev_count(void)
{
/**< Total error count on operations dequeued */
};
+
+/**
+ * Get the device identifier for the named compress device.
+ *
+ * @param name
+ * Device name to select the device structure
+ * @return
+ * - Returns compress device identifier on success.
+ * - Return -1 on failure to find named compress device.
+ */
+int __rte_experimental
+rte_compressdev_get_dev_id(const char *name);
+
/**
* Get the compress device name given a device identifier.
*
rte_compressdev_dequeue_burst;
rte_compressdev_devices_get;
rte_compressdev_enqueue_burst;
+ rte_compressdev_get_dev_id;
rte_compressdev_get_feature_name;
rte_compressdev_info_get;
rte_compressdev_name_get;