cryptodev: remove crypto device type enumeration
[dpdk.git] / lib / librte_cryptodev / rte_cryptodev.h
index bd422fd..9c2a373 100644 (file)
@@ -74,21 +74,6 @@ extern "C" {
 #define CRYPTODEV_NAME_DPAA2_SEC_PMD   crypto_dpaa2_sec
 /**< NXP DPAA2 - SEC PMD device name */
 
-/** Crypto device type */
-enum rte_cryptodev_type {
-       RTE_CRYPTODEV_NULL_PMD = 1,     /**< Null crypto PMD */
-       RTE_CRYPTODEV_AESNI_GCM_PMD,    /**< AES-NI GCM PMD */
-       RTE_CRYPTODEV_AESNI_MB_PMD,     /**< AES-NI multi buffer PMD */
-       RTE_CRYPTODEV_QAT_SYM_PMD,      /**< QAT PMD Symmetric Crypto */
-       RTE_CRYPTODEV_SNOW3G_PMD,       /**< SNOW 3G PMD */
-       RTE_CRYPTODEV_KASUMI_PMD,       /**< KASUMI PMD */
-       RTE_CRYPTODEV_ZUC_PMD,          /**< ZUC PMD */
-       RTE_CRYPTODEV_OPENSSL_PMD,    /**<  OpenSSL PMD */
-       RTE_CRYPTODEV_ARMV8_PMD,        /**< ARMv8 crypto PMD */
-       RTE_CRYPTODEV_SCHEDULER_PMD,    /**< Crypto Scheduler PMD */
-       RTE_CRYPTODEV_DPAA2_SEC_PMD,    /**< NXP DPAA2 - SEC PMD */
-};
-
 extern const char **rte_cyptodev_names;
 
 /* Logging Macros */
@@ -408,7 +393,7 @@ rte_cryptodev_get_feature_name(uint64_t flag);
 /**  Crypto device information */
 struct rte_cryptodev_info {
        const char *driver_name;                /**< Driver name. */
-       enum rte_cryptodev_type dev_type;       /**< Device type */
+       uint8_t driver_id;                      /**< Driver identifier */
        struct rte_pci_device *pci_dev;         /**< PCI information. */
 
        uint64_t feature_flags;                 /**< Feature flags */
@@ -512,13 +497,13 @@ rte_cryptodev_count(void);
 /**
  * Get number of crypto device defined type.
  *
- * @param      type    type of device.
+ * @param      driver_id       driver identifier.
  *
  * @return
  *   Returns number of crypto device.
  */
 extern uint8_t
-rte_cryptodev_count_devtype(enum rte_cryptodev_type type);
+rte_cryptodev_device_count_by_driver(uint8_t driver_id);
 
 /**
  * Get number and identifiers of attached crypto devices that
@@ -789,8 +774,8 @@ struct rte_cryptodev {
        struct rte_device *device;
        /**< Backing device */
 
-       enum rte_cryptodev_type dev_type;
-       /**< Crypto device type */
+       uint8_t driver_id;
+       /**< Crypto driver identifier*/
 
        struct rte_cryptodev_cb_list link_intr_cbs;
        /**< User application callback for interrupts if present */
@@ -927,8 +912,8 @@ struct rte_cryptodev_sym_session {
        struct {
                uint8_t dev_id;
                /**< Device Id */
-               enum rte_cryptodev_type dev_type;
-               /** Crypto Device type session created on */
+               uint8_t driver_id;
+               /** Crypto driver identifier session created on */
                struct rte_mempool *mp;
                /**< Mempool session allocated from */
        } __rte_aligned(8);
@@ -1009,6 +994,45 @@ int
 rte_cryptodev_queue_pair_detach_sym_session(uint16_t qp_id,
                struct rte_cryptodev_sym_session *session);
 
+/**
+ * Provide driver identifier.
+ *
+ * @param name
+ *   The pointer to a driver name.
+ * @return
+ *  The driver type identifier or -1 if no driver found
+ */
+int rte_cryptodev_driver_id_get(const char *name);
+
+/**
+ * Provide driver name.
+ *
+ * @param driver_id
+ *   The driver identifier.
+ * @return
+ *  The driver name or null if no driver found
+ */
+const char *rte_cryptodev_driver_name_get(uint8_t driver_id);
+
+/**
+ * @internal
+ * Allocate Cryptodev driver.
+ *
+ * @param driver
+ *   Pointer to rte_driver.
+ * @return
+ *  The driver type identifier
+ */
+uint8_t rte_cryptodev_allocate_driver(const struct rte_driver *driver);
+
+
+#define RTE_PMD_REGISTER_CRYPTO_DRIVER(drv, driver_id)\
+RTE_INIT(init_ ##driver_id);\
+static void init_ ##driver_id(void)\
+{\
+       driver_id = rte_cryptodev_allocate_driver(&(drv).driver);\
+}
+
 
 #ifdef __cplusplus
 }